Revert "libc: Remove extern "C" from main declarations" (#102827)

Reverts llvm/llvm-project#102825
This commit is contained in:
Schrodinger ZHU Yifan 2024-08-11 13:40:50 -07:00 committed by GitHub
parent 1b71c471c7
commit b7c7dbd473
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 7 additions and 7 deletions

View File

@ -1,6 +1,6 @@
#include "LibcGpuBenchmark.h"
int main(int argc, char **argv, char **envp) {
extern "C" int main(int argc, char **argv, char **envp) {
LIBC_NAMESPACE::benchmarks::Benchmark::run_benchmarks();
return 0;
}

View File

@ -13,7 +13,7 @@
#include "src/stdlib/atexit.h"
#include "src/stdlib/exit.h"
int main(int argc, char **argv, char **envp);
extern "C" int main(int argc, char **argv, char **envp);
namespace LIBC_NAMESPACE_DECL {

View File

@ -13,7 +13,7 @@
#include "src/stdlib/atexit.h"
#include "src/stdlib/exit.h"
int main(int argc, char **argv, char **envp);
extern "C" int main(int argc, char **argv, char **envp);
namespace LIBC_NAMESPACE_DECL {

View File

@ -20,7 +20,7 @@
#include <sys/mman.h>
#include <sys/syscall.h>
int main(int argc, char **argv, char **envp);
extern "C" int main(int argc, char **argv, char **envp);
extern "C" {
// These arrays are present in the .init_array and .fini_array sections.

View File

@ -83,6 +83,6 @@
// tests, then we should not need to explicitly declare/define the main
// function in individual integration tests. We will not need this macro
// then.
#define TEST_MAIN int main
#define TEST_MAIN extern "C" int main
#endif // LLVM_LIBC_UTILS_INTEGRATION_TEST_TEST_H

View File

@ -43,7 +43,7 @@ TestOptions parseOptions(int argc, char **argv) {
} // anonymous namespace
int main(int argc, char **argv, char **envp) {
extern "C" int main(int argc, char **argv, char **envp) {
LIBC_NAMESPACE::testing::argc = argc;
LIBC_NAMESPACE::testing::argv = argv;
LIBC_NAMESPACE::testing::envp = envp;

View File

@ -47,7 +47,7 @@ bool TestGeneratorMain(llvm::raw_ostream &OS, llvm::RecordKeeper &records) {
OS << '\n';
OS << "int main() {\n";
OS << "extern \"C\" int main() {\n";
for (const auto &entrypoint : EntrypointNamesOption) {
if (entrypoint == "errno")
continue;