Build failure because #pragma GCC diagnostic is not allowed inside functions
mailbox synchronizer
Brought to you by:
ossi
Hi, I'm a developer with MacPorts.
We just updated to isync 1.3.0. I noticed it does not build on older systems.
One reason for build failure on Mac OS X 10.6 and earlier, which uses the Apple-modified version of GCC 4.2.1, is:
util.c: In function ‘map_name’:
util.c:523: error: #pragma GCC diagnostic not allowed inside functions
util.c:525: error: #pragma GCC diagnostic not allowed inside functions
util.c:529: error: #pragma GCC diagnostic not allowed inside functions
make[3]: *** [util.o] Error 1
Later versions of macOS which use clang as the compiler merely warn that they are ignoring this unknown directive:
util.c:525:33: warning: unknown warning group '-Wmaybe-uninitialized', ignored [-Wunknown-pragmas]
# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
^
Since the issue you're working around with this pragma is a bug in GCC 4.3 and later, and since we don't use those versions of GCC to build isync, I can remove the pragmas in MacPorts, but maybe there's a way you can adjust the code so that it can still be compiled by GCC 4.2, such as moving the pragmas to surround the entire function.
Sorry, I forgot to set the Milestone to 1.3.0 and I don't see a way to edit the ticket. You should make 1.3.0 the default Milestone.
1.2.3 is also a fresh release, so it's a reasonable target. however, it's probably true that most users would use the highest version, so changed the default.