GNOME Bugzilla – Bug 651548
scanner warnings with files that #include gthread.h (with latest glib)
Last modified: 2015-02-07 16:52:13 UTC
/opt/jhbuild/include/glib-2.0/glib/gthread.h:347: syntax error, unexpected '{' in ' if ((gpointer) (__extension__ ({ typedef struct { char Compile_Time_Assertion[(sizeof *(value_location) == sizeof (gpointer)) ? 1 : -1]; } _GStaticAssert_347; __sync_synchronize (); (gpointer) *(value_location); })) != ((void *)0))' at '{' /opt/jhbuild/include/glib-2.0/glib/gthread.h:347: syntax error, unexpected identifier in ' if ((gpointer) (__extension__ ({ typedef struct { char Compile_Time_Assertion[(sizeof *(value_location) == sizeof (gpointer)) ? 1 : -1]; } _GStaticAssert_347; __sync_synchronize (); (gpointer) *(value_location); })) != ((void *)0))' at '__sync_synchronize'
commit 2300be5be38e091aeac55720cf51bc98e7f89790 Author: Colin Walters <walters@verbum.org> Date: Tue May 31 10:35:38 2011 -0400 Consistently use G_GNUC_EXTENSION instead of __extension__ g-ir-scanner doesn't like __extension__, and while I can add it, since we have this macro, we should be using it consistently.
*** Bug 651660 has been marked as a duplicate of this bug. ***
So this still exists; I'm debugging it.
Created attachment 189046 [details] [review] scanner: Cleanup lexing code Preparatory work for a standalone lexing test program.
Created attachment 189047 [details] [review] Add giscanner-parser-test program This is useful for debugging scanner issues, and maybe we can add it to the unit tests later.
Created attachment 189048 [details] [review] scanner: Parse GNUC expression statements This is needed so we don't fail to parse gatomic.h from GLib.
The first patch introduces a strange regression; I *think* it's happening because previously we totally ignored the return value of fopen(), and when I changed it to "return FALSE" in that case, somehow it turns into a parse error.
Review of attachment 189047 [details] [review]: Forgot to attach the test program.
Review of attachment 189048 [details] [review]: ::: giscanner/scannerlexer.l @@ +78,3 @@ "//".* { } +"({" { return GNUC_STMT_EXPRESSION_START; } ( { is also a perfectly valid statement expression as far as GCC is concerned - if there's no reason to hack it in the tokenizer - and as far as I can immediately see it should work to just have: '(' '{' block_item_list '}' ')' in scannerparser.y I'd do that instead. ::: giscanner/scannerparser.y @@ -616,3 @@ : assignment_expression | expression ',' assignment_expression - | EXTENSION expression I don't think you want to remove this - __extension__ is a keyword that is pretty general in GCC - `-pedantic' and other options cause warnings for many GNU C extensions. You can prevent such warnings within one expression by writing `__extension__' before the expression. `__extension__' has no effect aside from this. So, I don't think there's a reason to just accept it in a few random places - we might as well support it before any expression - so I think you don't nee it where you added it for statement expressions if you left it here?
Created attachment 189117 [details] [review] scanner: Parse GNUC expression statements Update from verbal comments by Owen
Comment on attachment 189117 [details] [review] scanner: Parse GNUC expression statements Attachment 189117 [details] pushed as ae4fb79 - scanner: Parse GNUC expression statements
the above error isn't present anymore, but it won't compile *** Building json-glib *** [19/43] make make all-recursive make[1]: Entering directory `/home/njin/gnome-shell/source/json-glib' Making all in json-glib make[2]: Entering directory `/home/njin/gnome-shell/source/json-glib/json-glib' GEN stamp-enum-types GEN stamp-marshal make all-recursive make[3]: Entering directory `/home/njin/gnome-shell/source/json-glib/json-glib' Making all in . make[4]: Entering directory `/home/njin/gnome-shell/source/json-glib/json-glib' CC json-array.lo ./json-array.c: In function 'json_array_ref': ./json-array.c:105:3: warning: implicit declaration of function 'g_atomic_int_exchange_and_add' [-Wimplicit-function-declaration] CC json-builder.lo CC json-debug.lo CC json-gboxed.lo CC json-generator.lo CC json-gobject.lo CC json-node.lo CC json-object.lo ./json-object.c: In function 'json_object_ref': ./json-object.c:92:3: warning: implicit declaration of function 'g_atomic_int_exchange_and_add' [-Wimplicit-function-declaration] CC json-parser.lo CC json-path.lo ./json-path.c: In function 'json_path_compile': ./json-path.c:492:42: warning: field width specifier '*' expects argument of type 'int', but argument 5 has type 'long int' [-Wformat] ./json-path.c:536:42: warning: field width specifier '*' expects argument of type 'int', but argument 5 has type 'long int' [-Wformat] ./json-path.c:589:38: warning: field width specifier '*' expects argument of type 'int', but argument 5 has type 'long int' [-Wformat] ./json-path.c:617:34: warning: field width specifier '*' expects argument of type 'int', but argument 5 has type 'long int' [-Wformat] CC json-reader.lo CC json-scanner.lo CC json-serializable.lo CC json-gvariant.lo CC json-enum-types.lo CC json-marshal.lo CCLD libjson-glib-1.0.la GISCAN Json-1.0.gir GICOMP Json-1.0.gir make[4]: Leaving directory `/home/njin/gnome-shell/source/json-glib/json-glib' Making all in tests make[4]: Entering directory `/home/njin/gnome-shell/source/json-glib/json-glib/tests' CC array-test.o CCLD array-test /usr/bin/ld: array-test.o: undefined reference to symbol 'g_type_init' /usr/bin/ld: note: 'g_type_init' is defined in DSO /home/njin/gnome-shell/install/lib64/libgobject-2.0.so.0 so try adding it to the linker command line /home/njin/gnome-shell/install/lib64/libgobject-2.0.so.0: could not read symbols: Invalid operation collect2: ld returned 1 exit status make[4]: *** [array-test] Error 1 make[4]: Leaving directory `/home/njin/gnome-shell/source/json-glib/json-glib/tests' make[3]: *** [all-recursive] Error 1 make[3]: Leaving directory `/home/njin/gnome-shell/source/json-glib/json-glib' make[2]: *** [all] Error 2 make[2]: Leaving directory `/home/njin/gnome-shell/source/json-glib/json-glib' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/njin/gnome-shell/source/json-glib' make: *** [all] Error 2 *** Error during phase build of json-glib: ########## Error running make ***
the last warning is because json-glib builds with G_DISABLE_DEPRECATED; just removed it from master and json-glib-0-12, and will update master to use the newly added atomic operators.
It won't compile... *** Building json-glib *** [19/43] make make all-recursive make[1]: Entering directory `/home/njin/gnome-shell/source/json-glib' Making all in json-glib make[2]: Entering directory `/home/njin/gnome-shell/source/json-glib/json-glib' GEN stamp-enum-types GEN json-enum-types.c GEN stamp-marshal GEN json-marshal.c make all-recursive make[3]: Entering directory `/home/njin/gnome-shell/source/json-glib/json-glib' Making all in . make[4]: Entering directory `/home/njin/gnome-shell/source/json-glib/json-glib' CC json-array.lo CC json-builder.lo CC json-debug.lo CC json-gboxed.lo CC json-generator.lo CC json-gobject.lo CC json-node.lo CC json-object.lo CC json-parser.lo CC json-path.lo ./json-path.c: In function 'json_path_compile': ./json-path.c:492:42: warning: field width specifier '*' expects argument of type 'int', but argument 5 has type 'long int' [-Wformat] ./json-path.c:536:42: warning: field width specifier '*' expects argument of type 'int', but argument 5 has type 'long int' [-Wformat] ./json-path.c:589:38: warning: field width specifier '*' expects argument of type 'int', but argument 5 has type 'long int' [-Wformat] ./json-path.c:617:34: warning: field width specifier '*' expects argument of type 'int', but argument 5 has type 'long int' [-Wformat] CC json-reader.lo CC json-scanner.lo CC json-serializable.lo CC json-gvariant.lo CC json-enum-types.lo CC json-marshal.lo CCLD libjson-glib-1.0.la GISCAN Json-1.0.gir GICOMP Json-1.0.gir make[4]: Leaving directory `/home/njin/gnome-shell/source/json-glib/json-glib' Making all in tests make[4]: Entering directory `/home/njin/gnome-shell/source/json-glib/json-glib/tests' CC array-test.o CCLD array-test /usr/bin/ld: array-test.o: undefined reference to symbol 'g_type_init' /usr/bin/ld: note: 'g_type_init' is defined in DSO /home/njin/gnome-shell/install/lib64/libgobject-2.0.so.0 so try adding it to the linker command line /home/njin/gnome-shell/install/lib64/libgobject-2.0.so.0: could not read symbols: Invalid operation collect2: ld returned 1 exit status make[4]: *** [array-test] Error 1 make[4]: Leaving directory `/home/njin/gnome-shell/source/json-glib/json-glib/tests' make[3]: *** [all-recursive] Error 1 make[3]: Leaving directory `/home/njin/gnome-shell/source/json-glib/json-glib' make[2]: *** [all] Error 2 make[2]: Leaving directory `/home/njin/gnome-shell/source/json-glib/json-glib' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/njin/gnome-shell/source/json-glib' make: *** [all] Error 2 *** Error during phase build of json-glib: ########## Error running make *** [19/43]
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]