bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: xalloc: missing prototype


From: Akim Demaille
Subject: Re: xalloc: missing prototype
Date: Thu, 6 Dec 2012 09:05:23 +0100

Hi Paul!

Le 5 déc. 2012 à 17:58, Paul Eggert <address@hidden> a écrit :

> On 12/05/2012 07:34 AM, Akim Demaille wrote:
>> I can't compile Bison with GCC 4.3 and 4.4 (newer ones seem to
>> be happy,
> 
> When you say "can't compile", do you mean you mean the compilation
> fails?  The diagnostics you sent all seemed to be just warnings.

Bison uses -Werror for its own sources (src/), not the library
part (lib/).  In lib/ there are many similar warnings that we
just ignore because that's the way gnulib is.  I feel uncomfortable
with ignoring warnings (even with 4.8), but I don't have much of a
choice here, as that's the gnulib policy (compilation log at the
bottom of this message).

Missing prototypes in gnulib's public headers, such as xalloc.h,
cause -Werror in src/ to fail.  That's the only failure I observe
currently (it may have already happened before, but then the
prototypes must have been added to fix the issue).

> Adding _GL_ATTRIBUTE_ALLOC_SIZE ((3)) to x2nrealloc isn't right,
> since its 3rd argument is a lower bound on the number of bytes
> allocated, not the exact number of bytes which is what GCC wants.

Ah, sorry about that.

> If this is the only warning generated for older GCCs it might
> be worth it, as a pragmatic issue, to put in the duplicate
> declaration (without _GL_ATTRIBUTE_ALLOC_SIZE).  Maybe if someone
> else complains, say.  But I'd rather encourage people
> to use newer GCCs if they're enabling warnings left and right,
> as older GCCs are just too buggy to be worth worrying about.

I fully agree with the desire to promote newer compilers on
user machines, yet I must try Bison on a large bunch of
compilers, including "old" compilers such as 4.5.  I am also
experimenting with tcc currently, and see many issues to address.

The need to try many compilers is of course even more important
in the case of Bison where I want to try the generated parsers
with as many compilers as I can.



Is there some documentation/page/whatever detailing the decisions
(and their rationale) that gnulib has made with respect to compiler
warnings?





gmake[2]: Entering directory `/Users/akim/src/gnu/bison-2.5/_build/48-debug/lib'
  GEN      alloca.h
  GEN      configmake.h
  GEN      c++defs.h
  GEN      arg-nonnull.h
  GEN      warn-on-use.h
  GEN      fcntl.h
  GEN      getopt.h
  GEN      inttypes.h
  GEN      math.h
  GEN      sched.h
  GEN      signal.h
  GEN      spawn.h
  GEN      stdio.h
  GEN      stdlib.h
  GEN      string.h
  GEN      sys/stat.h
  GEN      sys/types.h
  GEN      sys/wait.h
  GEN      time.h
  GEN      unistd.h
  GEN      ../../../lib/unitypes.h
  GEN      ../../../lib/uniwidth.h
  GEN      wchar.h
  GEN      wctype.h
gmake  all-am
gmake[3]: Entering directory `/Users/akim/src/gnu/bison-2.5/_build/48-debug/lib'
  CC       main.o
  CC       yyerror.o
  AR       liby.a
  CC       argmatch.o
  CC       binary-io.o
  CC       bitrotate.o
  CC       c-ctype.o
  CC       c-strcasecmp.o
  CC       c-strncasecmp.o
  CC       cloexec.o
  CC       close-stream.o
  CC       closeout.o
  CC       dirname.o
  CC       basename.o
  CC       dirname-lgpl.o
  CC       basename-lgpl.o
../../../lib/basename-lgpl.c: In function 'last_component':
../../../lib/basename-lgpl.c:50:10: warning: cast discards 
'__attribute__((const))' qualifier from pointer target type [-Wcast-qual]
   return (char *) base;
          ^
  CC       stripslash.o
  CC       exitfail.o
  CC       fatal-signal.o
  CC       fd-hook.o
  CC       fd-safer-flag.o
  CC       dup-safer-flag.o
  CC       fopen-safer.o
  CC       hash.o
../../../lib/hash.c: In function 'hash_insert_if_absent':
../../../lib/hash.c:1103:25: warning: cast discards '__attribute__((const))' 
qualifier from pointer target type [-Wcast-qual]
       new_entry->data = (void *) entry;
                         ^
../../../lib/hash.c:1112:18: warning: cast discards '__attribute__((const))' 
qualifier from pointer target type [-Wcast-qual]
   bucket->data = (void *) entry;
                  ^
../../../lib/hash.c: In function 'hash_insert':
../../../lib/hash.c:1140:13: warning: cast discards '__attribute__((const))' 
qualifier from pointer target type [-Wcast-qual]
           : (void *) (err == 0 ? matched_ent : entry));
             ^
  CC       localcharset.o
  CC       lock.o
  CC       math.o
  CC       mbchar.o
  CC       mbschr.o
../../../lib/mbschr.c: In function 'mbschr':
../../../lib/mbschr.c:46:14: warning: cast discards '__attribute__((const))' 
qualifier from pointer target type [-Wcast-qual]
       return (char *) mbui_cur_ptr (iter);
              ^
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));
                                                                                
                                                                                
                     ^
In file included from ../../../lib/mbschr.c:23:0:
../../../lib/mbuiter.h:199:196: warning: '__inline_memcpy_chk' is static but 
used in inline function 'mbuiter_multi_copy' which is not static [enabled by 
default]
     memcpy (&new_iter->state, &old_iter->state, sizeof (mbstate_t));
                                                                                
                                                                                
                                    ^
In file included from ../../../lib/mbuiter.h:106:0,
                 from ../../../lib/mbschr.c:23:
../../../lib/mbchar.h:269:194: warning: '__inline_memcpy_chk' is static but 
used in inline function 'mb_copy' which is not static [enabled by default]
       memcpy (&new_mbc->buf[0], &old_mbc->buf[0], old_mbc->bytes);
                                                                                
                                                                                
                                  ^
In file included from ../../../lib/mbuiter.h:106:0,
                 from ../../../lib/mbschr.c:23:
../../../lib/mbchar.h:249:24: warning: 'iswcntrl' is static but used in inline 
function 'mb_width_aux' which is not static [enabled by default]
   return (w >= 0 ? w : iswcntrl (wc) ? 0 : MB_UNPRINTABLE_WIDTH);
                        ^
  CC       mbsrchr.o
../../../lib/mbsrchr.c: In function 'mbsrchr':
../../../lib/mbsrchr.c:45:14: warning: cast discards '__attribute__((const))' 
qualifier from pointer target type [-Wcast-qual]
       return (char *) result;
              ^
In file included from ../../../lib/mbsrchr.c:23:0:
../../../lib/mbsrchr.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));
                                                                                
                                                                                
                     ^
In file included from ../../../lib/mbsrchr.c:23:0:
../../../lib/mbuiter.h:199:196: warning: '__inline_memcpy_chk' is static but 
used in inline function 'mbuiter_multi_copy' which is not static [enabled by 
default]
     memcpy (&new_iter->state, &old_iter->state, sizeof (mbstate_t));
                                                                                
                                                                                
                                    ^
In file included from ../../../lib/mbuiter.h:106:0,
                 from ../../../lib/mbsrchr.c:23:
../../../lib/mbchar.h:269:194: warning: '__inline_memcpy_chk' is static but 
used in inline function 'mb_copy' which is not static [enabled by default]
       memcpy (&new_mbc->buf[0], &old_mbc->buf[0], old_mbc->bytes);
                                                                                
                                                                                
                                  ^
In file included from ../../../lib/mbuiter.h:106:0,
                 from ../../../lib/mbsrchr.c:23:
../../../lib/mbchar.h:249:24: warning: 'iswcntrl' is static but used in inline 
function 'mb_width_aux' which is not static [enabled by default]
   return (w >= 0 ? w : iswcntrl (wc) ? 0 : MB_UNPRINTABLE_WIDTH);
                        ^
  CC       mbswidth.o
  CC       mbuiter.o
In file included from ../../../lib/mbuiter.h:106:0,
                 from ../../../lib/mbuiter.c:3:
../../../lib/mbchar.h:269:194: warning: '__inline_memcpy_chk' is static but 
used in inline function 'mb_copy' which is not static [enabled by default]
       memcpy (&new_mbc->buf[0], &old_mbc->buf[0], old_mbc->bytes);
                                                                                
                                                                                
                                  ^
In file included from ../../../lib/mbuiter.h:106:0,
                 from ../../../lib/mbuiter.c:3:
../../../lib/mbchar.h:249:24: warning: 'iswcntrl' is static but used in inline 
function 'mb_width_aux' which is not static [enabled by default]
   return (w >= 0 ? w : iswcntrl (wc) ? 0 : MB_UNPRINTABLE_WIDTH);
                        ^
  CC       pipe2.o
  CC       pipe2-safer.o
  CC       printf-frexp.o
  CC       printf-frexpl.o
  CC       progname.o
  CC       quotearg.o
  CC       sig-handler.o
  CC       spawn-pipe.o
  CC       stdio.o
  CC       strnlen1.o
  CC       threadlib.o
  CC       unistd.o
  CC       dup-safer.o
  CC       fd-safer.o
  CC       pipe-safer.o
  CC       width.o
  CC       wait-process.o
  CC       wctype-h.o
  CC       xmalloc.o
  CC       xalloc-die.o
  CC       xsize.o
  CC       xstrndup.o
  CC       get-errno.o
  CC       abitset.o
  CC       bitset.o
  CC       bitset_stats.o
  CC       bitsetv.o
  CC       ebitset.o
  CC       lbitset.o
  CC       vbitset.o
  CC       bitsetv-print.o
  CC       timevar.o
  CC       asnprintf.o
  CC       error.o
  CC       fpending.o
  CC       fprintf.o
  CC       fseterr.o
  CC       getopt.o
../../../lib/getopt.c: In function '_getopt_internal_r':
../../../lib/getopt.c:778:27: warning: cast discards '__attribute__((const))' 
qualifier from pointer target type [-Wcast-qual]
           d->__nextchar = (char *) "";
                           ^
../../../lib/getopt.c: In function 'rpl_getopt':
../../../lib/getopt.c:1159:37: warning: cast discards '__attribute__((const))' 
qualifier from pointer target type [-Wcast-qual]
   return _getopt_internal (argc, (char **) argv, optstring,
                                     ^
  CC       getopt1.o
  CC       isnand.o
  CC       isnanf.o
  CC       isnanl.o
  CC       obstack.o
  CC       obstack_printf.o
  CC       open.o
  CC       perror.o
  CC       printf.o
  CC       printf-args.o
  CC       printf-parse.o
  CC       rawmemchr.o
../../../lib/rawmemchr.c: In function 'rawmemchr':
../../../lib/rawmemchr.c:47:14: warning: cast discards '__attribute__((const))' 
qualifier from pointer target type [-Wcast-qual]
       return (void *) char_ptr;
              ^
../../../lib/rawmemchr.c:132:14: warning: cast discards 
'__attribute__((const))' qualifier from pointer target type [-Wcast-qual]
   char_ptr = (unsigned char *) longword_ptr;
              ^
../../../lib/rawmemchr.c:135:10: warning: cast discards 
'__attribute__((const))' qualifier from pointer target type [-Wcast-qual]
   return (void *) char_ptr;
          ^
  CC       snprintf.o
  CC       sprintf.o
  CC       stat.o
  CC       strchrnul.o
../../../lib/strchrnul.c: In function 'strchrnul':
../../../lib/strchrnul.c:49:14: warning: cast discards '__attribute__((const))' 
qualifier from pointer target type [-Wcast-qual]
       return (char *) char_ptr;
              ^
../../../lib/strchrnul.c:138:14: warning: cast discards 
'__attribute__((const))' qualifier from pointer target type [-Wcast-qual]
   char_ptr = (unsigned char *) longword_ptr;
              ^
../../../lib/strchrnul.c:141:10: warning: cast discards 
'__attribute__((const))' qualifier from pointer target type [-Wcast-qual]
   return (char *) char_ptr;
          ^
  CC       strerror.o
../../../lib/strerror.c: In function 'rpl_strerror':
../../../lib/strerror.c:46:12: warning: cast discards '__attribute__((const))' 
qualifier from pointer target type [-Wcast-qual]
     return (char *) msg;
            ^
  CC       strerror-override.o
  CC       strerror_r.o
  CC       strverscmp.o
  CC       vasnprintf.o
  CC       vfprintf.o
  CC       vsnprintf.o
  CC       vsprintf.o
  CC       wcwidth.o
  CC       xmemdup0.o
  AR       libbison.a




reply via email to

[Prev in Thread] Current Thread [Next in Thread]