Bug 82548

Summary: Undefined warnings
Product: FriBidi Reporter: ubitux <freedesktop>
Component: generalAssignee: Behnam Esfahbod [:zwnj] <bugs+behnam>
Status: NEW --- QA Contact:
Severity: normal    
Priority: medium CC: freedesktop, gajjanag
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description ubitux 2014-08-13 08:38:51 UTC
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?
Comment 1 Behdad Esfahbod 2014-08-13 15:30:56 UTC
(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.
Comment 2 Behdad Esfahbod 2014-08-13 15:33:51 UTC
Err, my bad. Ignore previous comment!
Comment 3 gajjanag 2015-10-07 22:52:02 UTC
(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.
Comment 4 ubitux 2015-10-08 06:44:00 UTC
No, the error was because he used "define()" instead of "defined()". The usage example in the first post works.
Comment 5 gajjanag 2015-10-08 11:34:35 UTC
Any idea as to why we still get these warnings then?
Comment 6 ubitux 2015-10-10 08:50:23 UTC
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.