This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

nonnull markings in sys/cdefs.h causes trouble with gcc-3.3 ?


lately we started noticing some bugs on systems that were using an updated 
glibc version (~2.3.4) with gcc-3.3.5:
http://bugs.gentoo.org/show_bug.cgi?id=87981

some packages define local versions of strcasestr() which gcc-3.3.x bails on 
because it's defined in string.h.  a simple test case:
$ cat string.cpp
#include <string.h>
char *strcasestr(const char *haystack, const char *needle);
char *strcasestr(const char *haystack, const char *needle){return 0;}

yields this with gcc-3.3.x:
$ g++-3.3 -c string.cpp
string.cpp: In function `char* strcasestr(const char*, const char*)':
string.cpp:3: error: declaration of `char* strcasestr(const char*, const 
char*)' throws different exceptions
string.cpp:2: error: than previous declaration `char* strcasestr(const char*, 
   const char*) throw ()'

if sys/cdefs.h is updated with this change though, gcc-3.3.x works just fine:
--- misc/sys/cdefs.h
+++ misc/sys/cdefs.h
@@ -252,3 +252,3 @@
    must not be NULL.  */
-#if __GNUC_PREREQ (3,3)
+#if __GNUC_PREREQ (3,4)
 # define __nonnull(params) __attribute__ ((__nonnull__ params))

things to note:
- vanilla versions of gcc versions 3.3.1, 3.3.2, 3.3.3, 3.3.4, 3.3.5, and 
3.3-20050406 were tested and all yielded the same results
- gcc-3.4.3 works fine (tested both Gentoo and Debian)
- current versions of Debian unstable do not exhibit this bug because they are 
using 2.3.2 + some patches (which is to say, the nonnull #define's do not 
exist in their sys/cdefs.h) ... however, if you just update the string.h and 
cdefs.h headers with the __nonnull markings in debian unstable, their 
gcc-3.3.5-12 will exhibit this bug

so the question is, should glibc simply update the nonnull() markings to only 
be used in gcc-3.4+, or will this issue need to be taken to the gcc-3.3 
branch for fixing (which is to say it'll prob not happen for 3.3.6) ?
-mike


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]