[libc-commits] [libc] [libc] Propagate printf config options from a single config header library. (PR #66979)

Siva Chandra via libc-commits libc-commits at lists.llvm.org
Thu Sep 21 11:51:13 PDT 2023


================
@@ -188,27 +188,14 @@ list(APPEND printf_deps
       libc.src.stdio.printf_core.vfprintf_internal
 )
 
-if(LIBC_CONF_PRINTF_DISABLE_FLOAT)
-  list(APPEND printf_copts "-DLIBC_COPT_PRINTF_DISABLE_FLOAT")
-endif()
-if(LIBC_CONF_PRINTF_DISABLE_INDEX_MODE)
-  list(APPEND printf_copts "-DLIBC_COPT_PRINTF_DISABLE_INDEX_MODE")
-endif()
-if(LIBC_CONF_PRINTF_DISABLE_WRITE_INT)
-  list(APPEND printf_copts "-DLIBC_COPT_PRINTF_DISABLE_WRITE_INT")
-endif()
-if(LIBC_CONF_PRINTF_FLOAT_TO_STR_USE_MEGA_LONG_DOUBLE_TABLE)
-  list(APPEND printf_copts "-DLIBC_COPT_FLOAT_TO_STR_USE_MEGA_LONG_DOUBLE_TABLE")
-endif()
-
 if(LLVM_LIBC_FULL_BUILD)
   list(APPEND printf_deps
       libc.src.__support.File.file
       libc.src.__support.File.platform_file
       libc.src.__support.File.platform_stdout
   )
 else()
-  list(APPEND printf_copts "-DLIBC_COPT_PRINTF_USE_SYSTEM_FILE")
+  list(APPEND use_system_file "COMPILE_OPTIONS" "-DLIBC_COPT_PRINTF_USE_SYSTEM_FILE")
----------------
sivachandra wrote:

Yes - when there are no `COMPILE_OPTIONS`, then CMake will not treat whatever follows `COMPILE_OPTIONS` as an intended compile option.

About the name, do you mean `LIBC_COPT_PRINTF_USE_SYSTEM_FILE`? If yes, then you can either change it when you add similar feature to `scanf`.  If you are talking about `use_system_file`, you can share it with `scanf` targets, or add a new one at that point.

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


More information about the libc-commits mailing list