This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Marking of functions with attributes like __wur


On 04/11/2012 02:30 PM, Roland McGrath wrote:
> "more likely to
> be unintended than intended" might be a reasonable predicate.

I'm afraid that standard would be too generous, as it would permit
too many false positives.  A better standard would be something like
"in practice, a warning is far more likely to be a helpful
diagnostic than a false alarm".

> __wur doesn't make it easy to suppress the warning explicitly with something like
> a (void) cast, which IMHO would be more reasonable behavior.

I agree 100%.  Alas, the GCC developers don't want to make it easy to
ignore __wur.  In Gnulib we have found a way to suppress its warnings
selectively, but our technique is ugly and I'm worried that if we
publicize it too much the GCC developers will change GCC to warn
even when our hack is used.

For strtol, there is little benefit to __wur: not only is
practical code unlikely to discard strtol's result unintentionally,
__wur does not catch the most common usage error which is to
fail to check errno.  And __wur has some cost, since some valid
uses do discard the result.  So on behalf of other programmers
I'd like to see __wur removed from strtol etc., even if I
currently have an ugly hack to work around the problem.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]