aboutsummaryrefslogtreecommitdiff
path: root/emcc
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-02-03 18:51:29 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-02-03 18:51:29 -0800
commit42a910da1fab3bb5d793e5ca3d9ede9244781255 (patch)
treeee1e1a4d3a9ef57c13746b32641605e858daad3c /emcc
parent0e2d5b6ed1e97e3c8ab07b53d9e5534c10f294af (diff)
parentd779fe7e6ad05ef1a9ba70d3f160c4f87878d997 (diff)
Merge pull request #825 from juj/std
Std
Diffstat (limited to 'emcc')
-rwxr-xr-xemcc14
1 files changed, 13 insertions, 1 deletions
diff --git a/emcc b/emcc
index 40b3d206..ffce7363 100755
--- a/emcc
+++ b/emcc
@@ -603,6 +603,10 @@ try:
keep_debug = False
bind = False
jcache = False
+ if use_cxx:
+ default_cxx_std = '-std=c++03' # Enforce a consistent C++ standard when compiling .cpp files, if user does not specify one on the cmdline.
+ else:
+ default_cxx_std = '' # Compiling C code with .c files, don't enforce a default C++ std.
def check_bad_eq(arg):
assert '=' not in arg, 'Invalid parameter (do not use "=" with "--" options)'
@@ -666,7 +670,11 @@ try:
keep_debug = True
elif newargs[i] == '--bind':
bind = True
- newargs[i] = '-std=c++11' # Force C++11 for embind code
+ newargs[i] = ''
+ if default_cxx_std:
+ default_cxx_std = '-std=c++11' # Force C++11 for embind code, but only if user has not explicitly overridden a standard.
+ elif newargs[i].startswith('-std='):
+ default_cxx_std = '' # User specified a standard to use, clear Emscripten from specifying it.
elif newargs[i].startswith('--embed-file'):
check_bad_eq(newargs[i])
embed_files.append(newargs[i+1])
@@ -724,6 +732,10 @@ try:
absolute_warning_shown = True
newargs = [ arg for arg in newargs if arg is not '' ]
+ # If user did not specify a default -std for C++ code, specify the emscripten default.
+ if default_cxx_std:
+ newargs = newargs + [default_cxx_std]
+
if llvm_opts is None: llvm_opts = LLVM_OPT_LEVEL[opt_level]
if llvm_lto is None: llvm_lto = llvm_opts > 0
if closure is None: closure = 1 if opt_level >= 2 else 0