[libc-commits] [libc] [libc][NFC] Add compile options only to the header libraries which use them. (PR #67447)

Siva Chandra via libc-commits libc-commits at lists.llvm.org
Tue Sep 26 08:47:57 PDT 2023


https://github.com/sivachandra created https://github.com/llvm/llvm-project/pull/67447

Other libraries dependent on these libraries will automatically inherit
those compile options. This change in particular affects the compile
option "-DLIBC_COPT_STDIO_USE_SYSTEM_FILE".


>From fc9dab4281e7052ccb314d0ba7ea944d70bb5f71 Mon Sep 17 00:00:00 2001
From: Siva Chandra Reddy <sivachandra at google.com>
Date: Tue, 26 Sep 2023 15:44:03 +0000
Subject: [PATCH] [libc][NFC] Add compile options only to the header libraries
 which use them.

Other libraries dependent on these libraries will automatically inherit
those compile options. This change in particular affects the compile
option "-DLIBC_COPT_STDIO_USE_SYSTEM_FILE".
---
 libc/src/stdio/CMakeLists.txt             | 6 ------
 libc/src/stdio/printf_core/CMakeLists.txt | 1 +
 libc/src/stdio/scanf_core/CMakeLists.txt  | 1 +
 3 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/libc/src/stdio/CMakeLists.txt b/libc/src/stdio/CMakeLists.txt
index 0ec4c608ad8425f..169bc592dee4885 100644
--- a/libc/src/stdio/CMakeLists.txt
+++ b/libc/src/stdio/CMakeLists.txt
@@ -137,7 +137,6 @@ add_entrypoint_object(
     fscanf.h
   DEPENDS
     ${scanf_deps}
-  ${use_system_file}
 )
 
 add_entrypoint_object(
@@ -148,7 +147,6 @@ add_entrypoint_object(
     scanf.h
   DEPENDS
     ${scanf_deps}
-  ${use_system_file}
 )
 
 add_entrypoint_object(
@@ -194,7 +192,6 @@ add_entrypoint_object(
     printf.h
   DEPENDS
     ${printf_deps}
-  ${use_system_file}
 )
 
 add_entrypoint_object(
@@ -206,7 +203,6 @@ add_entrypoint_object(
   DEPENDS
     libc.src.__support.arg_list
     libc.src.stdio.printf_core.vfprintf_internal
-  ${use_system_file}
 )
 
 add_entrypoint_object(
@@ -239,7 +235,6 @@ add_entrypoint_object(
     vprintf.h
   DEPENDS
     ${printf_deps}
-  ${use_system_file}
 )
 
 add_entrypoint_object(
@@ -251,7 +246,6 @@ add_entrypoint_object(
   DEPENDS
     libc.src.__support.arg_list
     libc.src.stdio.printf_core.vfprintf_internal
-  ${use_system_file}
 )
 
 add_subdirectory(printf_core)
diff --git a/libc/src/stdio/printf_core/CMakeLists.txt b/libc/src/stdio/printf_core/CMakeLists.txt
index 1b6f763e084be9b..8da274395526df6 100644
--- a/libc/src/stdio/printf_core/CMakeLists.txt
+++ b/libc/src/stdio/printf_core/CMakeLists.txt
@@ -125,4 +125,5 @@ add_header_library(
     libc.src.__support.arg_list
     libc.src.stdio.printf_core.printf_main
     libc.src.stdio.printf_core.writer
+  ${use_system_file}
 )
diff --git a/libc/src/stdio/scanf_core/CMakeLists.txt b/libc/src/stdio/scanf_core/CMakeLists.txt
index 1fab27d3d28b5e0..060dc2d239eee67 100644
--- a/libc/src/stdio/scanf_core/CMakeLists.txt
+++ b/libc/src/stdio/scanf_core/CMakeLists.txt
@@ -90,4 +90,5 @@ add_header_library(
     libc.include.stdio
     libc.src.__support.File.file
     libc.src.__support.arg_list
+  ${use_system_file}
 )



More information about the libc-commits mailing list