Using -Wundef when including fribidi header raises a lot of warnings: [/tmp]☭ echo '#include <fribidi.h>' > a.c [/tmp]☭ gcc $(pkg-config --cflags fribidi) -Wundef -c a.c In file included from /usr/include/fribidi/fribidi.h:35:0, from a.c:1: /usr/include/fribidi/fribidi-common.h:35:5: warning: "DONT_HAVE_FRIBIDI_CONFIG_H" is not defined [-Wundef] #if DONT_HAVE_FRIBIDI_CONFIG_H+0 ^ In file included from /usr/include/fribidi/fribidi.h:35:0, from a.c:1: /usr/include/fribidi/fribidi-common.h:45:5: warning: "HAVE_FRIBIDI_CUSTOM_H" is not defined [-Wundef] #if HAVE_FRIBIDI_CUSTOM_H+0 ^ In file included from /usr/include/fribidi/fribidi-unicode.h:38:0, from /usr/include/fribidi/fribidi.h:37, from a.c:1: /usr/include/fribidi/fribidi-types.h:101:5: warning: "FRIBIDI_INT_TYPES" is not defined [-Wundef] #if FRIBIDI_INT_TYPES+0 ^ In file included from /usr/include/fribidi/fribidi.h:37:0, from a.c:1: /usr/include/fribidi/fribidi-unicode.h:46:5: warning: "DONT_HAVE_FRIBIDI_UNICODE_VERSION_H" is not defined [-Wundef] #if DONT_HAVE_FRIBIDI_UNICODE_VERSION_H+0 ^ In file included from a.c:1:0: /usr/include/fribidi/fribidi.h:54:5: warning: "FRIBIDI_NO_DEPRECATED" is not defined [-Wundef] #if FRIBIDI_NO_DEPRECATED+0 ^ Would it be possible to use the form "#if defined(FRIBIDI_WHATEVER) && FRIBIDI_WHATEVER" if these warnings are indeed false positive?
(In reply to comment #0) > Would it be possible to use the form "#if defined(FRIBIDI_WHATEVER) && > FRIBIDI_WHATEVER" Unfortunately that doesn't work: $ cpp #if define(XXX) && XXX sdf #endif # 1 "<stdin>" # 1 "<built-in>" # 1 "<command-line>" # 1 "<stdin>" <stdin>:1:11: error: missing binary operator before token "(" > if these warnings are indeed false positive? They definitely are. I will replace them with normal ifdef... I don't think anyone's setting them to 0 anyway.
Err, my bad. Ignore previous comment!
(In reply to Behdad Esfahbod from comment #1) > (In reply to comment #0) > > > Would it be possible to use the form "#if defined(FRIBIDI_WHATEVER) && > > FRIBIDI_WHATEVER" > > Unfortunately that doesn't work: > > $ cpp > #if define(XXX) && XXX > sdf > #endif > # 1 "<stdin>" > # 1 "<built-in>" > # 1 "<command-line>" > # 1 "<stdin>" > <stdin>:1:11: error: missing binary operator before token "(" That is because the GCC preprocessor does not do short-circuiting apparently, see e.g comments on: https://bugs.webkit.org/show_bug.cgi?id=133785. Can you please use something like: #if defined(XXX) #if XXX to silence these warnings? > > > > if these warnings are indeed false positive? > > They definitely are. I will replace them with normal ifdef... I don't > think anyone's setting them to 0 anyway.
No, the error was because he used "define()" instead of "defined()". The usage example in the first post works.
Any idea as to why we still get these warnings then?
Because it wasn't changed?
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.