Skip to content

Commit eed9674

Browse files
committed
build: harmonize Clang checks
- Set the clang variable in `config.gypi` so it depends on compiler checks made by the configure script. - Replace gyp conditions with `llvm_version` and "0.0" with conditions that use the `clang` variable. - Always use `clang==1` or `clang==0` in gyp conditions PR-URL: #52873 Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
1 parent 2f59529 commit eed9674

File tree

7 files changed

+13
-13
lines changed

7 files changed

+13
-13
lines changed

common.gypi

+3-4
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@
107107
'v8_base': '<(PRODUCT_DIR)/obj.target/tools/v8_gypfiles/libv8_snapshot.a',
108108
}],
109109
['OS=="mac"', {
110-
'clang%': 1,
111110
'obj_dir%': '<(PRODUCT_DIR)/obj.target',
112111
'v8_base': '<(PRODUCT_DIR)/libv8_snapshot.a',
113112
}],
@@ -182,10 +181,10 @@
182181
}, {
183182
'MSVC_runtimeType': 2 # MultiThreadedDLL (/MD)
184183
}],
185-
['llvm_version=="0.0"', {
186-
'lto': ' -flto=4 -fuse-linker-plugin -ffat-lto-objects ', # GCC
187-
}, {
184+
['clang==1', {
188185
'lto': ' -flto ', # Clang
186+
}, {
187+
'lto': ' -flto=4 -fuse-linker-plugin -ffat-lto-objects ', # GCC
189188
}],
190189
],
191190
},

configure.py

+2
Original file line numberDiff line numberDiff line change
@@ -1042,6 +1042,7 @@ def get_gas_version(cc):
10421042
# quite prepared to go that far yet.
10431043
def check_compiler(o):
10441044
if sys.platform == 'win32':
1045+
o['variables']['clang'] = 0
10451046
o['variables']['llvm_version'] = '0.0'
10461047
if not options.openssl_no_asm and options.dest_cpu in ('x86', 'x64'):
10471048
nasm_version = get_nasm_version('nasm')
@@ -1051,6 +1052,7 @@ def check_compiler(o):
10511052
return
10521053

10531054
ok, is_clang, clang_version, gcc_version = try_check_compiler(CXX, 'c++')
1055+
o['variables']['clang'] = B(is_clang)
10541056
version_str = ".".join(map(str, clang_version if is_clang else gcc_version))
10551057
print_verbose(f"Detected {'clang ' if is_clang else ''}C++ compiler (CXX={CXX}) version: {version_str}")
10561058
if not ok:

deps/openssl/openssl_common.gypi

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
'TERMIOS',
6868
],
6969
'conditions': [
70-
[ 'llvm_version=="0.0"', {
70+
[ 'clang==0', {
7171
'cflags': ['-Wno-old-style-declaration',],
7272
}],
7373
],

deps/zlib/zlib.gyp

+3-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
'ZLIB_ROOT': '.',
88
'use_system_zlib%': 0,
99
'arm_fpu%': '',
10-
'llvm_version%': '0.0',
1110
},
1211
'conditions': [
1312
['use_system_zlib==0', {
@@ -24,7 +23,7 @@
2423
},{
2524
'defines': [ 'X86_NOT_WINDOWS' ],
2625
}],
27-
['OS!="win" or llvm_version!="0.0"', {
26+
['OS!="win" or clang==1', {
2827
'cflags': [ '-mssse3' ],
2928
'xcode_settings': {
3029
'OTHER_CFLAGS': [ '-mssse3' ],
@@ -65,7 +64,7 @@
6564
'conditions': [
6665
['OS!="ios"', {
6766
'conditions': [
68-
['OS!="win" and llvm_version=="0.0"', {
67+
['OS!="win" and clang==0', {
6968
'cflags': [ '-march=armv8-a+aes+crc' ],
7069
}],
7170
['OS=="android"', {
@@ -111,7 +110,7 @@
111110
# 'target_name': 'zlib_crc32_simd',
112111
# 'type': 'static_library',
113112
# 'conditions': [
114-
# ['OS!="win" or llvm_version!="0.0"', {
113+
# ['OS!="win" or clang==1', {
115114
# 'cflags': [
116115
# '-msse4.2',
117116
# '-mpclmul',

node.gyp

+1-1
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@
504504
'-Wl,-bnoerrmsg',
505505
],
506506
}],
507-
['OS == "linux" and llvm_version != "0.0"', {
507+
['OS=="linux" and clang==1', {
508508
'libraries': ['-latomic'],
509509
}],
510510
],

tools/v8_gypfiles/toolchain.gypi

+2-2
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@
134134
'<(V8_ROOT)/include',
135135
],
136136
'conditions': [
137-
['clang', {
137+
['clang==1', {
138138
'cflags': [ '-Werror', '-Wno-unknown-pragmas' ],
139139
},{
140140
'cflags!': [ '-Wall', '-Wextra' ],
@@ -144,7 +144,7 @@
144144
'-flax-vector-conversions',
145145
],
146146
}],
147-
['clang or OS!="win"', {
147+
['clang==1 or OS!="win"', {
148148
'cflags': [ '-Wno-invalid-offsetof' ],
149149
'xcode_settings': {
150150
'WARNING_CFLAGS': ['-Wno-invalid-offsetof']

tools/v8_gypfiles/v8.gyp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1879,7 +1879,7 @@
18791879
['enable_lto=="true"', {
18801880
'cflags_cc': [ '-fno-lto' ],
18811881
}],
1882-
['clang or OS!="win"', {
1882+
['clang==1 or OS!="win"', {
18831883
'conditions': [
18841884
['_toolset == "host" and host_arch == "x64" or _toolset == "target" and target_arch=="x64"', {
18851885
'sources': [

0 commit comments

Comments
 (0)