Skip to content

Commit dfb1815

Browse files
committed
Declarations1: add inline notes to RULE-5-1 and RULE-5-4 for standards considered
1 parent acc2563 commit dfb1815

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

c/misra/src/rules/RULE-5-1/ExternalIdentifiersNotDistinct.ql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ from ExternalIdentifiers d, ExternalIdentifiers d2
3333
where
3434
not isExcluded(d, Declarations1Package::externalIdentifiersNotDistinctQuery()) and
3535
notSame(d, d2) and
36+
//C99 states the first 31 characters of external identifiers are significant
37+
//C90 states the first 6 characters of external identifiers are significant and case is not required to be significant
38+
//C90 is not currently considered by this rule
3639
if d instanceof ExternalIdentifiersLong and d2 instanceof ExternalIdentifiersLong
3740
then d.getName().substring(0, 30) = d2.getName().substring(0, 30)
3841
else d.getName() = d2.getName()

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ where
2020
not isExcluded(m, Declarations1Package::macroIdentifiersNotDistinctQuery()) and
2121
not m = m2 and
2222
(
23+
//C99 states the first 63 characters of macro identifiers are significant
24+
//C90 states the first 31 characters of macro identifiers are significant and is not currently considered by this rule
25+
//ie an identifier differing on the 32nd character would be indistinct for C90 but distinct for C99
26+
//and is currently not reported by this rule
2327
if m.getName().length() >= 64
2428
then m.getName().substring(0, 62) = m2.getName().substring(0, 62)
2529
else m.getName() = m2.getName()

0 commit comments

Comments
 (0)