This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Marking of functions with attributes like __wur
> 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".
Agreed.
> > __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.
Then perhaps we can get another attribute added that is not so strict.
> 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.
I don't object. I would still like to see some effort made to canonicalize
our use of that (and any other similar things) across the board.
Thanks,
Roland