[libc-commits] [libc] [libc] Add compile tests for each public header (PR #122527)

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Fri Jan 10 13:53:39 PST 2025


================
@@ -0,0 +1,14 @@
+/*===-- Test for <@HEADER_NAME@> ----------------------------------------===
+ *
+ * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+ * See https://llvm.org/LICENSE.txt for license information.
+ * SPDSList-License-Identifier: Apache-2.0 WITH LLVM-exception
+ */
+
+#include <@HEADER_NAME@>
+
+#ifdef __cplusplus
+extern "C" int main() { return 0; }
+#else
+int main(void) { return 0; }
+#endif
----------------
nickdesaulniers wrote:

Do we need two copies of `main` like this?  Seeing the `extern "C"` on `main` is curious.

```suggestion
int main (int argc, char** argv) { return 0; }
```
Should be valid in both language modes.

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


More information about the libc-commits mailing list