Replace MOZ_FALLTHROUGH macro with C++17's [[fallthrough]] attribute in htmlparser code generator
Categories
(Core :: DOM: HTML Parser, task, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox73 | --- | fixed |
People
(Reporter: cpeterson, Assigned: hsivonen)
References
Details
Attachments
(2 files, 3 obsolete files)
(deleted),
patch
|
cpeterson
:
feedback+
|
Details | Diff | Splinter Review |
(deleted),
text/x-phabricator-request
|
Details |
Bug 1570499 is replacing Mozilla's MOZ_FALLTHROUGH
macro with C++17's [[fallthrough]]
attribute. Some of these MOZ_FALLTHROUGH
uses are in generated htmlparser code. This bug updates the htmlparser's code generator to emit [[fallthrough]]
instead of MOZ_FALLTHROUGH
.
Unfortunately, the MOZ_FALLTHROUGH_ASSERT
macro (to assert on case fallthrough in debug builds) is still necessary after switching from MOZ_FALLTHROUGH
(i.e. [[clang::fallthrough]]
) to [[fallthrough]]
because:
MOZ_ASSERT(false)
followed by[[fallthrough]]
triggers a -Wunreachable-code warning in DEBUG builds- but
MOZ_ASSERT(false)
without[[fallthrough]]
triggers a -Wimplicit-fallthrough warning in NDEBUG builds.
Reporter | ||
Comment 1•5 years ago
|
||
Bug 1600545 removed useless #includes from many .cpp files, including some of htmlparser's generated .cpp files without updating the htmlparser code generator:
https://hg.mozilla.org/mozilla-central/rev/1f438b01c7801e7d750c4297330669621d3b7a4f
Bug 1446097 reformatted some headers and whitespace in htmlparser's generated code without updating the htmlparser code generator:
https://hg.mozilla.org/mozilla-central/rev/6af1f5ac596b4aa0a87f8a8151395c692eb81a58
Reporter | ||
Updated•5 years ago
|
Reporter | ||
Comment 2•5 years ago
|
||
Henri, I'm not sure how to submit changes for https://hg.mozilla.org/projects/htmlparser/ via Phabricator. Here is a patch file. If you'd like me to submit the change some other way, just let me know.
Mozilla bug 1603919 - Replace MOZ_FALLTHROUGH macro with C++17's [[fallthrough]] attribute in htmlparser code generator r?hsivonen
Bug 1570499 is replacing Mozilla's MOZ_FALLTHROUGH
macro with C++17's [[fallthrough]]
attribute. Some of these MOZ_FALLTHROUGH
uses are in generated htmlparser code. This changeset updates the htmlparser's code generator to emit [[fallthrough]]
instead of MOZ_FALLTHROUGH
.
Reporter | ||
Comment 3•5 years ago
|
||
Bug 1600545 removed useless #includes from many .cpp files, including some of htmlparser's generated .cpp files [1] without updating the htmlparser code generator. This changeset restores these #includes so mozilla-central's htmlparser code matches the output of make sync
.
Ideally, the htmlparser code generator would be updated to not emit these #includes. However, I don't know where these includes are coming from because I don't see the substring nsITimer.h
in the code generator's Java code.
[1] https://hg.mozilla.org/mozilla-central/rev/1f438b01c7801e7d750c4297330669621d3b7a4f
Reporter | ||
Comment 4•5 years ago
|
||
Bug 1446097 reformatted some headers and whitespace in htmlparser's generated code [1] without updating the htmlparser code generator. This changeset restores these #includes and whitespace so mozilla-central's htmlparser code matches the output of make named_characters
.
Ideally, the htmlparser code generator would be updated to emit those #includes and whitespace.
[1] https://hg.mozilla.org/mozilla-central/rev/6af1f5ac596b4aa0a87f8a8151395c692eb81a58
Depends on D57231
Assignee | ||
Comment 5•5 years ago
|
||
Assignee | ||
Comment 6•5 years ago
|
||
(Using feedback? for r?, since r? is unavailable.)
Assignee | ||
Comment 7•5 years ago
|
||
Assignee | ||
Comment 8•5 years ago
|
||
Let's deal with "part 2" in bug 1604456.
Reporter | ||
Updated•5 years ago
|
Reporter | ||
Comment 9•5 years ago
|
||
(In reply to Henri Sivonen (:hsivonen) from comment #5)
This probably won't work, because
[[fallthrough]] is a syntax error in Java 5. This needs the detector to special-case the symbol
MOZ_FALLTHROUGHto output
[[fallthrough]]`.
[[fallthrough]]
will be a syntax error for the Java parser even though it's still wrapped in a // CPPONLY: [[fallthrough]];
comment?
Reporter | ||
Comment 10•5 years ago
|
||
Assignee | ||
Comment 11•5 years ago
|
||
(In reply to Chris Peterson [:cpeterson] from comment #10)
Comment on attachment 9116363 [details] [diff] [review]
Translator patchReview of attachment 9116363 [details] [diff] [review]:
LGTM
::: translator-src/nu/validator/htmlparser/cpptranslate/CppTypes.java
@@ +81,4 @@reservedWords.add("unicode"); }
- private static final String[] TREE_BUILDER_INCLUDES = { "nsContentUtils", "nsAtom", "nsHtml5AtomTable",
I assume you verified that the generated htmlparser still compiles with
mozilla-central?
I did.
Comment 12•5 years ago
|
||
Assignee | ||
Comment 13•5 years ago
|
||
Assignee | ||
Updated•5 years ago
|
Comment 14•5 years ago
|
||
bugherder |
Updated•5 years ago
|
Description
•