This is the mail archive of the libc-alpha@sourceware.cygnus.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]

glibc 2.1.2pre3 <bits/string2.h> -Wpointer-arith warnings


<bits/string2.h> in glibc 2.1.2pre3 generates gratuitous warnings with
gcc -Wpointer-arith.  I think all the uses of arithmetic on void *
pointers could be changed to operate on char * pointers (__extension__
does not protect against -Wpointer-arith warnings).  This does still
leave the residual warnings associated with __string2_1bptr_p, but
these may be more problematic to remove and appear in fewer cases.

Note that the warnings shown below are only those that appear in
inline functions; some more of the problematic cases occur in macros.
<bits/string.h> also seems to have problems.

(Using glibc 2.1.2pre3 configured for i686-linux.)

$ cat >t.c
#include <string.h>
$ gcc -O -Wpointer-arith -D_GNU_SOURCE -c t.c
In file included from /usr/include/string.h:346,
                 from t.c:1:
/usr/include/bits/string2.h: In function `__mempcpy_small':
/usr/include/bits/string2.h:238: warning: pointer of type `void *' used in arithmetic
/usr/include/bits/string2.h:242: warning: pointer of type `void *' used in arithmetic
/usr/include/bits/string2.h:246: warning: pointer of type `void *' used in arithmetic
/usr/include/bits/string2.h:248: warning: pointer of type `void *' used in arithmetic
/usr/include/bits/string2.h:252: warning: pointer of type `void *' used in arithmetic
/usr/include/bits/string2.h:256: warning: pointer of type `void *' used in arithmetic
/usr/include/bits/string2.h:258: warning: pointer of type `void *' used in arithmetic
/usr/include/bits/string2.h:262: warning: pointer of type `void *' used in arithmetic
/usr/include/bits/string2.h:264: warning: pointer of type `void *' used in arithmetic
/usr/include/bits/string2.h:268: warning: pointer of type `void *' used in arithmetic
/usr/include/bits/string2.h:270: warning: pointer of type `void *' used in arithmetic
/usr/include/bits/string2.h:272: warning: pointer of type `void *' used in arithmetic
/usr/include/bits/string2.h:276: warning: pointer of type `void *' used in arithmetic
/usr/include/bits/string2.h:278: warning: pointer of type `void *' used in arithmetic
/usr/include/bits/string2.h: In function `__strcpy_small':
/usr/include/bits/string2.h:419: warning: pointer of type `void *' used in arithmetic
/usr/include/bits/string2.h:427: warning: pointer of type `void *' used in arithmetic
/usr/include/bits/string2.h:432: warning: pointer of type `void *' used in arithmetic
/usr/include/bits/string2.h:437: warning: pointer of type `void *' used in arithmetic
/usr/include/bits/string2.h:439: warning: pointer of type `void *' used in arithmetic
/usr/include/bits/string2.h:444: warning: pointer of type `void *' used in arithmetic
/usr/include/bits/string2.h: In function `__stpcpy_small':
/usr/include/bits/string2.h:575: warning: pointer of type `void *' used in arithmetic
/usr/include/bits/string2.h:579: warning: pointer of type `void *' used in arithmetic
/usr/include/bits/string2.h:584: warning: pointer of type `void *' used in arithmetic
/usr/include/bits/string2.h:588: warning: pointer of type `void *' used in arithmetic
/usr/include/bits/string2.h:593: warning: pointer of type `void *' used in arithmetic
/usr/include/bits/string2.h:595: warning: pointer of type `void *' used in arithmetic
/usr/include/bits/string2.h:599: warning: pointer of type `void *' used in arithmetic
/usr/include/bits/string2.h:601: warning: pointer of type `void *' used in arithmetic
/usr/include/bits/string2.h:606: warning: pointer of type `void *' used in arithmetic
/usr/include/bits/string2.h:608: warning: pointer of type `void *' used in arithmetic

-- 
Joseph S. Myers
jsm28@cam.ac.uk


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