After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 651548 - scanner warnings with files that #include gthread.h (with latest glib)
scanner warnings with files that #include gthread.h (with latest glib)
Status: RESOLVED FIXED
Product: gobject-introspection
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
: 651660 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2011-05-31 13:25 UTC by Dan Winship
Modified: 2015-02-07 16:52 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
scanner: Cleanup lexing code (1.66 KB, patch)
2011-06-01 22:37 UTC, Colin Walters
needs-work Details | Review
Add giscanner-parser-test program (1.06 KB, patch)
2011-06-01 22:37 UTC, Colin Walters
needs-work Details | Review
scanner: Parse GNUC expression statements (2.01 KB, patch)
2011-06-01 22:37 UTC, Colin Walters
none Details | Review
scanner: Parse GNUC expression statements (825 bytes, patch)
2011-06-02 19:23 UTC, Colin Walters
committed Details | Review

Description Dan Winship 2011-05-31 13:25:50 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'
Comment 1 Colin Walters 2011-05-31 15:11:05 UTC
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.
Comment 2 Emmanuele Bassi (:ebassi) 2011-06-01 19:45:41 UTC
*** Bug 651660 has been marked as a duplicate of this bug. ***
Comment 3 Colin Walters 2011-06-01 19:52:24 UTC
So this still exists; I'm debugging it.
Comment 4 Colin Walters 2011-06-01 22:37:32 UTC
Created attachment 189046 [details] [review]
scanner: Cleanup lexing code

Preparatory work for a standalone lexing test program.
Comment 5 Colin Walters 2011-06-01 22:37:36 UTC
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.
Comment 6 Colin Walters 2011-06-01 22:37:39 UTC
Created attachment 189048 [details] [review]
scanner: Parse GNUC expression statements

This is needed so we don't fail to parse gatomic.h from GLib.
Comment 7 Colin Walters 2011-06-01 22:38:22 UTC
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.
Comment 8 Colin Walters 2011-06-02 18:50:40 UTC
Review of attachment 189047 [details] [review]:

Forgot to attach the test program.
Comment 9 Owen Taylor 2011-06-02 19:09:09 UTC
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?
Comment 10 Colin Walters 2011-06-02 19:23:12 UTC
Created attachment 189117 [details] [review]
scanner: Parse GNUC expression statements

Update from verbal comments by Owen
Comment 11 Colin Walters 2011-06-02 21:05:59 UTC
Comment on attachment 189117 [details] [review]
scanner: Parse GNUC expression statements

Attachment 189117 [details] pushed as ae4fb79 - scanner: Parse GNUC expression statements
Comment 12 Fabio 2011-06-03 09:37:46 UTC
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   ***
Comment 13 Emmanuele Bassi (:ebassi) 2011-06-03 10:20:16 UTC
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.
Comment 14 Fabio 2011-06-04 11:31:02 UTC
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]
Comment 15 André Klapper 2015-02-07 16:52:13 UTC
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]