bug-bison
[Top][All Lists]
Advanced

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

Re: [PATCH 10/11] quote consistently and make tests pass with new quotin


From: Jim Meyering
Subject: Re: [PATCH 10/11] quote consistently and make tests pass with new quoting from gnulib
Date: Mon, 23 Jan 2012 16:17:11 +0100

Akim Demaille wrote:
...
>>> (And for my information, why is this function not-pure ?
>>
>> Because it may fail to return normally (abort).
>
> Yes, I see that, but there I found nothing against this in GCC's
> documentation, and given the kind of optimization involved, I don't
> see what can actually go wrong.
>
> http://gcc.gnu.org/onlinedocs/gcc-4.6.2/gcc/Function-Attributes.html
>> pure
>> Many functions have no effects except the return value and their
>> return value depends only on the parameters and/or global
>> variables. Such a function can be subject to common subexpression
>> elimination and loop optimization just as an arithmetic operator
>> would be. These functions should be declared with the attribute
>> pure. For example,
>>           int square (int) __attribute__ ((pure));
>>
>>
>> says that the hypothetical function square is safe to call fewer
>> times than the program says.
>>
>> Some of common examples of pure functions are strlen or
>> memcmp. Interesting non-pure functions are functions with infinite
>> loops or those depending on volatile memory or other system
>> resource, that may change between two consecutive calls (such as
>> feof in a multithreading environment).
>>
>> The attribute pure is not implemented in GCC versions earlier than 2.96.
>
> (And I didn't find any bug report about the bad warning :)

Hi Akim,
Is this explanation enough?

  http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html

---------------------
-Wsuggest-attribute=[pure|const|noreturn]
    Warn for cases where adding an attribute may be beneficial. The attributes 
currently supported are listed below.

    -Wsuggest-attribute=pure
    -Wsuggest-attribute=const
    -Wsuggest-attribute=noreturn
        Warn about functions which might be candidates for attributes
        pure, const or noreturn. The compiler only warns for functions
        visible in other compilation units or (in the case of pure and
        const) if it cannot prove that the function returns normally. A
        function returns normally if it doesn't contain an infinite
        loop nor returns abnormally by throwing, calling abort() or
        trapping. This analysis requires option -fipa-pure-const, which
        is enabled by default at -O and higher. Higher optimization
        levels improve the accuracy of the analysis.



reply via email to

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