Skip to content

Commit 150f6a5

Browse files
committed
[libc] Use ${libc_opt_high_flag} instead of -O3
This is preferable since `${libc_opt_high_flag}` will be set correctly for the compiler used.
1 parent 4446a98 commit 150f6a5

File tree

7 files changed

+19
-19
lines changed

7 files changed

+19
-19
lines changed

libc/src/math/generic/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ add_entrypoint_object(
534534
libc.src.__support.macros.optimization
535535
libc.src.__support.macros.properties.types
536536
COMPILE_OPTIONS
537-
-O3
537+
${libc_opt_high_flag}
538538
)
539539

540540
add_entrypoint_object(

libc/test/src/__support/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ add_libc_test(
234234
libc.src.stdlib.srand
235235
libc.src.string.memset
236236
COMPILE_OPTIONS
237-
-O3
237+
${libc_opt_high_flag}
238238
UNIT_TEST_ONLY
239239
# Aligned Allocation is not supported in hermetic builds.
240240
)

libc/test/src/math/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1597,7 +1597,7 @@ add_fp_unittest(
15971597
libc.src.math.sqrtf
15981598
libc.src.__support.FPUtil.generic.sqrt
15991599
COMPILE_OPTIONS
1600-
-O3
1600+
${libc_opt_high_flag}
16011601
)
16021602

16031603
add_fp_unittest(
@@ -1613,7 +1613,7 @@ add_fp_unittest(
16131613
libc.src.math.sqrt
16141614
libc.src.__support.FPUtil.generic.sqrt
16151615
COMPILE_OPTIONS
1616-
-O3
1616+
${libc_opt_high_flag}
16171617
)
16181618

16191619
add_fp_unittest(
@@ -1629,7 +1629,7 @@ add_fp_unittest(
16291629
libc.src.math.sqrtl
16301630
libc.src.__support.FPUtil.generic.sqrt
16311631
COMPILE_OPTIONS
1632-
-O3
1632+
${libc_opt_high_flag}
16331633
)
16341634

16351635
add_fp_unittest(

libc/test/src/math/exhaustive/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ add_fp_unittest(
305305
SRCS
306306
hypotf_test.cpp
307307
COMPILE_OPTIONS
308-
-O3
308+
${libc_opt_high_flag}
309309
DEPENDS
310310
.exhaustive_test
311311
libc.src.math.hypotf

libc/test/src/math/smoke/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2990,7 +2990,7 @@ add_fp_unittest(
29902990
DEPENDS
29912991
libc.src.__support.FPUtil.generic.sqrt
29922992
COMPILE_OPTIONS
2993-
-O3
2993+
${libc_opt_high_flag}
29942994
)
29952995

29962996
add_fp_unittest(
@@ -3004,7 +3004,7 @@ add_fp_unittest(
30043004
DEPENDS
30053005
libc.src.__support.FPUtil.generic.sqrt
30063006
COMPILE_OPTIONS
3007-
-O3
3007+
${libc_opt_high_flag}
30083008
)
30093009

30103010
add_fp_unittest(
@@ -3018,7 +3018,7 @@ add_fp_unittest(
30183018
DEPENDS
30193019
libc.src.__support.FPUtil.generic.sqrt
30203020
COMPILE_OPTIONS
3021-
-O3
3021+
${libc_opt_high_flag}
30223022
)
30233023

30243024
add_fp_unittest(
@@ -3035,7 +3035,7 @@ add_fp_unittest(
30353035
libc.src.math.sqrtf128
30363036
libc.src.__support.FPUtil.generic.sqrt
30373037
COMPILE_OPTIONS
3038-
-O3
3038+
${libc_opt_high_flag}
30393039
)
30403040

30413041
add_fp_unittest(

libc/test/src/stdfix/CMakeLists.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ foreach(suffix IN ITEMS hr r lr hk k lk)
1414
SRCS
1515
abs${suffix}_test.cpp
1616
COMPILE_OPTIONS
17-
-O3
17+
${libc_opt_high_flag}
1818
DEPENDS
1919
libc.src.stdfix.abs${suffix}
2020
libc.src.__support.fixed_point.fx_bits
@@ -31,7 +31,7 @@ foreach(suffix IN ITEMS uhr ur ulr uhk uk)
3131
SRCS
3232
sqrt${suffix}_test.cpp
3333
COMPILE_OPTIONS
34-
-O3
34+
${libc_opt_high_flag}
3535
DEPENDS
3636
libc.src.stdfix.sqrt${suffix}
3737
libc.src.__support.CPP.bit
@@ -52,7 +52,7 @@ foreach(suffix IN ITEMS hr r lr hk k lk uhr ur ulr uhk uk ulk)
5252
SRCS
5353
round${suffix}_test.cpp
5454
COMPILE_OPTIONS
55-
-O3
55+
${libc_opt_high_flag}
5656
DEPENDS
5757
libc.src.stdfix.round${suffix}
5858
libc.src.__support.fixed_point.fx_bits
@@ -67,7 +67,7 @@ foreach(suffix IN ITEMS hr r lr hk k lk uhr ur ulr uhk uk ulk)
6767
SRCS
6868
${suffix}bits_test.cpp
6969
COMPILE_OPTIONS
70-
-O3
70+
${libc_opt_high_flag}
7171
DEPENDS
7272
libc.src.stdfix.${suffix}bits
7373
libc.src.__support.CPP.bit
@@ -84,7 +84,7 @@ add_libc_test(
8484
SRCS
8585
uhksqrtus_test.cpp
8686
COMPILE_OPTIONS
87-
-O3
87+
${libc_opt_high_flag}
8888
DEPENDS
8989
libc.src.stdfix.uhksqrtus
9090
libc.src.__support.CPP.bit
@@ -103,7 +103,7 @@ add_libc_test(
103103
SRCS
104104
uksqrtui_test.cpp
105105
COMPILE_OPTIONS
106-
-O3
106+
${libc_opt_high_flag}
107107
DEPENDS
108108
libc.src.stdfix.uksqrtui
109109
libc.src.__support.CPP.bit
@@ -122,7 +122,7 @@ add_libc_test(
122122
SRCS
123123
exphk_test.cpp
124124
COMPILE_OPTIONS
125-
-O3
125+
${libc_opt_high_flag}
126126
DEPENDS
127127
libc.src.stdfix.exphk
128128
libc.src.math.exp
@@ -140,7 +140,7 @@ add_libc_test(
140140
SRCS
141141
expk_test.cpp
142142
COMPILE_OPTIONS
143-
-O3
143+
${libc_opt_high_flag}
144144
DEPENDS
145145
libc.src.stdfix.expk
146146
libc.src.math.exp

libc/utils/MPFRWrapper/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if(LIBC_TESTS_CAN_USE_MPFR)
77
_get_common_test_compile_options(compile_options "" "")
88
# mpfr/gmp headers do not work with -ffreestanding flag.
99
list(REMOVE_ITEM compile_options "-ffreestanding")
10-
target_compile_options(libcMPFRWrapper PRIVATE -O3 ${compile_options})
10+
target_compile_options(libcMPFRWrapper PRIVATE ${libc_opt_high_flag} ${compile_options})
1111
add_dependencies(
1212
libcMPFRWrapper
1313
libc.src.__support.CPP.array

0 commit comments

Comments
 (0)