From c762495c9122a33531fa81652ea39166a6865bc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jukka=20Jyl=C3=A4nki?= Date: Wed, 7 Aug 2013 17:49:17 +0300 Subject: [PATCH] Add -Wno-warn-absolute-paths cmdline option to allow hiding the absolute -I/-L path warning for codebases that understand they are crosscompiling and aren't referring to native system headers. --- emcc | 8 +++++++- tests/runner.py | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/emcc b/emcc index 8f71883db..6c6c8adb7 100755 --- a/emcc +++ b/emcc @@ -735,6 +735,12 @@ try: absolute_warning_shown = False + # Scan for warning suppression message in advance from other cmdline flags, so that it works even if -I or -L directives are present before this. + for i in range(len(newargs)): + if newargs[i] == '-Wno-warn-absolute-paths': + newargs[i] = '' + absolute_warning_shown = True + settings_changes = [] def validate_arg_level(level_string, max_level, err_msg): @@ -879,7 +885,7 @@ try: elif newargs[i].startswith(('-I', '-L')): path_name = newargs[i][2:] if not absolute_warning_shown and os.path.isabs(path_name): - logging.warning ('-I or -L of an absolute path "' + newargs[i] + '" encountered. If this is to a local system header/library, it may cause problems (local system files make sense for compiling natively on your system, but not necessarily to JavaScript)') # Of course an absolute path to a non-system-specific library or header is fine, and you can ignore this warning. The danger are system headers that are e.g. x86 specific and nonportable. The emscripten bundled headers are modified to be portable, local system ones are generally not + logging.warning ('-I or -L of an absolute path "' + newargs[i] + '" encountered. If this is to a local system header/library, it may cause problems (local system files make sense for compiling natively on your system, but not necessarily to JavaScript). Pass \'-Wno-warn-absolute-paths\' to emcc to hide this warning.') # Of course an absolute path to a non-system-specific library or header is fine, and you can ignore this warning. The danger are system headers that are e.g. x86 specific and nonportable. The emscripten bundled headers are modified to be portable, local system ones are generally not absolute_warning_shown = True newargs = [ arg for arg in newargs if arg is not '' ] diff --git a/tests/runner.py b/tests/runner.py index b866cc087..c19245528 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -11416,6 +11416,8 @@ int main(int argc, char const *argv[]) for args, expected in [(['-I/usr/something'], True), (['-L/usr/something'], True), + (['-I/usr/something', '-Wno-warn-absolute-paths'], False), + (['-L/usr/something', '-Wno-warn-absolute-paths'], False), (['-Isubdir/something'], False), (['-Lsubdir/something'], False), ([], False)]: