[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: "localename" functions suggest pure/const attribute
From: |
Pádraig Brady |
Subject: |
Re: "localename" functions suggest pure/const attribute |
Date: |
Thu, 10 Jul 2014 18:58:07 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 |
On 07/10/2014 06:16 PM, Assaf Gordon wrote:
> 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
>>> `/home/gordon/projects/gnulib/testdir30793/build/gllib'
>>> make all-recursive
>>> make[3]: Entering directory
>>> `/home/gordon/projects/gnulib/testdir30793/build/gllib'
>>> make[4]: Entering directory
>>> `/home/gordon/projects/gnulib/testdir30793/build/gllib'
>>> 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
>>> [-Werror=suggest-attribute=pure]
>>> 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="$nw -Wstrict-prototypes"
>> # It's not worth being this picky about test programs.
>> nw="$nw -Wsuggest-attribute=const"
>> nw="$nw -Wsuggest-attribute=pure"
>> gl_MANYWARN_COMPLEMENT([GNULIB_TEST_WARN_CFLAGS],
>> [$GNULIB_WARN_CFLAGS], [$nw])
>> AC_SUBST([GNULIB_TEST_WARN_CFLAGS])
>>
>> 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 -Wsuggest-attribute=pure".
>
> This hasn't been triggered before because coreutils hans't used "localename"
> module (but I needed it for the seq+letters patch).
>
> Thanks,
> - gordon
Oh I see now. That was more apparent from your initial patch:
http://lists.gnu.org/archive/html/bug-gnulib/2014-07/msg00038.html
(which I didn't get due to recent GNU mailing list issues).
I'll apply that.
thanks,
Pádraig.