diff --git a/emcc.py b/emcc.py index f70633a1558b7..17482d3823d8e 100644 --- a/emcc.py +++ b/emcc.py @@ -424,7 +424,7 @@ def get_clang_flags(user_args): cflags = None -def get_cflags(user_args, is_cxx): +def get_cflags(user_args): global cflags if cflags: return cflags @@ -448,17 +448,6 @@ def get_cflags(user_args, is_cxx): # in strict mode. Code should use the define __EMSCRIPTEN__ instead. cflags.append('-DEMSCRIPTEN') - # Changes to default clang behavior - - # Implicit functions can cause horribly confusing function pointer type errors, see #2175 - # If your codebase really needs them - very unrecommended! - you can disable the error with - # -Wno-error=implicit-function-declaration - # or disable even a warning about it with - # -Wno-implicit-function-declaration - # This is already an error in C++ so we don't need to inject extra flags. - if not is_cxx: - cflags += ['-Werror=implicit-function-declaration'] - ports.add_cflags(cflags, settings) def array_contains_any_of(hay, needles): @@ -984,10 +973,9 @@ def get_language_mode(args): return '' language_mode = get_language_mode(newargs) - use_cxx = 'c++' in language_mode or shared.run_via_emxx def get_clang_command(): - return compiler + get_cflags(state.orig_args, use_cxx) + return compiler + get_cflags(state.orig_args) def get_clang_command_preprocessed(): return compiler + get_clang_flags(state.orig_args) diff --git a/test/other/test_implicit_func.c b/test/other/test_implicit_func.c deleted file mode 100644 index 338f90740bb7b..0000000000000 --- a/test/other/test_implicit_func.c +++ /dev/null @@ -1,7 +0,0 @@ -#include -int main() { - printf("hello %d\n", strnlen("waka", 2)); // Implicit declaration, no header, for strnlen - int (*my_strnlen)(char*, ...) = strnlen; - printf("hello %d\n", my_strnlen("shaka", 2)); - return 0; -} diff --git a/test/test_other.py b/test/test_other.py index 3f16ccdd389dc..8f16cef823248 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -5368,18 +5368,6 @@ def test_global_inits(self): self.assertContained('argc: 1\n16\n17\n10\n', self.run_js('a.out.js')) self.assertContainedIf('globalCtors', src, has_global) - def test_implicit_func(self): - # EMCC makes -Wimplicit-function-declaration an error by default in all modes. Upstream LLVM - # emits a warning in gnu89 mode, but otherwise emcc's behavior is identical to upstream. - IMPLICIT_C89 = "error: implicit declaration of function 'strnlen'" - # Also check for -Wincompatible-function-pointer-types (it became an error in LLVM 16) - INCOMPATIBLE = ': incompatible function pointer types' - - stderr = self.expect_fail( - [EMCC, path_from_root('test/other/test_implicit_func.c'), '-c', '-o', 'implicit_func.o', '-std=gnu89']) - self.assertContained(IMPLICIT_C89, stderr) - self.assertContained(INCOMPATIBLE, stderr) - @requires_native_clang @crossplatform def test_bad_triple(self):