[Top][All Lists]

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

Re: "localename" functions suggest pure/const attribute

From: Assaf Gordon
Subject: Re: "localename" functions suggest pure/const attribute
Date: Thu, 10 Jul 2014 13:16:47 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

On 07/10/2014 12:20 PM, Pádraig Brady wrote:
On 07/10/2014 01:39 AM, Assaf Gordon wrote:

make  all-recursive
make[1]: Entering directory `/home/gordon/projects/gnulib/testdir30793/build'
Making all in gllib
make[2]: Entering directory 
make  all-recursive
make[3]: Entering directory 
make[4]: Entering directory 
depbase=`echo localename.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
     gcc -Wall -DHAVE_CONFIG_H -I. -I../../gllib -I..  -DGNULIB_STRICT_CHECKING=1   -O1 
-g -Werror -Wsuggest-attribute=const -Wsuggest-attribute=pure -MT localename.o -MD -MP 
-MF $depbase.Tpo -c -o localename.o ../../gllib/localename.c &&\
     mv -f $depbase.Tpo $depbase.Po
../../gllib/localename.c: In function ‘string_hash’:
../../gllib/localename.c:2519:1: error: function might be candidate for 
attribute ‘pure’ if it is known to return normally 
  string_hash (const void *x)
cc1: all warnings being treated as errors

Rather than worry about warnings like test for gnulib tests,
coreutils configure.ac ignores those using:

   # For gnulib-tests, the set is slightly smaller still.
   nw="$nw -Wstrict-prototypes"
   # It's not worth being this picky about test programs.
   nw="$nw -Wsuggest-attribute=const"
   nw="$nw -Wsuggest-attribute=pure"
                          [$GNULIB_WARN_CFLAGS], [$nw])

I wonder why it's reproducible by default with coreutils for you?
Note if modifying CFLAGS, it's usually better to specify AM_CFLAGS
rather than impacting on generated CFLAGS.

If I understand correctly, the coreutil section you've listed disables these 
warnings for Gnulib's *tests*.
But the warning is from a gnulib module (not its tests).
Under 'coreutils' gnulib modules are still compiled with "-Wsuggest-attribute=const 

This hasn't been triggered before because coreutils hans't used "localename" 
module (but I needed it for the seq+letters patch).

 - gordon

reply via email to

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