[llvm-bugs] [Bug 39088] __attribute__((alias)) should prevent unused warnings

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Nov 3 14:28:57 PDT 2018


Nick Desaulniers <ndesaulniers at google.com> changed:

           What    |Removed                     |Added
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |---
                 CC|                            |richard-llvm at metafoo.co.uk

--- Comment #2 from Nick Desaulniers <ndesaulniers at google.com> ---
Reopening, there are simply too many drivers in the Linux kernel that trigger
this warning.

* make it so that attribute alias marks the referenced variable as used
(assuming the referenced one still gets cleaned up; we care about the alias,
not the original) or referenced.
* make it so that -Wunneeded-internal-declaration has a pedantic ExtWarn
version for this case? (eh, this doesn't sound as good on paper)
* ???

When in a local function, we could do something like `(void) foo;` to silence
these unused var warnings.  Can't do that trick for globally defined variables,
but maybe there's something similar we can do.

The alias is created in a macro that's used pervasively, so adding something to
the macro is more feasible than adding __attribute__((unused)) to every macro
expansion site in the kernel.

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181103/1e8ed7d4/attachment.html>

More information about the llvm-bugs mailing list