Repository navigation
Conversation
Add the object-like macros from mfbt, xpcom/base/nscore.h and js/src/jstypes.h that expand to an attribute, a __declspec or a visibility specifier and were missing from the list, like MFBT_API, MOZ_RUNINIT, MOZ_KNOWN_LIVE, MOZ_UNANNOTATED and NS_NO_VTABLE. Without them, declarations using these macros produced ERROR nodes. Fixes #1267.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## mozcpp-format-macros #1270 +/- ##
========================================================
+ Coverage 90.46% 90.50% +0.03%
========================================================
Files 62 62
Lines 16462 16527 +65
========================================================
+ Hits 14892 14957 +65
Misses 1570 1570 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1267. Part of #1142.
Stacked on #1269 (both regenerate
tree-sitter-mozcpp/src/parser.cand bump tree-sitter-mozcpp to 0.20.7). Only the second commit belongs to this PR; I'll rebase onto master once #1269 lands.Adds 46 macros to
macro_annotationintree-sitter-mozcpp/grammar.jsand sorts the list. These are the object-like macros frommfbt/Attributes.h,mfbt/Types.h,mfbt/MemoryChecking.h,mfbt/ThreadSafety.h,xpcom/base/nscore.handjs/src/jstypes.hthat expand to an attribute,__declspecor visibility specifier and were missing; the full list is in #1267. Without them, declarations like these producedERRORnodes:Macros that no longer exist in mozilla-central (
MOZ_MUST_USE,MOZ_FALLTHROUGH, ...) are kept, so older code still parses. Making the names keywords doesn't break their use in#define,#ifdefor#if defined(...); I checked those withtree-sitter parse.Two positions still don't parse with any annotation macro, old or new, because the grammar only accepts annotations in storage-class position, after
class/struct, and right after a parameter list:constmethod qualifier:const T& get() const MOZ_LIFETIME_BOUND { ... }void f(const T& aX MOZ_LIFETIME_BOUND);They'd need changes to the grammar's structure rather than to the list, so I've left them for a follow-up.
Added
test_annotation_macrosandtest_annotation_macros_cpp. All workspace tests pass, including the DeepSpeech/pdf.js/serde snapshot tests, with no snapshot changes.