Hi Paul, > > CCLD ebrowse > > cc: "ebrowse.c", line 281: error 1687: Illegal use of flexible array: > > structs with FAMs cannot be members of other structs. > > This suggests that the HP-UX cc flexible array member bug is as follows: if a > struct X contains a 'struct Y *' member where 'struct Y' has a flexible array > member, the compiler incorrectly rejects the definition of struct X.
Confirmed: $ cat foo.c struct Y { int a; char b[]; }; struct X { int b; struct Y *p; }; $ cc -AC99 -c foo.c cc: "foo.c", line 6: error 1687: Illegal use of flexible array: structs with FAMs cannot be members of other structs. > Does the > attached Gnulib patch suffice to detect the HP-UX cc bug? Yes. Output before your patch: checking for flexible array member... yes and after your patch: checking for flexible array member... no > For the problem with __attribute__ ((__aligned__ (8))), does it suffice to > put > the declaration after the identifier? E.g., does this compile: > > int foo __attribute__ ((__aligned__ (8))) = 10; > > whereas this does not compile? > > int __attribute__ ((__aligned__ (8))) bar = 20; No, nothing like this works. $ cat foo.c int aa __attribute__ ((__aligned__ (8))) = 10; int ab __attribute__ ((aligned (8))) = 10; int __attribute__ ((__aligned__ (8))) ac = 10; int __attribute__ ((aligned (8))) ad = 10; __attribute__ ((__aligned__ (8))) int ae = 10; __attribute__ ((aligned (8))) int af = 10; $ cc -AC99 -c foo.c cc: "foo.c", line 1: error 1000: Unexpected symbol: "8". cc: "foo.c", line 1: error 1670: Illegal attribute __aligned__ specified. cc: "foo.c", line 3: error 1000: Unexpected symbol: "8". cc: "foo.c", line 3: error 1670: Illegal attribute aligned specified. cc: "foo.c", line 5: error 1000: Unexpected symbol: "8". cc: "foo.c", line 5: error 1670: Illegal attribute __aligned__ specified. cc: "foo.c", line 7: error 1000: Unexpected symbol: "8". cc: "foo.c", line 7: error 1670: Illegal attribute aligned specified. cc: "foo.c", line 9: error 1000: Unexpected symbol: "8". cc: "foo.c", line 9: error 1670: Illegal attribute __aligned__ specified. cc: "foo.c", line 11: error 1000: Unexpected symbol: "8". cc: "foo.c", line 11: error 1670: Illegal attribute aligned specified. > Also, in your build of Emacs 25.1, is the symbol > HAVE_STRUCT_ATTRIBUTE_ALIGNED > defined in src/config.h? No, it's #undef'ed. > (although we'd also need to fix m4/stdalign.m4 to keep it in sync with > lib/stdalign.in.h). Good point. Here's a revised proposed patch. 2017-03-17 Bruno Haible <br...@clisp.org> stdalign: Make it work with HP-UX cc. * lib/stdalign.in.h (_Alignas): Don't define for HP-UX cc. * m4/stdalign.m4 (gl_STDALIGN_H): No need to enable the extra test for HP-UX cc. diff --git a/lib/stdalign.in.h b/lib/stdalign.in.h index c2b791e..f6f4190 100644 --- a/lib/stdalign.in.h +++ b/lib/stdalign.in.h @@ -103,7 +103,7 @@ # elif ((defined __APPLE__ && defined __MACH__ \ ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \ : __GNUC__) \ - || 061200 <= __HP_cc || 061200 <= __HP_aCC \ + || 061200 <= __HP_aCC \ || __ICC || 0x590 <= __SUNPRO_C || 0x0600 <= __xlC__) # define _Alignas(a) __attribute__ ((__aligned__ (a))) # elif 1300 <= _MSC_VER diff --git a/m4/stdalign.m4 b/m4/stdalign.m4 index 3a12658..5c15ef0 100644 --- a/m4/stdalign.m4 +++ b/m4/stdalign.m4 @@ -35,7 +35,7 @@ AC_DEFUN([gl_STDALIGN_H], || (defined __APPLE__ && defined __MACH__ \ ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \ : __GNUC__) \ - || __HP_cc || __HP_aCC || __IBMC__ || __IBMCPP__ \ + || __HP_aCC || __IBMC__ || __IBMCPP__ \ || __ICC || 0x5110 <= __SUNPRO_C \ || 1300 <= _MSC_VER) struct alignas_test { char c; char alignas (8) alignas_8; };