Skip to content

Commit ce1f9f6

Browse files
committed
Remove command line definition of EMSCRIPTEN
In #26381, the definition of this macro was moved into the `emscripten.h` header file, along with a warning if its used. This change removes this macro from the clang command line generated by emcc, reducing the differences between using `emcc` and using `clang -target=wasm32-emscripten` directly.
1 parent 97e3809 commit ce1f9f6

7 files changed

Lines changed: 2 additions & 31 deletions

File tree

ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ See docs/process.md for more on how version tagging works.
2020

2121
5.0.3 (in development)
2222
----------------------
23+
- The deprecated `EMSCRIPTEN` macro is now defined in emscripten.h rather than
24+
on the command line. (#26417)
2325
- Warn on usage of the deprecated `EMSCRIPTEN` macro (`__EMSCRIPTEN__` should
2426
be used instead). (#26381)
2527
- The `-sRELOCATABLE` setting was effectively removed (moved to legacy

site/source/docs/tools_reference/settings_reference.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1701,8 +1701,6 @@ Set the environment variable EMCC_STRICT=1 or pass -sSTRICT to test that a
17011701
codebase builds nicely in forward compatible manner.
17021702
Changes enabled by this:
17031703

1704-
- The C define EMSCRIPTEN is not defined (__EMSCRIPTEN__ always is, and
1705-
is the correct thing to use).
17061704
- STRICT_JS is enabled.
17071705
- IGNORE_MISSING_MAIN is disabled.
17081706
- AUTO_JS_LIBRARIES is disabled.

src/settings.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,8 +1160,6 @@ var LINKABLE = false;
11601160
// codebase builds nicely in forward compatible manner.
11611161
// Changes enabled by this:
11621162
//
1163-
// - The C define EMSCRIPTEN is not defined (__EMSCRIPTEN__ always is, and
1164-
// is the correct thing to use).
11651163
// - STRICT_JS is enabled.
11661164
// - IGNORE_MISSING_MAIN is disabled.
11671165
// - AUTO_JS_LIBRARIES is disabled.

test/core/test_core_types.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,6 @@
7575
#error __BIG_ENDIAN__ is defined
7676
#endif
7777

78-
// We prefer to use __EMSCRIPTEN__, but for compatibility, we define
79-
// EMSCRIPTEN too.
80-
#if defined(IN_STRICT_MODE) && defined(EMSCRIPTEN)
81-
#error When compiling in -sSTRICT mode, EMSCRIPTEN should not be defined, but it was!
82-
#endif
83-
#if !defined(IN_STRICT_MODE) && !defined(EMSCRIPTEN)
84-
#error EMSCRIPTEN is not defined
85-
#endif
86-
8778
#include <stdalign.h>
8879
#include <stdint.h>
8980
#include <stddef.h>

test/test_core.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -677,8 +677,6 @@ def test_sha1(self):
677677
self.do_runf('third_party/sha1.c', 'SHA1=15dd99a1991e0b3826fede3deffc1feba42278e6')
678678

679679
def test_core_types(self):
680-
if self.get_setting('STRICT'):
681-
self.cflags += ['-DIN_STRICT_MODE=1']
682680
self.do_runf('core/test_core_types.c')
683681

684682
def test_cube2md5(self):

test/test_other.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11303,17 +11303,6 @@ def test_EMSCRIPTEN_macro(self):
1130311303
self.assert_fail([EMCC, '-Werror', 'src.c', '-c'], "'EMSCRIPTEN' has been marked as deprecated: use __EMSCRIPTEN__ instead")
1130411304
self.assert_fail([EMCC, '-sSTRICT', '-Werror', 'src.c', '-c'], "'EMSCRIPTEN' has been marked as deprecated: use __EMSCRIPTEN__ instead")
1130511305

11306-
def test_EMSCRIPTEN_and_STRICT(self):
11307-
# __EMSCRIPTEN__ is the proper define; we support EMSCRIPTEN for legacy
11308-
# code, unless STRICT is enabled.
11309-
create_file('src.c', '''
11310-
#ifndef EMSCRIPTEN
11311-
#error "not defined"
11312-
#endif
11313-
''')
11314-
self.run_process([EMCC, 'src.c', '-c'])
11315-
self.expect_fail([EMCC, 'src.c', '-sSTRICT', '-c'])
11316-
1131711306
def test_exception_settings(self):
1131811307
for catching, throwing, opts in itertools.product([0, 1], repeat=3):
1131911308
cmd = [EMXX, test_file('other/exceptions_modes_symbols_defined.cpp'), '-sDISABLE_EXCEPTION_THROWING=%d' % (1 - throwing), '-sDISABLE_EXCEPTION_CATCHING=%d' % (1 - catching), '-O%d' % opts]

tools/compile.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,6 @@ def get_cflags(user_args):
9696
if settings.WASM_WORKERS:
9797
cflags.append('-D__EMSCRIPTEN_WASM_WORKERS__=1')
9898

99-
if not settings.STRICT:
100-
# The preprocessor define EMSCRIPTEN is deprecated. Don't pass it to code
101-
# in strict mode. Code should use the define __EMSCRIPTEN__ instead.
102-
cflags.append('-DEMSCRIPTEN')
103-
10499
ports.add_cflags(cflags, settings)
105100

106101
def array_contains_any_of(hay, needles):

0 commit comments

Comments
 (0)