[Bug 839584] New: jasper is #undef'ing true and false

https://bugzilla.novell.com/show_bug.cgi?id=839584 https://bugzilla.novell.com/show_bug.cgi?id=839584#c0 Summary: jasper is #undef'ing true and false Classification: openSUSE Product: openSUSE Factory Version: 13.1 Milestone 4 Platform: Other OS/Version: Other Status: ASSIGNED Severity: Normal Priority: P5 - None Component: Other AssignedTo: pgajdos@suse.com ReportedBy: pgajdos@suse.com QAContact: qa-bugs@suse.de CC: nadvornik@suse.com Found By: --- Blocker: --- bool.c ----------------------------------- #ifdef A #include <jasper/jasper.h> #include <stdbool.h> #endif #ifdef B #include <stdbool.h> #include <jasper/jasper.h> #endif int main(void) { const int my_true = false; const int my_false = true; return 0; } ---------------------------------- $ gcc -DA -o pokus pokus.c $ gcc -DB -o pokus pokus.c pokus.c: In function 'main': pokus.c:12:23: error: 'false' undeclared (first use in this function) const int my_true = false; ^ pokus.c:12:23: note: each undeclared identifier is reported only once for each function it appears in pokus.c:13:24: error: 'true' undeclared (first use in this function) const int my_false = true; ^ -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.

https://bugzilla.novell.com/show_bug.cgi?id=839584 https://bugzilla.novell.com/show_bug.cgi?id=839584#c1 --- Comment #1 from Petr Gajdos <pgajdos@suse.com> 2013-09-11 07:34:15 UTC --- background: netpbm started to fail from $ svn diff -r1382:1968 pm_c_util.h Index: pm_c_util.h =================================================================== --- pm_c_util.h (revision 1382) +++ pm_c_util.h (revision 1968) @@ -41,36 +41,50 @@ use "int". */ -/* We used to assume that if TRUE was defined, then bool was too. - However, we had a report on 2001.09.21 of a Tru64 system that had - TRUE but not bool and on 2002.03.21 of an AIX 4.3 system that was - likewise. So now we define bool all the time, unless the macro - HAVE_BOOL is defined. If someone is using the Netpbm libraries and - also another library that defines bool, he can either make the - other library define/respect HAVE_BOOL or just define HAVE_BOOL in - the file that includes pm_config.h or with a compiler option. Note - that C++ always has bool. +/* We will probably never again see a system that does not have + <stdbool.h>, but just in case, we have our own alternative here. - A preferred way of getting booleans is <stdbool.h>. But it's not - available on all platforms, and it's easy to reproduce what it does - here. + Evidence shows that the compiler actually produces better code with + <stdbool.h> than with bool simply typedefed to int. */ + +#ifdef __cplusplus + /* C++ has a bool type and false and true constants built in. */ +#else + /* The test for __STDC__ is paranoid. It is there just in case some + nonstandard compiler defines __STDC_VERSION__ in an arbitrary manner. + */ + #if ( defined(__GNUC__) && (__GNUC__ >= 3) ) || \ + ( defined(__STDC__) && (__STDC__ ==1) && \ + defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) ) + #include <stdbool.h> + #else + /* We used to assume that if TRUE was defined, then bool was too. + However, we had a report on 2001.09.21 of a Tru64 system that had + TRUE but not bool and on 2002.03.21 of an AIX 4.3 system that was + likewise. So now we define bool all the time, unless the macro + HAVE_BOOL is defined. If someone is using the Netpbm libraries and + also another library that defines bool, he can either make the + other library define/respect HAVE_BOOL or just define HAVE_BOOL in + the file that includes pm_config.h or with a compiler option. Note + that C++ always has bool. + */ + #ifndef HAVE_BOOL + #define HAVE_BOOL 1 + typedef int bool; + #endif + #ifndef true + enum boolvalue {false=0, true=1}; + #endif + #endif +#endif + #ifndef TRUE - #define TRUE 1 + #define TRUE true #endif #ifndef FALSE - #define FALSE 0 +#define FALSE false #endif -/* C++ has a bool type and false and true constants built in. */ -#ifndef __cplusplus - #ifndef HAVE_BOOL - #define HAVE_BOOL 1 - typedef int bool; - #endif - #ifndef true - enum boolvalue {false=0, true=1}; - #endif - #endif #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.

https://bugzilla.novell.com/show_bug.cgi?id=839584 https://bugzilla.novell.com/show_bug.cgi?id=839584#c2 --- Comment #2 from Petr Gajdos <pgajdos@suse.com> 2013-09-11 07:40:21 UTC --- relevant jasper code is in jasper/jas_types.h #if defined(HAVE_STDLIB_H) #undef false <-------- #undef true <-------- #include <stdlib.h> #endif #if defined(HAVE_STDDEF_H) #include <stddef.h> #endif #if defined(HAVE_SYS_TYPES_H) #include <sys/types.h> #endif #ifndef __cplusplus #if defined(HAVE_STDBOOL_H) /* * The C language implementation does correctly provide the standard header * file "stdbool.h". */ #include <stdbool.h> <--------- #else So -DB from comment 0 implies #include <stdbool.h> [...] #undef true #undef false #include <stdbool.h> If stdbool.h would have not been included before #undef's, all would work correctly. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.

https://bugzilla.novell.com/show_bug.cgi?id=839584 https://bugzilla.novell.com/show_bug.cgi?id=839584#c3 Petr Gajdos <pgajdos@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|pgajdos@suse.com |nadvornik@suse.com --- Comment #3 from Petr Gajdos <pgajdos@suse.com> 2013-09-11 08:07:32 UTC --- I have removed #undef's by no-undef-true-false.patch in home:pgajdos:jasper/jasper and link all packages with jasper as dependency and all of them seem to build correctly. Vladimir, see sr#198432. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.

https://bugzilla.novell.com/show_bug.cgi?id=839584 https://bugzilla.novell.com/show_bug.cgi?id=839584#c4 --- Comment #4 from Bernhard Wiedemann <bwiedemann@suse.com> 2013-09-11 11:00:27 CEST --- This is an autogenerated message for OBS integration: This bug (839584) was mentioned in https://build.opensuse.org/request/show/198433 Factory / netpbm -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.

https://bugzilla.novell.com/show_bug.cgi?id=839584 https://bugzilla.novell.com/show_bug.cgi?id=839584#c5 --- Comment #5 from Bernhard Wiedemann <bwiedemann@suse.com> 2013-09-14 17:00:09 CEST --- This is an autogenerated message for OBS integration: This bug (839584) was mentioned in https://build.opensuse.org/request/show/199046 Factory / jasper -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.

https://bugzilla.novell.com/show_bug.cgi?id=839584 https://bugzilla.novell.com/show_bug.cgi?id=839584#c6 Petr Gajdos <pgajdos@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED --- Comment #6 from Petr Gajdos <pgajdos@suse.com> 2013-11-06 07:05:28 UTC --- Fixed. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.

http://bugzilla.novell.com/show_bug.cgi?id=839584 SMASH SMASH <smash_bz@suse.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Whiteboard| | maint:planned:update -- You are receiving this mail because: You are on the CC list for the bug.

http://bugzilla.novell.com/show_bug.cgi?id=839584 Swamp Workflow Management <swamp@suse.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Whiteboard| maint:planned:update |maint:planned:update | |ibs:running:1825:moderate -- You are receiving this mail because: You are on the CC list for the bug.

http://bugzilla.novell.com/show_bug.cgi?id=839584 Swamp Workflow Management <swamp@suse.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Whiteboard|maint:planned:update |ibs:running:1825:moderate |ibs:running:1825:moderate | -- You are receiving this mail because: You are on the CC list for the bug.
participants (1)
-
bugzilla_noreply@novell.com