Weve implemented the #pragma ident which simply generates information in the comment section of an elf object. Solaris uses it throughout its source tree. However, its causing some grief when used in a manner like this:
#include <stdio.h> typedef struct X { int a; int b; } X_t; int z; X_t x[] = { #pragma weak Y = z {0,1}, {2,3} }; int main(int argc, char **argv) { printf("%x",x[0].a); return x[1].b; } Ive replaced ident with weak so it will run on other platforms. For gcc 4.0.1 theres no problem but with 4.2.3 I get the following: /tmp/test.c:11: error: expected expression before '#pragma' The context in which I am seeing a problem is that the C code does something like this: tuple_t x[] = { #include a.h #include b.h }; Each of the .h files have the contents of the structure but they also contain a #pragma ident which causes the compiler to emit the error. Neale -- Summary: #pragma inside structure initialization causes error Product: gcc Version: 4.2.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: neale at sinenomine dot net http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37267