Skip to content

Commit 9e56829

Browse files
Merge pull request #680 from github/michaelrfairhurst/fix-dcl51-clang-redefine-tzname-type
Fix #1869 Compiler Compatability for clang for CERT-C++ rule DCL51-CPP
2 parents dd63211 + a6f5240 commit 9e56829

7 files changed

+13
-11
lines changed
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
| test.cpp:20:6:20:8 | min | The function $@ reuses a reserved standard library name. | test.cpp:20:6:20:8 | min | min |
1+
| test.cpp:22:6:22:8 | min | The function $@ reuses a reserved standard library name. | test.cpp:22:6:22:8 | min | min |
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
| test.cpp:18:5:18:10 | tzname | The variable $@ reuses a reserved standard library name. | test.cpp:18:5:18:10 | tzname | tzname |
1+
| test.cpp:19:5:19:10 | tzname | The variable $@ reuses a reserved standard library name. | test.cpp:19:5:19:10 | tzname | tzname |
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
| test.cpp:6:1:6:14 | #undef INT_MAX | Redefinition of INT_MAX declared in a standard library header. |
22
| test.cpp:7:1:7:20 | #define SIZE_MAX 256 | Redefinition of SIZE_MAX declared in a standard library header. |
3-
| test.cpp:37:1:38:9 | #define FD_SET(X) int _ ## X | Redefinition of FD_SET declared in a standard library header. |
3+
| test.cpp:39:1:40:9 | #define FD_SET(X) int _ ## X | Redefinition of FD_SET declared in a standard library header. |
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
| test.cpp:25:5:25:7 | __x | Name $@ uses the reserved prefix '__'. | test.cpp:25:5:25:7 | __x | __x |
2-
| test.cpp:30:5:30:7 | __x | Name $@ uses the reserved prefix '__'. | test.cpp:30:5:30:7 | __x | __x |
1+
| test.cpp:27:5:27:7 | __x | Name $@ uses the reserved prefix '__'. | test.cpp:27:5:27:7 | __x | __x |
2+
| test.cpp:32:5:32:7 | __x | Name $@ uses the reserved prefix '__'. | test.cpp:32:5:32:7 | __x | __x |
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
| test.cpp:22:6:22:17 | operator ""x | Literal suffix identifier $@ does not start with an underscore. | test.cpp:22:6:22:17 | operator ""x | operator ""x |
1+
| test.cpp:24:6:24:17 | operator ""x | Literal suffix identifier $@ does not start with an underscore. | test.cpp:24:6:24:17 | operator ""x | operator ""x |
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
| test.cpp:26:5:26:6 | _X | Name $@ uses the reserved prefix '_'. | test.cpp:26:5:26:6 | _X | _X |
2-
| test.cpp:27:5:27:6 | _x | Name $@ uses the reserved prefix '_'. | test.cpp:27:5:27:6 | _x | _x |
3-
| test.cpp:31:5:31:6 | _X | Name $@ uses the reserved prefix '_'. | test.cpp:31:5:31:6 | _X | _X |
4-
| test.cpp:35:1:35:3 | _i | Name $@ uses the reserved prefix '_'. | test.cpp:35:1:35:3 | _i | _i |
1+
| test.cpp:28:5:28:6 | _X | Name $@ uses the reserved prefix '_'. | test.cpp:28:5:28:6 | _X | _X |
2+
| test.cpp:29:5:29:6 | _x | Name $@ uses the reserved prefix '_'. | test.cpp:29:5:29:6 | _x | _x |
3+
| test.cpp:33:5:33:6 | _X | Name $@ uses the reserved prefix '_'. | test.cpp:33:5:33:6 | _X | _X |
4+
| test.cpp:37:1:37:3 | _i | Name $@ uses the reserved prefix '_'. | test.cpp:37:1:37:3 | _i | _i |
55
| test.h:2:1:2:15 | #define _TEST_H | Name $@ uses the reserved prefix '_'. | test.h:2:1:2:15 | #define _TEST_H | _TEST_H |

cpp/cert/test/rules/DCL51-CPP/test.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ enum {
1515

1616
// int NULL = 0; // NON_COMPLIANT, but not supported by compilers in practice
1717

18+
namespace ns {
1819
int tzname = 0; // NON_COMPLIANT
20+
}
1921

2022
void min() {} // NON_COMPLIANT
2123

@@ -48,4 +50,4 @@ void test_lambda(const int y) {
4850
// Lambda generates a static function called `_FUN` when the lambda is
4951
// converted to a function pointer
5052
g([](int x) { return x; }); // COMPLIANT - compiler generated
51-
}
53+
}

0 commit comments

Comments
 (0)