emacs-devel
[Top][All Lists]
Advanced

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

Re: attribute warn_unused_result


From: Eli Zaretskii
Subject: Re: attribute warn_unused_result
Date: Sat, 05 Feb 2011 10:57:22 +0200

> From: Stefan Monnier <address@hidden>
> Cc: Paul Eggert <address@hidden>,  address@hidden
> Date: Fri, 04 Feb 2011 16:14:03 -0500
> 
> > 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.  They say
that if you don't want this warning, you should not declare functions
with this attribute.

> 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.

However, Tom pointed out that glibc only does that if the compiler is
invoked with -D_FORTIFY_SOURCE=2 or higher, so it's an optional
feature as far as glibc is concerned.  Ubuntu turns this option on,
because its specs for GCC include -D_FORTIFY_SOURCE=2, so it's
actually an issue with Ubuntu, not with glibc.

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



reply via email to

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