Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

GLib and -Wpedantic #4062

Closed
mpranj opened this issue Sep 22, 2021 · 1 comment · Fixed by #4071
Closed

GLib and -Wpedantic #4062

mpranj opened this issue Sep 22, 2021 · 1 comment · Fixed by #4071
Labels
Milestone

Comments

@mpranj
Copy link
Member

mpranj commented Sep 22, 2021

As mentioned in #4055 (comment) compiling GLib (since 2.70.0) currently causes the following error:

[329/751] Building C object src/bindings/io/glib/CMakeFiles/testio_glib.dir/testio_glib.c.o
FAILED: src/bindings/io/glib/CMakeFiles/testio_glib.dir/testio_glib.c.o 
/usr/local/opt/llvm/bin/clang  -Isrc/include -I../src/include -I../tests/cframework -I../src/bindings/io/glib/SYSTEM -I/usr/local/Cellar/glib/2.70.0/include/glib-2.0 -I/usr/local/Cellar/glib/2.70.0/lib/glib-2.0/include -std=gnu99  -Wno-deprecated-declarations  -Wstrict-prototypes -Werror -Wno-long-long -Wpedantic -Wno-variadic-macros -Wall -Wextra -Wno-overlength-strings -Wsign-compare -Wfloat-equal -Wformat -Wformat-security -Wshadow -Wcomments -Wtrigraphs -Wundef -Wuninitialized -Winit-self -Wsign-compare -Wfloat-equal -O2 -g -DNDEBUG -isysroot /Applications/Xcode-12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk -mmacosx-version-min=11.2 -MD -MT src/bindings/io/glib/CMakeFiles/testio_glib.dir/testio_glib.c.o -MF src/bindings/io/glib/CMakeFiles/testio_glib.dir/testio_glib.c.o.d -o src/bindings/io/glib/CMakeFiles/testio_glib.dir/testio_glib.c.o -c ../src/bindings/io/glib/testio_glib.c
In file included from ../src/bindings/io/glib/testio_glib.c:17:
In file included from /usr/local/Cellar/glib/2.70.0/include/glib-2.0/glib.h:30:
In file included from /usr/local/Cellar/glib/2.70.0/include/glib-2.0/glib/galloca.h:32:
/usr/local/Cellar/glib/2.70.0/include/glib-2.0/glib/gtypes.h:463:3: error: '_Static_assert' is a C11 extension [-Werror,-Wc11-extensions]
  G_STATIC_ASSERT(sizeof (unsigned long long) == sizeof (guint64));
  ^
/usr/local/Cellar/glib/2.70.0/include/glib-2.0/glib/gmacros.h:819:31: note: expanded from macro 'G_STATIC_ASSERT'
#define G_STATIC_ASSERT(expr) _Static_assert (expr, "Expression evaluates to false")
                              ^
1 error generated.

After reporting the problem upstream it turns out that GLib does not support the -Wpedantic flag as documented here: https://wiki.gnome.org/Projects/GLib/CompilerRequirements.

They also noted that -std=gnu99 and -Wpedantic should not be used together.

In either case, it seems they will not support -Wpedantic any time soon, so we will at least have to remove the flag where glib is used.

@markus2330
Copy link
Contributor

Thank you for #4067. The proper fix is probably simply to disable -Wpedantic for glib? Similar modifications already exist for swig bindings. 74c3dad can be reverted then.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants