Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 57dd748

Browse filesBrowse files
committed
Rule 5.4: Address review comments
1 parent 892cb96 commit 57dd748
Copy full SHA for 57dd748

File tree

Expand file treeCollapse file tree

2 files changed

+5
-8
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+5
-8
lines changed

‎c/misra/src/rules/RULE-5-4/MacroIdentifiersNotDistinct.ql

Copy file name to clipboardExpand all lines: c/misra/src/rules/RULE-5-4/MacroIdentifiersNotDistinct.ql
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ where
9999
// when m2 is defined
100100
isIncludedUnconditionallyFromCommonFile(m, m2) and
101101
// Macros can't be mutually exclusive
102-
not mutuallyExclusiveMacros(m, m2) and
103-
not mutuallyExclusiveMacros(m2, m) and
102+
not mutuallyExclusiveBranchDirectiveMacros(m, m2) and
103+
not mutuallyExclusiveBranchDirectiveMacros(m2, m) and
104104
// If at least one invocation exists for at least one of the macros, then they must share a link
105105
// target - i.e. must both be expanded in the same context
106106
(

‎cpp/common/src/codingstandards/cpp/PreprocessorDirective.qll

Copy file name to clipboardExpand all lines: cpp/common/src/codingstandards/cpp/PreprocessorDirective.qll
+3-6Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,9 @@ predicate isMacroDefinedWithinBranch(PreprocessorBranchDirective bd, Macro m) {
9898
* Holds if the pair of macros are "conditional" i.e. only one of the macros is followed in any
9999
* particular compilation of the containing file.
100100
*/
101-
predicate mutuallyExclusiveMacros(Macro firstMacro, Macro secondMacro) {
102-
exists(
103-
PreprocessorBranchDirective b1, PreprocessorBranchDirective b2, string filepath,
104-
int b1StartLocation, int b2StartLocation
105-
|
106-
isBranchDirectivePair(b1, b2, filepath, b1StartLocation, b2StartLocation) and
101+
predicate mutuallyExclusiveBranchDirectiveMacros(Macro firstMacro, Macro secondMacro) {
102+
exists(PreprocessorBranchDirective b1, PreprocessorBranchDirective b2 |
103+
isBranchDirectivePair(b1, b2, _, _, _) and
107104
isMacroDefinedWithinBranch(b1, firstMacro) and
108105
isMacroDefinedWithinBranch(b2, secondMacro)
109106
)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.