Skip to content

Commit

Permalink
Revert "libc: Remove extern "C" from main declarations" (llvm#102827)
Browse files Browse the repository at this point in the history
Reverts llvm#102825
  • Loading branch information
SchrodingerZhu authored and bwendling committed Aug 15, 2024
1 parent 1c170a8 commit f70c90d
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion libc/benchmarks/gpu/LibcGpuBenchmarkMain.cpp
Original file line number Diff line number Diff line change
@@ -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;
}
2 changes: 1 addition & 1 deletion libc/startup/gpu/amdgpu/start.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/startup/gpu/nvptx/start.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion libc/startup/linux/do_start.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion libc/test/IntegrationTest/test.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion libc/test/UnitTest/LibcTestMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion libc/utils/HdrGen/PrototypeTestGen/PrototypeTestGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f70c90d

Please sign in to comment.