================
@@ -293,6 +255,19 @@ if (NOT(CLANG_DEFAULT_CXX_STDLIB STREQUAL "" OR
     "Default C++ stdlib to use (\"libstdc++\" or \"libc++\", empty for 
platform default" FORCE)
 endif()
 
+set(CLANG_DEFAULT_C_STDLIB "" CACHE STRING
+  "Default C stdlib to use (\"newlib\", \"newlib-nano\", \"picolibc\", 
\"llvm-libc\", or \"system\", empty for platform default)")
+if (NOT(CLANG_DEFAULT_C_STDLIB STREQUAL "" OR
+        CLANG_DEFAULT_C_STDLIB STREQUAL "newlib" OR
+        CLANG_DEFAULT_C_STDLIB STREQUAL "newlib-nano" OR
+        CLANG_DEFAULT_C_STDLIB STREQUAL "picolibc" OR
+        CLANG_DEFAULT_C_STDLIB STREQUAL "llvm-libc" OR
+        CLANG_DEFAULT_C_STDLIB STREQUAL "system"))
+  message(WARNING "Resetting default C stdlib to use platform default")
+  set(CLANG_DEFAULT_C_STDLIB "" CACHE STRING
+    "Default C stdlib to use (\"newlib\", \"newlib-nano\", \"picolibc\", 
\"llvm-libc\", or \"system\", empty for platform default)" FORCE)
+endif()
----------------
voltur01 wrote:

Thanks for the reference, I remember similar question was asked in the RFC 
itself too.

This is needed to cover one use case: when, e.g. picolibc, is the default its 
name is not present anywhere, so `--cstdlib=picolibc` cannot know that it is 
the default library and there is nothing to do.

One option is that the default library cannot be targeted with `--cstdlib` or 
another option is that there is no default library - one has to always set 
`--cstdlib` - both are not very ergonomic.

Let me think if there are other ways to solve this, any ideas would be 
appreciated.

https://github.com/llvm/llvm-project/pull/185870
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to