Could some compiler guru advise me here? (CW? you seem to know
which is the pointy end of a compiler)
Is this the right fix? swab.h isn't real pretty to start with,
but this seems like a simple fixup... (hmm, is it going to work
on all gcc versions I wonder?)
thanks.
----- Forwarded message from Stephan A Suerken <absurd@xxxxxxxxxx> -----
Date: Mon, 17 May 2004 14:00:51 +0200
To: Debian Bug Tracking System <submit@xxxxxxxxxxxxxxx>
Reply-To: Stephan A Suerken <absurd@xxxxxxxxxx>, 249429@xxxxxxxxxxxxxxx
From: Stephan A Suerken <absurd@xxxxxxxxxx>
Subject: Bug#249429: xfslibs-dev: xfs/swab.h not ISO-C(++) compliant
Package: xfslibs-dev
Version: 2.6.11-1
Severity: normal
Tags: patch, upstream
Hi,
when including XFS support from any C++ (maybe C as well) program and
compiling it with "-pedantic" will lead to:
---
In file included from /usr/include/xfs/platform_defs.h:60,
from /usr/include/xfs/libxfs.h:38,
from /usr/include/xfs/xqm.h:36,
from QuotaInfo.cpp:17:
/usr/include/xfs/swab.h: In function `const __u16 __fswab16(short unsigned int)
':
/usr/include/xfs/swab.h:113: error: ISO C++ forbids braced-groups within
expressions
---
Afaik, includes intended for user space should have this fixed (for
gcc, at least) via "__extension__", as in the patch.
--- swab.h.orig 2004-05-17 13:54:00.000000000 +0200
+++ swab.h 2004-05-17 13:44:40.000000000 +0200
@@ -110,28 +110,28 @@
static __inline__ __const__ __u16 __fswab16(__u16 x)
{
- return __arch__swab16(x);
+ return (__extension__ __arch__swab16(x));
}
static __inline__ __u16 __swab16p(__u16 *x)
{
- return __arch__swab16p(x);
+ return (__extension__ __arch__swab16p(x));
}
static __inline__ void __swab16s(__u16 *addr)
{
- __arch__swab16s(addr);
+ (__extension__ ({__arch__swab16s(addr);}));
}
static __inline__ __const__ __u32 __fswab32(__u32 x)
{
- return __arch__swab32(x);
+ return (__extension__ __arch__swab32(x));
}
static __inline__ __u32 __swab32p(__u32 *x)
{
- return __arch__swab32p(x);
+ return (__extension__ __arch__swab32p(x));
}
static __inline__ void __swab32s(__u32 *addr)
{
- __arch__swab32s(addr);
+ (__extension__ ({__arch__swab32s(addr);}));
}
static __inline__ __const__ __u64 __fswab64(__u64 x)
@@ -141,16 +141,16 @@
__u32 l = x & ((1ULL<<32)-1);
return (((__u64)__swab32(l)) << 32) | ((__u64)(__swab32(h)));
# else
- return __arch__swab64(x);
+ return (__extension__ __arch__swab64(x));
# endif
}
static __inline__ __u64 __swab64p(__u64 *x)
{
- return __arch__swab64p(x);
+ return (__extension__ __arch__swab64p(x));
}
static __inline__ void __swab64s(__u64 *addr)
{
- __arch__swab64s(addr);
+ (__extension__ ({__arch__swab64s(addr);}));
}
#endif /* SWAB_H */
---UDIFFEND---
-- System Information:
Debian Release: testing/unstable
APT prefers unstable
APT policy: (1002, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.4.22-custom-adkm-manwe
Locale: LANG=C, LC_CTYPE=de_DE@euro
Versions of packages xfslibs-dev depends on:
ii libc6-dev 2.3.2.ds1-12 GNU C Library: Development Librari
ii uuid-dev 1.2-1.35-6 Universally unique id library - he
ii xfsprogs 2.6.11-1 Utilities for managing the XFS fil
-- no debconf information
----- End forwarded message -----
--
Nathan
|