summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2022-03-09 21:05:03 +0000
committerDavid Blaikie <dblaikie@gmail.com>2022-03-09 21:12:56 +0000
commit85ee1d3ca1d06b6bd3477515b8d0c72c8df7c069 (patch)
tree439cd0d80e5bee0c385982422d2181c97de60bc3
parentf2a97536809588f1748d32d2e79c9a2a6b4ec335 (diff)
Revert "Disable -Wmissing-prototypes for internal linkage functions that aren't explicitly marked "static""
Regresses: typedef struct { static void f() { } } a_t; Causing this to error instead of warn, because the linkage is computed earlier/too early perhaps. I'll send out a review to see if there's some other path forward or if this is an acceptable regression, etc. This reverts commit 275c56226d7fbd6a4d554807374f78d323aa0c1c.
-rw-r--r--clang/lib/Sema/SemaDecl.cpp3
-rw-r--r--clang/test/SemaCXX/warn-missing-prototypes.cpp13
2 files changed, 0 insertions, 16 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index b88d9f2f847f..fa086ae0f612 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -14210,9 +14210,6 @@ ShouldWarnAboutMissingPrototype(const FunctionDecl *FD,
if (!FD->isGlobal())
return false;
- if (!FD->isExternallyVisible())
- return false;
-
// Don't warn about C++ member functions.
if (isa<CXXMethodDecl>(FD))
return false;
diff --git a/clang/test/SemaCXX/warn-missing-prototypes.cpp b/clang/test/SemaCXX/warn-missing-prototypes.cpp
index 2880514ee02b..e8637e5a90ea 100644
--- a/clang/test/SemaCXX/warn-missing-prototypes.cpp
+++ b/clang/test/SemaCXX/warn-missing-prototypes.cpp
@@ -44,16 +44,3 @@ void j() = delete;
extern void k() {} // expected-warning {{no previous prototype for function 'k'}}
// expected-note@-1{{declare 'static' if the function is not intended to be used outside of this translation unit}}
// CHECK-NOT: fix-it:"{{.*}}":{[[@LINE-2]]:{{.*}}-[[@LINE-2]]:{{.*}}}:"{{.*}}"
-
-namespace {
-struct anon { };
-}
-
-// No warning because this has internal linkage despite not being declared
-// explicitly 'static', owing to the internal linkage parameter.
-void l(anon) {
-}
-
-void *operator new(decltype(sizeof(3)) size, const anon &) throw() {
- return nullptr;
-}