emacs-devel
[Top][All Lists]
Advanced

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

Re: attribute warn_unused_result


From: Stefan Monnier
Subject: Re: attribute warn_unused_result
Date: Sat, 05 Feb 2011 11:01:37 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

>> > impossible to tell the compiler not to emit this warning by the
>> > "usual" C technique of using a cast.
>> Looks like a bug in gcc.  I'd be surprised if they accept this
>> qualification, but really what's the point of emitting a warning when
>> the user explicitly put a cast to void?
> You can google about this: the GCC maintainers explicitly think this
> isn't a bug, but a feature.  They say that the warning was provided to
> uncover the cases where lazy programmers cast function calls to void
> to avoid diagnostics, without considering the implications.

That's brain dead: lazy programmers don't bother to add a `void'.

> They say that if you don't want this warning, you should not declare
> functions with this attribute.

That's also brain dead: declaring functions with this attribute is
adding good information, so it should be done wherever possible and
should not come with any negative consequences such as "when you really
don't care about the result, then please obfuscate your code, oh and
keep an eye on it, because a future gcc version may try and be even more
clever in uncovering code obfuscation, so you'll have to obfuscate it
even more to avoid the warning".

Anyway... Richard, could you try and get the gcc people to their senses?

>> I don't see how/why you'd consider it a misfeature of glibc.
> See above.  It's glibc headers that declare the functions with this
> attribute.

And it's a good thing they do.

> Personally, I think it's wrong to force _FORTIFY_SOURCE on all the
> users of a general-purpose system, but that's me.

I think the wrong part is to force users to obfuscate their code.


        Stefan



reply via email to

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