Skip to content

Commit

Permalink
Revert "Disable -Wmissing-prototypes for internal linkage functions t…
Browse files Browse the repository at this point in the history
…hat 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 275c562.
  • Loading branch information
dwblaikie committed Mar 9, 2022
1 parent f2a9753 commit 85ee1d3
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 16 deletions.
3 changes: 0 additions & 3 deletions clang/lib/Sema/SemaDecl.cpp
Expand Up @@ -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;
Expand Down
13 changes: 0 additions & 13 deletions clang/test/SemaCXX/warn-missing-prototypes.cpp
Expand Up @@ -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;
}

0 comments on commit 85ee1d3

Please sign in to comment.