[cfe-dev] removing -Wused-but-marked-unused

Richard Smith via cfe-dev cfe-dev at lists.llvm.org
Mon May 11 15:21:51 PDT 2020


When -Wused-but-marked-unused was added 10 (!) years ago, John pointed out
<http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20101018/035732.html>
that this breaks idiomatic usage of __attribute__((unused)). It did then,
and it still does today; searching for mentions
<https://github.com/inviwo/inviwo/blob/master/ext/warn/include/warn/ignore/used-but-marked-unused>
of
<https://github.com/ruslo/leathers/blob/master/Source/leathers/used-but-marked-unused>
this <https://lists.gnu.org/archive/html/bug-gnulib/2019-08/msg00083.html>
flag
<https://chromium.googlesource.com/infra/goma/client/+/master/build/generate_known_warnings_list.go#371>
reveals
<https://gitlab.freedesktop.org/xrdesktop/gulkan/commit/2bdb5bab7c9a33a77eb3b7f7ac94772ef91ffcfa>
that
<https://opensource.apple.com/source/xnu/xnu-4570.41.2/makedefs/MakeInc.def.auto.html>
by and large the only time people mention it is to turn it off or complain
about it.

At the time it was added, John also implicitly asked
<http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20101018/035742.html>
why anyone would ever want this warning, and that question went unanswered
at the time. So I'm going to ask it again: does anyone want this warning
(even though it breaks the documented intent
<https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-unused-function-attribute>
(note:
"*possibly* unused") of __attribute__((unused)) for -Werror builds) -- and
if so, why?

If we can't establish a rationale for this warning existing, I suggest we
remove it.

Thoughts?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20200511/7498702a/attachment.html>


More information about the cfe-dev mailing list