From 7859e29000080188d8b43f549f5ba8ce29836887 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Sun, 11 Dec 2011 11:39:00 -0800 Subject: [PATCH] --help in emcc --- emcc | 36 ++++++++++++++++++++++++++---------- tests/runner.py | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 58 insertions(+), 11 deletions(-) diff --git a/emcc b/emcc index 1494f2bbb..8ca593ed2 100755 --- a/emcc +++ b/emcc @@ -120,18 +120,34 @@ There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR P ''' exit(0) elif sys.argv[1] == '--help': - print '''OVERVIEW: Emscripten "gcc-compatible" driver script, using LLVM/Clang - Many but not all gcc options can be used. + this = os.path.basename('em++' if os.environ.get('EMMAKEN_CXX') else 'emcc') -USAGE: emcc [options] + print '''%s [options] file... -OPTIONS: - -O0 No optimization. Enables runtime assertions. This is the default. - -O1 Basic optimizations. Disables runtime assertions. - -O2 Like -O2, but includes loop recreation optimization (relooper). - -O3 Like -O3, but includes closure compiler advanced optimizations. - Use with care and read the closure compiler docs. -''' +Most normal gcc/g++ options will work, for example: + --help Display this information + --version Display compiler version information + +Options that are modified or new in %s include: + -O0 [..] default + -OX TODO + -s OPTION=VALUE JavaScript code generation option + passed into the emscripten compiler + --typed-arrays 0: no typed arrays + 1: parallel typed arrays + 2: shared typed arrays (default) + --llvm-opts 0: none (default) + 1: safe/portable + 2: unsafe/unportable + +The target file, if specified (-o ), defines what will +be generated: + .js JavaScript (default) + .o LLVM bitcode + .bc LLVM bitcode + .html HTML with embedded JavaScript + +''' % (this, this) exit(0) # If this is a configure-type thing, just do that diff --git a/tests/runner.py b/tests/runner.py index 34f76e705..0bd5b15a6 100644 --- a/tests/runner.py +++ b/tests/runner.py @@ -4869,6 +4869,8 @@ TT = %s class other(RunnerCore): def test_emcc(self): for compiler in [EMCC, EMXX]: + shortcompiler = os.path.basename(compiler) + # --version output = Popen([compiler, '--version'], stdout=PIPE, stderr=PIPE).communicate(input)[0] self.assertContained('''emcc (Emscripten GCC-like replacement) 2.0 @@ -4877,9 +4879,38 @@ This is free and open source software under the MIT license. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ''', output) + # --help + output = Popen([compiler, '--help'], stdout=PIPE, stderr=PIPE).communicate(input)[0] + self.assertContained('''%s [options] file... + +Most normal gcc/g++ options will work, for example: + --help Display this information + --version Display compiler version information + +Options that are modified or new in %s include: + -O0 [..] default + -OX TODO + -s OPTION=VALUE JavaScript code generation option + passed into the emscripten compiler + --typed-arrays 0: no typed arrays + 1: parallel typed arrays + 2: shared typed arrays (default) + --llvm-opts 0: none (default) + 1: safe/portable + 2: unsafe/unportable + +The target file, if specified (-o ), defines what will +be generated: + .js JavaScript (default) + .o LLVM bitcode + .bc LLVM bitcode + .html HTML with embedded JavaScript + +''' % (shortcompiler, shortcompiler), output) + # TODO: make sure all of these match gcc # TODO: when this is done, more test runner to test these (i.e., test all -Ox thoroughly) - # -- options: check these, warn about errors. valid gcc ones are help, version. Ours should be -- too, not -. + # -- options: check these, warn about errors. Ours should be -- too, not -. # emcc src.cpp or emcc src.cpp -o src.js ==> should give a .js file # emcc src.cpp -c and emcc src.cpp -o src.[o|bc] ==> should give a .bc file # emcc src.cpp -o src.html ==> should embed the js in an html file for immediate running on the web. only tricky part is sdl