Hi Paul, Le 6 déc. 2012 à 18:48, Paul Eggert <egg...@cs.ucla.edu> a écrit :
> In file included from ../../../lib/mbschr.c:23:0: > ../../../lib/mbschr.c: At top level: > ../../../lib/mbuiter.h:201:181: warning: '__inline_memset_chk' is static but > used in inline function 'mbuiter_multi_copy' which is not static [enabled by > default] > memset (&new_iter->state, 0, sizeof (mbstate_t)); > > This (and similar warnings) appear to be a bug in the > build environment. It ought to be OK > to invoke memset from an extern inline function. > My guess is that the warning can be safely ignored. > You might want to file a bug report with Apple or > whoever. That's good old GCC, every version I can run from 4.3 to 4.8. This is a stripped down version of the code from gnulib on my platform. $ cat mbschr.i static __inline int iswcntrl(int wc) { return wc; } inline int mb_width_aux (int wc) { return iswcntrl (wc); } $ gcc-mp-4.3 -c mbschr.i $ gcc-mp-4.3 -std=gnu99 -c mbschr.i mbschr.i: In function 'mb_width_aux': mbschr.i:10: warning: 'iswcntrl' is static but used in inline function 'mb_width_aux' which is not static $ gcc-mp-4.3 -std=c99 -c mbschr.i mbschr.i: In function 'mb_width_aux': mbschr.i:10: warning: 'iswcntrl' is static but used in inline function 'mb_width_aux' which is not static $ gcc-mp-4.8 -std=gnu99 -c mbschr.i mbschr.i:10:10: warning: 'iswcntrl' is static but used in inline function 'mb_width_aux' which is not static [enabled by default] return iswcntrl (wc); ^ The prototype comes from /usr/include/_wctype.h: > #ifndef __DARWIN_WCTYPE_TOP_static_inline > #define __DARWIN_WCTYPE_TOP_static_inline static __inline > #endif > ... > > __DARWIN_WCTYPE_TOP_static_inline int > iswcntrl(wint_t _wc) > { > return (__istype(_wc, _CTYPE_C)); > } The warning is legitimate, as 6.7.4.3 in C99 reads: • An inline definition of a function with external linkage shall not contain a definition of a modifiable object with static storage duration, and shall not contain a reference to an identifier with internal linkage. The problem is the prototype of iswcntrl which is incompatible with the use in an inline function. Yet I don't understand why GCC does not accept that inline functions call static functions that are inline too.