diff --git a/emcc.py b/emcc.py index 4134a489bda3d..a54ca089b6537 100644 --- a/emcc.py +++ b/emcc.py @@ -427,7 +427,7 @@ def phase_setup(state): 'unused-command-line-argument', "linker setting ignored during compilation: '%s'" % key) for arg in state.orig_args: - if arg in LINK_ONLY_FLAGS: + if arg.split('=')[0] in LINK_ONLY_FLAGS: diagnostics.warning( 'unused-command-line-argument', "linker flag ignored during compilation: '%s'" % arg) diff --git a/test/common.py b/test/common.py index 0523d386a93b5..c608df49f0f61 100644 --- a/test/common.py +++ b/test/common.py @@ -899,7 +899,7 @@ def get_cflags(self, main_file=False, compile_only=False, asm_only=False): def is_ldflag(f): return f.startswith(('-l', '-sEXPORT_ES6', '-sGL_TESTING', '-sPROXY_TO_PTHREAD', '-sENVIRONMENT=', '--pre-js=', '--post-js=', '-sPTHREAD_POOL_SIZE=', - '--profiling-funcs')) + '--profiling-funcs', '--closure')) args = self.serialize_settings(compile_only or asm_only) + self.cflags if asm_only: diff --git a/test/test_core.py b/test/test_core.py index 4e55825335dee..e8d097716ad0d 100644 --- a/test/test_core.py +++ b/test/test_core.py @@ -6940,7 +6940,7 @@ def test_zlib(self, use_cmake): zlib = self.get_zlib_library(use_cmake) # example.c uses K&R style function declarations - self.cflags += ['-Wno-deprecated-non-prototype'] + self.cflags += ['-Wno-deprecated-non-prototype', '-Wno-unused-command-line-argument'] self.do_core_test('test_zlib.c', libraries=zlib, includes=[test_file('third_party/zlib')]) @needs_make('make') diff --git a/test/test_other.py b/test/test_other.py index 09df84c0ed5c5..a62c849e2b396 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -13106,6 +13106,10 @@ def test_link_only_flag_warning(self): err = self.run_process([EMCC, '--embed-file', 'file', '-c', test_file('hello_world.c')], stderr=PIPE).stderr self.assertContained("warning: linker flag ignored during compilation: '--embed-file' [-Wunused-command-line-argument]", err) + # Also test for the format that includes an =arg suffix + err = self.run_process([EMCC, '--embed-file=file', '-c', test_file('hello_world.c')], stderr=PIPE).stderr + self.assertContained("warning: linker flag ignored during compilation: '--embed-file=file' [-Wunused-command-line-argument]", err) + def test_no_deprecated(self): # Test that -Wno-deprecated is passed on to clang driver create_file('test.c', '''\