bogus interaction between _GL_INLINE and __NTH when compiling argp.h with g++-4.6 -std=c++0x
Hi, I'm compiling gnulib 23eecb48e39afd0d267d64d40ba6bf97aa865e13 with gcc-4.6, and using it from a C++ project compiled with g++-4.6 -std=c++0x When I attempt to include argp.h, compilation fails: % cat foo.cc #include "config.h" #include "argp.h" % g++-4.6 -DHAVE_CONFIG_H -Ilib -Wall -Werror -std=c++0x -c foo.cc In file included from foo.cc:2:0: lib/argp.h:623:1: error: ‘__leaf__’ attribute has no effect on unit local functions [-Werror=attributes] lib/argp.h:635:1: error: ‘__leaf__’ attribute has no effect on unit local functions [-Werror=attributes] Looking at the preprocessed output, I can see that the two functions : ARGP_EI int : __NTH (__option_is_short (const struct argp_option *__opt)) : /* ... */ : ARGP_EI int : __NTH (__option_is_end (const struct argp_option *__opt)) were expanded as: : static __attribute__ ((__unused__)) int : __attribute__ ((__leaf__)) _option_is_short (const struct argp_option *__opt) throw () : /* ... */ : static __attribute__ ((__unused__)) int : __attribute__ ((__leaf__)) _option_is_end (const struct argp_option *__opt) throw () So __leaf__ was indeed applied to a static function. This "static" comes from the expansion of ARGP_EI: #define ARGP_EI _GL_INLINE /* in argp.h */ #define _GL_INLINE static _GL_UNUSED /* in config.h */ #define _GL_UNUSED __attribute__ ((__unused__)) /* in config.h */ The warning disappears if I use g++-4.6 without the -std=c++0x option. In this case these prototypes become: : extern inline __attribute__ ((__gnu_inline__)) int : __attribute__ ((__leaf__)) _option_is_short (const struct argp_option *__opt) throw () : /* ... */ : extern inline __attribute__ ((__gnu_inline__)) int : __attribute__ ((__leaf__)) _option_is_end (const struct argp_option *__opt) throw () because now config.h has #define _GL_INLINE extern inline __attribute__ ((__gnu_inline__)) The warning also disappear if I use g++-4.7 -std=c++0x. Then we get: : inline int : __attribute__ ((__leaf__)) _option_is_short (const struct argp_option *__opt) throw () : /* ... */ : inline int : __attribute__ ((__leaf__)) _option_is_end (const struct argp_option *__opt) throw () with #define _GL_INLINE inline /* in config.h */ (The difference between 4.6 -std=c++0x and 4.7 -std=c++0x is that the former defines __GNUC_GNU_INLINE__ while the latter defines __GNUC_STDC_INLINE__.) Comments: 1. I do not understand the effect of marking an inline function as leaf, or as nothrow. Shouldn't these attributes be only used to help the compiler when a function is declared, but its body is unknown? 2. Shouldn't _GL_INLINE/_GL_EXTERN_INLINE simply always expand to 'inline' in C++? I've patched my copy of argp.h as suggested in point 1 above to fix my compilation issue (patch attached). But as the implication of __NTH in conjunction with _GL_INLINE is unclear to me, I'm not sure whether this is sane. -- Alexandre Duret-Lutz From c072aaf3ed47169105fbb23dec64644e4277d9ec Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Wed, 18 Dec 2013 13:35:21 +0100 Subject: [PATCH] argp: fix compilation with g++-4.6 -std=c++0x. * lib/argp.h (__option_is_short, __option_is_end) Do not declare with __NTH. The 'leaf' attribute is unwelcome in the case ARGP_EI is implemented with 'static' (this occurs when compiling argp.hh with g++-4.6 -std=c++0x). --- ChangeLog | 9 + lib/argp.h | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1753c8e..8dbcdf3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2013-12-18 Alexandre Duret-Lutz + + argp: fix compilation with g++-4.6 -std=c++0x. + + * lib/argp.h (__option_is_short, __option_is_end) Do not declare + with __NTH. The 'leaf' attribute is unwelcome in the case ARGP_EI + is implemented with 'static' (this occurs when compiling argp.hh + with g++-4.6 -std=c++0x). + 2013-12-17 Paul Eggert gettimeofday: port recent C++ fix to Emacs diff --git a/lib/argp.h b/lib/argp.h index a5f686a..99ea26a 100644 --- a/lib/argp.h +++ b/lib/argp.h @@ -620,7 +620,7 @@ __argp_usage (const struct argp_state *__state) } ARGP_EI int -__NTH (__option_is_short (const struct argp_option *__opt)) +__option_is_short (const struct argp_option *__opt) { if (__opt->flags & OPTION_DOC) return 0; @@ -632,7 +632,7 @@ __NTH (__option_is_short (const struct argp_option *__opt)) } ARGP_EI int -__NTH (__option_is_end (const struct argp_option *__opt)) +__option_is_end (const struct argp_option *__opt) { return !__opt->key && !__opt->name && !__opt->doc && !__opt->group; } -- 1.8.5.1
[PATCH] Re: powerpc64le-linux long double math test failures
Alan Modra wrote: > On Sat, Dec 14, 2013 at 10:13:29PM +0100, Ulrich Weigand wrote: > > I'm wondering now what the best way to fix this would be. I'm a little bit > > confused about the original intentions of the test, however. Why does it > > attempt to move to another word? If it simply attempted to set the > > *second* highest mantissa bit, everything would work out OK. And if it > > does move to another word, why the NWORDS / 2 test? Should we trust the > > gl_BIGENDIAN macro instead? > > I would say "LDBL_EXPBIT0_WORD < NWORDS / 2" is testing for floating > point endianness (which seemingly can be different to integer > endianness, at least it looks that way from code in gcc). Now gcc has > predefined macros to test for exactly that, so.. > > #ifdef __FLOAT_WORD_ORDER__ > #define FLOAT_BIG_ENDIAN (__FLOAT_WORD_ORDER__ != __ORDER_LITTLE_ENDIAN__) > #else > #define FLOAT_BIG_ENDIAN (LDBL_EXPBIT0_WORD < NWORDS / 2) > #endif > > then use FLOAT_BIG_ENDIAN everywhere you see LDBL_EXPBIT0_WORD < NWORDS / 2 I guess that would be one way. I've been working on another patch along these lines in the meantime: > > Or should the test simply hardcode the information about the IBM double > > double format, and treat the first half as 64-bit IEEE double? This seems a bit more natural to me, as it addresses the actual underlying problem with those test cases (IBM double double simply is not an IEEE format, and treating it as such really only worked by accident). The patch below fixes all the isfinite/isinf*/isnan*/signbit module tests for me on powerpc64le-linux, and does not regress on powerpc64-linux. Does this look reasonable? Bye, Ulrich diff --git a/ChangeLog b/ChangeLog index 1753c8e..52ec0df 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2013-12-18 Ulrich Weigand + + Fix math tests for little-endian PowerPC + + * tests/test-isfinite.c (test_isfinitel): Only manipulate the + first double of a PowerPC "double double" pair. + * tests/test-isinf.c (test_isinfl): Likewise. + * tests/test-isnan.c (test_long_double): Likewise. + * tests/test-isnanl.h (main): Likewise. + * tests/test-signbit.c (test_signbitl): Likewise. + 2013-12-17 Paul Eggert gettimeofday: port recent C++ fix to Emacs diff --git a/tests/test-isfinite.c b/tests/test-isfinite.c index 9e8dd0d..a762ceb 100644 --- a/tests/test-isfinite.c +++ b/tests/test-isfinite.c @@ -152,6 +152,15 @@ test_isfinitel () /* A bit pattern that is different from a Quiet NaN. With a bit of luck, it's a Signalling NaN. */ { +#if defined __powerpc__ && LDBL_MANT_DIG == 106 +/* This is PowerPC "double double", a pair of two doubles. Inf and Nan are + represented as the corresponding 64-bit IEEE values in the first double; + the second is ignored. Manipulate only the first double. */ +#undef NWORDS +#define NWORDS \ + ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +#endif + memory_long_double m; m.value = zerol / zerol; # if LDBL_EXPBIT0_BIT > 0 diff --git a/tests/test-isinf.c b/tests/test-isinf.c index 276e480..eb1b7f2 100644 --- a/tests/test-isinf.c +++ b/tests/test-isinf.c @@ -158,6 +158,15 @@ test_isinfl () /* A bit pattern that is different from a Quiet NaN. With a bit of luck, it's a Signalling NaN. */ { +#if defined __powerpc__ && LDBL_MANT_DIG == 106 +/* This is PowerPC "double double", a pair of two doubles. Inf and Nan are + represented as the corresponding 64-bit IEEE values in the first double; + the second is ignored. Manipulate only the first double. */ +#undef NWORDS +#define NWORDS \ + ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +#endif + memory_long_double m; m.value = zerol / zerol; # if LDBL_EXPBIT0_BIT > 0 diff --git a/tests/test-isnan.c b/tests/test-isnan.c index ccebe3d..a11233a 100644 --- a/tests/test-isnan.c +++ b/tests/test-isnan.c @@ -139,6 +139,15 @@ test_long_double (void) /* A bit pattern that is different from a Quiet NaN. With a bit of luck, it's a Signalling NaN. */ { +#if defined __powerpc__ && LDBL_MANT_DIG == 106 +/* This is PowerPC "double double", a pair of two doubles. Inf and Nan are + represented as the corresponding 64-bit IEEE values in the first double; + the second is ignored. Manipulate only the first double. */ +#undef NWORDSL +#define NWORDSL \ + ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +#endif + memory_long_double m; m.value = NaNl (); # if LDBL_EXPBIT0_BIT > 0 diff --git a/tests/test-isnanl.h b/tests/test-isnanl.h index 06e6a7c..2df10f8 100644 --- a/tests/test-isnanl.h +++ b/tests/test-isnanl.h @@ -51,6 +51,15 @@ main () /* A bit pattern that is different from a Quiet NaN. With a bit of luck, it's a Signalling NaN. */ { +#if defined __powerpc__ && LDBL_MANT_DIG == 106 +/* This
Re: bug#16189: FAIL: tests/du/bind-mount-dir-cycle --- patch attached
On 12/19/2013 01:43 AM, Andrew Warshall wrote: > Hi- > >I'm resending this since it didn't seem to go through the first >time; also, I think I have a solution. > >This test fails on my system (Linux 3.7.10 kernel, glibc-2.17); >apparently "du a" is giving as output : > > du: WARNING: Circular directory structure. > This almost certainly means that you have a corrupted file system. > NOTIFY YOUR SYSTEM MANAGER. > The following directory is part of the cycle: > 'a/b' > >instead of the expected > > du: mount point 'a/b' already traversed > >Apparently, ./configure is assuming I don't have hasmntopt(), which >has become an issue because lib/mountlist.c now protects hasmntopt() >with #defines > >I've attached a patch, but I don't have autoconf; so someone who >does should test it before committing it. CC'ing gnulib as that's where this check originates. Also CC'ing interested parties from this related thread from today: http://lists.gnu.org/archive/html/coreutils/2013-12/msg00143.html Thanks for the analysis and patch! Pádraig. diff -Naurx '*~' coreutils-8.22-orig/ChangeLog coreutils-8.22/ChangeLog --- coreutils-8.22-orig/ChangeLog 2013-12-18 20:30:27.0 -0500 +++ coreutils-8.22/ChangeLog 2013-12-18 20:41:16.0 -0500 @@ -1,3 +1,8 @@ +2013-12-18 Andrew D Warshall + + * m4/ls-mntd-fs.m4: Check for hasmntopt() on platforms with + 1-argument getmntent() (instead of assuming absence). + 2013-12-13 Pádraig Brady version 8.22 diff -Naurx '*~' coreutils-8.22-orig/m4/ls-mntd-fs.m4 coreutils-8.22/m4/ls-mntd-fs.m4 --- coreutils-8.22-orig/m4/ls-mntd-fs.m4 2013-12-18 20:30:27.0 -0500 +++ coreutils-8.22/m4/ls-mntd-fs.m4 2013-12-18 20:32:22.0 -0500 @@ -151,6 +151,7 @@ [Define if there is a function named getmntent for reading the list of mounted file systems, and that function takes a single argument. (4.3BSD, SunOS, HP-UX, Dynix, Irix)]) + AC_CHECK_FUNCS([hasmntopt]) fi fi