[libc-commits] [libc] [libc] Fix warning on 'extern "C" int main' in test suite (PR #102973)

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Mon Aug 12 15:48:48 PDT 2024


================
@@ -43,7 +43,15 @@ TestOptions parseOptions(int argc, char **argv) {
 
 } // anonymous namespace
 
-extern "C" int main(int argc, char **argv, char **envp) {
+// The C++ standard forbids declaring the main function with a linkage specifier
+// outisde of 'freestanding' mode, only define the linkage for hermetic tests.
+#ifdef __STDC_HOSTED__
----------------
jhuber6 wrote:

You're right, just noticed once I got undefined references in the GPU tests. Just checking the value is how the clang headers do it.

https://github.com/llvm/llvm-project/pull/102973


More information about the libc-commits mailing list