Skip to content

Commit dfc000d

Browse files
authored
Fix argument unused warning when building compiler-rt. NFC (#20206)
Also ensure that warning are errors even when building asm files.
1 parent 4d27fc8 commit dfc000d

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

tools/ports/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def build_port(src_dir, output_path, port_name, includes=[], flags=[], cxxflags=
144144
if ext in ('.c', '.cpp') and not any((excluded in f) for excluded in exclude_files):
145145
srcs.append(os.path.join(root, f))
146146

147-
cflags = system_libs.get_base_cflags() + ['-Werror', '-O2', '-I' + src_dir] + flags
147+
cflags = system_libs.get_base_cflags() + ['-O2', '-I' + src_dir] + flags
148148
for include in includes:
149149
cflags.append('-I' + include)
150150

tools/system_libs.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,16 @@ def glob_in_path(path, glob_pattern, excludes=()):
4949
return sorted(f for f in files if os.path.basename(f) not in excludes)
5050

5151

52-
def get_base_cflags(force_object_files=False):
52+
def get_base_cflags(force_object_files=False, preprocess=True):
5353
# Always build system libraries with debug information. Non-debug builds
5454
# will ignore this at link time because we link with `-strip-debug`.
55-
flags = ['-g', '-sSTRICT']
55+
flags = ['-g', '-sSTRICT', '-Werror']
5656
if settings.LTO and not force_object_files:
5757
flags += ['-flto=' + settings.LTO]
5858
if settings.RELOCATABLE:
59-
flags += ['-sRELOCATABLE', '-DEMSCRIPTEN_DYNAMIC_LINKING']
59+
flags += ['-sRELOCATABLE']
60+
if preprocess:
61+
flags += ['-DEMSCRIPTEN_DYNAMIC_LINKING']
6062
if settings.MEMORY64:
6163
flags += ['-Wno-experimental', '-sMEMORY64=' + str(settings.MEMORY64)]
6264
return flags
@@ -339,7 +341,7 @@ def get_default_variation(cls, **kwargs):
339341
# extra code size. The -fno-unroll-loops flags was added here when loop
340342
# unrolling landed upstream in LLVM to avoid changing behavior but was not
341343
# specifically evaluated.
342-
cflags = ['-O2', '-Wall', '-Werror', '-fno-unroll-loops']
344+
cflags = ['-O2', '-Wall', '-fno-unroll-loops']
343345

344346
# A list of directories to put in the include path when building.
345347
# This is a list of tuples of path components.
@@ -460,7 +462,7 @@ def generate_ninja(self, build_dir, libname):
460462
source_dir = utils.path_from_root()
461463
cflags += [f'-ffile-prefix-map={source_dir}=/emsdk/emscripten',
462464
'-fdebug-compilation-dir=/emsdk/emscripten']
463-
asflags = get_base_cflags()
465+
asflags = get_base_cflags(preprocess=False)
464466
input_files = self.get_files()
465467
ninja_file = os.path.join(build_dir, 'build.ninja')
466468
create_ninja_file(input_files, ninja_file, libname, cflags, asflags=asflags, customize_build_flags=self.customize_build_cmd)
@@ -503,7 +505,7 @@ def build_objects(self, build_dir):
503505
# .s files are processed directly by the assembler. In this case we can't pass
504506
# pre-processor flags such as `-I` and `-D` but we still want core flags such as
505507
# `-sMEMORY64`.
506-
cmd += get_base_cflags()
508+
cmd += get_base_cflags(preprocess=False)
507509
else:
508510
cmd += cflags
509511
if ext in ('.s', '.S'):

0 commit comments

Comments
 (0)