[llvm-bugs] [Bug 43299] New: Missing -Wunused-variable warning for static variable in header
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Sep 12 13:29:22 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=43299
Bug ID: 43299
Summary: Missing -Wunused-variable warning for static variable
in header
Product: clang
Version: unspecified
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: efriedma at quicinc.com
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
neeilans at live.com, richard-llvm at metafoo.co.uk
Testcase:
foo.h:
static int x;
foo.c:
#include "foo.h"
gcc -Wall produces "warning: ‘x’ defined but not used [-Wunused-variable]".
clang -Wall produces no warning.
This is currently getting suppressed by Sema::ShouldWarnIfUnusedFileScopedDecl,
I think. I think the reasoning here is that we don't want to emit warnings for
static constants which are included from a header. Not sure if that reasoning
makes sense for non-const variables.
Apparently I was the last one who touched this, in r190382? I don't remember
that at all.
--
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/20190912/191ea47a/attachment.html>
More information about the llvm-bugs
mailing list