Skip to content

Commit 7dd42ec

Browse files
committed
clang: Exclude efi_main from -Wmissing-prototypes
When compiling UEFI applications, the main function is named efi_main() instead of main(). Let's exclude efi_main() from -Wmissing-prototypes as well to avoid warnings when working on UEFI applications. Differential Revision: https://reviews.llvm.org/D95746
1 parent 5ec75c6 commit 7dd42ec

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

clang/lib/Sema/SemaDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13873,7 +13873,7 @@ ShouldWarnAboutMissingPrototype(const FunctionDecl *FD,
1387313873
// Don't warn about 'main'.
1387413874
if (isa<TranslationUnitDecl>(FD->getDeclContext()->getRedeclContext()))
1387513875
if (IdentifierInfo *II = FD->getIdentifier())
13876-
if (II->isStr("main"))
13876+
if (II->isStr("main") || II->isStr("efi_main"))
1387713877
return false;
1387813878

1387913879
// Don't warn about inline functions.

clang/test/Sema/no-warn-missing-prototype.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@
44
int main() {
55
return 0;
66
}
7+
8+
int efi_main() {
9+
return 0;
10+
}

0 commit comments

Comments
 (0)