Skip to content

Commit d95569b

Browse files
rename macro and set it for source/tests
1 parent ac64d06 commit d95569b

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

libc/cmake/modules/LLVMLibCCompileOptionRules.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ function(_get_common_compile_options output_var flags)
4343
list(APPEND compile_options "-fpie")
4444

4545
if(LLVM_LIBC_FULL_BUILD)
46+
list(APPEND compile_options "-DLIBC_FULL_BUILD")
4647
# Only add -ffreestanding flag in full build mode.
4748
list(APPEND compile_options "-ffreestanding")
4849
endif()
@@ -126,6 +127,7 @@ function(_get_common_test_compile_options output_var c_test flags)
126127
list(APPEND compile_options "-fpie")
127128

128129
if(LLVM_LIBC_FULL_BUILD)
130+
list(APPEND compile_options "-DLIBC_FULL_BUILD")
129131
# Only add -ffreestanding flag in full build mode.
130132
list(APPEND compile_options "-ffreestanding")
131133
list(APPEND compile_options "-fno-exceptions")
@@ -178,5 +180,10 @@ function(_get_hermetic_test_compile_options output_var flags)
178180
-Wno-multi-gpu --cuda-path=${LIBC_CUDA_ROOT}
179181
-nogpulib -march=${LIBC_GPU_TARGET_ARCHITECTURE} -fno-use-cxa-atexit)
180182
endif()
183+
184+
if(LLVM_LIBC_FULL_BUILD)
185+
list(APPEND compile_options "-DLIBC_FULL_BUILD")
186+
endif()
187+
181188
set(${output_var} ${compile_options} PARENT_SCOPE)
182189
endfunction()

libc/include/llvm-libc-macros/math-macros.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
#define LLVM_LIBC_MACROS_MATH_MACROS_H
1111

1212
// TODO: Remove this. This is a temporary fix for a downstream problem.
13-
#ifdef LLVM_LIBC_FULLBUILD
13+
// This cannot be left permanently since it would require downstream users to
14+
// define this macro.
15+
#ifdef LIBC_FULL_BUILD
1416

1517
#include "limits-macros.h"
1618

@@ -82,10 +84,10 @@ template <typename T> inline constexpr bool isnan(T x) {
8284

8385
#endif
8486

85-
#else
87+
#else // LIBC_FULL_BUILD
8688

8789
#include <math.h>
8890

89-
#endif // LLVM_LIBC_FULLBUILD
91+
#endif // LIBC_FULL_BUILD
9092

9193
#endif // LLVM_LIBC_MACROS_MATH_MACROS_H

0 commit comments

Comments
 (0)