Re: __attribute__ error ("message")

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

 




On 31/03/2023 23:13, Xi Ruoyao wrote:
> On Fri, 2023-03-31 at 23:12 +0100, Jonny Grant wrote:
>>
>>
>> On 31/03/2023 22:58, Xi Ruoyao wrote:
>>> On Fri, 2023-03-31 at 22:54 +0100, Jonny Grant wrote:
>>>> If the error or warning attribute is used on a function
>>>> declaration
>>>> and a call to such a function is not eliminated through dead code
>>>> elimination or other optimizations, an error or warning
>>>> (respectively)
>>>> that includes message is diagnosed. 
>>>
>>> In this example the "call to such a function" is clearly "eliminated
>>> through" inlining (one of "other optimizations").
>>>
>>>> https://godbolt.org/z/n849GPTjj
>>>
>>
>> ok yes, now I understand. The compile_abort() got inlined as abort().
>>
>> compile_abort():
>>         pushq   %rax
>>         call    abort
>> main:
>>         pushq   %rax
>>         call    abort
>>
>>
>> So if I implement it, I must avoid it being optimized (using pragma
>> etc as below)
> 
> Or just __attribute__((noipa)).

That's much clearer.

It does feel a shame the optimizer inlines the function, discarding the error("message"), before the attribute error("message") can be triggered. But we can just put that __attribute__((noipa)) at least.

Jonny








[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux