-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Clean up Closure warnings when targeting WASM2JS. #25117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean up Closure warnings when targeting WASM2JS. #25117
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps add a test confirming no warnings remain, somewhere?
Closure prints its warnings in all caps (I presume we'd have to run all tests to ensure they really don't warn? so that would be a test to run all tests..) |
Well, I just mean a single test, for basic coverage. E.g. like this existing test: @with_env_modify({'EMCC_LOGGING': '0'}) # this test assumes no emcc output
def test_no_warnings(self):
# build once before to make sure system libs etc. exist
self.run_process([EMXX, test_file('hello_libcxx.cpp')])
# check that there is nothing in stderr for a regular compile
err = self.run_process([EMXX, test_file('hello_libcxx.cpp')], stderr=PIPE).stderr
self.assertEqual(err, '') But maybe it's not worth it, lgtm either way. |
Hmm, I think probably better to work towards running the test suite with -Werror=closure altogether, so that all compilation with Closure would check against warnings. |
We already run with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there are a bunch of tests that have -Wno-closure
to avoid these issues.
Those should be removed as part of this PR, right?
# s(0) | 0; | ||
# ^^^^^^^^ | ||
# Turn off this check in Closure to allow clean Closure output. | ||
cmd += ['--jscomp_off=uselessCode'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does closure compile run on the generated wasm2js output code? I guess it must otherwise this would not be needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it does, I think this is because the WASM2JS output is so huge that it needs Closure to help make it half-reasonable.
Indeed, looks like these aren't needed anymore. Removed. |
This enables Closure spam free wasm2js test suite runs.
Even though the
checkTypes
annotation doesn't do anything in wasm2js.js file for WebAssembly, I'm still adding it there because otherwise in six months me or someone else would look at that Closure warning and have a first impression "oh, that's just missing a checkTypes suppress."Muting these warnings globally in Closure for WASM2JS runs isn't that bad, since any developer who is targeting WASM2JS will also very likely target regular Wasm runs, and there they will see any checkTypes/uselessCode related diagnostics, giving them the needed coverage.