Skip to content

Commit 9754305

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 2cfc657 commit 9754305

8 files changed

Lines changed: 5 additions & 35 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

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_browser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3191,7 +3191,7 @@ def test_sdl3_canvas_write(self):
31913191
def test_cocos2d_hello(self):
31923192
# cocos2d build contains a bunch of warnings about tiff symbols being missing at link time:
31933193
# e.g. warning: undefined symbol: TIFFClientOpen
3194-
cocos2d_root = os.path.join(ports.Ports.get_dir(), 'cocos2d', 'Cocos2d-version_3_3')
3194+
cocos2d_root = os.path.join(ports.Ports.get_dir(), 'cocos2d', 'Cocos2d-version_3_3r1')
31953195
preload_file = os.path.join(cocos2d_root, 'samples', 'Cpp', 'HelloCpp', 'Resources') + '@'
31963196
self.reftest('cocos2d_hello.cpp', reference_slack=1,
31973197
cflags=['-sUSE_COCOS2D=3', '-sERROR_ON_UNDEFINED_SYMBOLS=0',

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):

tools/ports/cocos2d.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
from tools import diagnostics
1010

11-
TAG = 'version_3_3'
12-
HASH = 'd7b22660036c684f09754fcbbc7562984f02aa955eef2b76555270c63a717e6672c4fe695afb16280822e8b7c75d4b99ae21975a01a4ed51cad957f7783722cd'
11+
TAG = 'version_3_3r1'
12+
HASH = '28037e54bef4ff5363a2a185245afc4670d1664dbded1a13459fef3bcbcd18f61c3df1404415e89aa69cad383637b959a76c4efc7dce55ffaa42a5530b5c9034'
1313

1414
deps = ['libpng', 'zlib']
1515

@@ -37,9 +37,6 @@ def create(final):
3737
'-DCC_KEYBOARD_SUPPORT',
3838
'-DGL_ES=1',
3939
'-DNDEBUG', # '-DCOCOS2D_DEBUG=1' 1 - error/warn, 2 - verbose
40-
# Cocos2d source code hasn't switched to __EMSCRIPTEN__.
41-
# See https://github.com/emscripten-ports/Cocos2d/pull/3
42-
'-DEMSCRIPTEN',
4340
'-DCP_USE_DOUBLES=0',
4441
'-sUSE_ZLIB',
4542
'-sUSE_LIBPNG',

0 commit comments

Comments
 (0)