Skip to content

Commit 7ec285e

Browse files
Exclude typedefs from analysis
1 parent ac19c12 commit 7ec285e

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

cpp/misra/src/rules/RULE-6-2-3/DuplicateTypeDefinitions.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import codingstandards.cpp.Linkage
2020

2121
class UserTypeDefinition extends TypeDeclarationEntry {
2222
UserTypeDefinition() {
23-
(isDefinition() or getDeclaration() instanceof TypedefType) and
23+
isDefinition() and
2424
not getDeclaration().(Class).isAnonymous() and
2525
not getDeclaration().(Union).isAnonymous() and
2626
not getDeclaration().(Enum).isAnonymous() and

cpp/misra/test/rules/RULE-6-2-3/test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ template <typename T> class TplRedeclared {}; // COMPLIANT
2727
enum DuplicateEnum {}; // NON_COMPLIANT
2828
enum class DuplicateEnumClass {}; // NON_COMPLIANT
2929
enum {} anonymousEnum1; // COMPLIANT
30-
typedef int16_t DuplicateTypedef; // NON_COMPLIANT
31-
using DuplicateUsing = int16_t; // NON_COMPLIANT
30+
typedef int16_t DuplicateTypedef; // COMPLIANT -- Redeclared typedefs are OK
31+
using DuplicateUsing = int16_t; // COMPLIANT -- Redeclared type aliases are OK
3232
union DuplicateUnion {}; // NON_COMPLIANT
3333
union {
3434
} anonymousUnion1; // COMPLIANT

0 commit comments

Comments
 (0)