blob: 0441a6fb4ca710029715d0edd0b3dec0c47866b9 [file] [log] [blame]
commit 85ee1d3ca1d06b6bd3477515b8d0c72c8df7c069
Author: David Blaikie <dblaikie@gmail.com>
Date: Wed Mar 9 21:05:03 2022 +0000
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.
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;
-}