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 a10f35c

Browse filesBrowse files
committed
M27-0-1: Permit elements defined in other headers
The `std::size_t` type and the `NULL` macro are both defined in multiple headers, and therefore should not be uniquely considered part of cstdio.
1 parent 7b4aede commit a10f35c
Copy full SHA for a10f35c

File tree

Expand file treeCollapse file tree

5 files changed

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

5 files changed

+4
-8
lines changed

‎cpp/autosar/src/rules/M27-0-1/CstdioMacrosUsed.ql

Copy file name to clipboardExpand all lines: cpp/autosar/src/rules/M27-0-1/CstdioMacrosUsed.ql
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ from MacroInvocation mi
2222
where
2323
not isExcluded(mi, BannedLibrariesPackage::cstdioMacrosUsedQuery()) and
2424
mi.getMacroName() in [
25-
"BUFSIZ", "EOF", "FILENAME_MAX", "FOPEN_MAX", "L_tmpnam", "NULL", "TMP_MAX", "_IOFBF",
26-
"IOLBF", "_IONBF", "SEEK_CUR", "SEEK_END", "SEEK_SET"
25+
"BUFSIZ", "EOF", "FILENAME_MAX", "FOPEN_MAX", "L_tmpnam", "TMP_MAX", "_IOFBF", "IOLBF",
26+
"_IONBF", "SEEK_CUR", "SEEK_END", "SEEK_SET"
2727
]
2828
select mi, "Use of <cstdio> macro '" + mi.getMacroName() + "'."

‎cpp/autosar/src/rules/M27-0-1/CstdioTypesUsed.ql

Copy file name to clipboardExpand all lines: cpp/autosar/src/rules/M27-0-1/CstdioTypesUsed.ql
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ from TypeMention tm, UserType ut
2222
where
2323
not isExcluded(tm, BannedLibrariesPackage::cstdioTypesUsedQuery()) and
2424
ut = tm.getMentionedType() and
25-
ut.hasGlobalOrStdName(["FILE", "fpos_t", "size_t"])
25+
ut.hasGlobalOrStdName(["FILE", "fpos_t"])
2626
select tm, "Use of <cstdio> type '" + ut.getQualifiedName() + "'."

‎cpp/autosar/test/rules/M27-0-1/CstdioMacrosUsed.expected

Copy file name to clipboardExpand all lines: cpp/autosar/test/rules/M27-0-1/CstdioMacrosUsed.expected
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,3 @@
77
| test.cpp:30:29:30:37 | FOPEN_MAX | Use of <cstdio> macro 'FOPEN_MAX'. |
88
| test.cpp:41:14:41:16 | EOF | Use of <cstdio> macro 'EOF'. |
99
| test.cpp:50:24:50:31 | SEEK_SET | Use of <cstdio> macro 'SEEK_SET'. |
10-
| test.cpp:60:10:60:13 | NULL | Use of <cstdio> macro 'NULL'. |
-3Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
| test.cpp:4:8:4:11 | type mention | Use of <cstdio> type 'std::FILE'. |
22
| test.cpp:6:8:6:13 | type mention | Use of <cstdio> type 'std::fpos_t'. |
3-
| test.cpp:20:18:20:23 | type mention | Use of <cstdio> type 'size_t'. |
4-
| test.cpp:21:18:21:23 | type mention | Use of <cstdio> type 'size_t'. |
53
| test.cpp:34:3:34:6 | type mention | Use of <cstdio> type 'FILE'. |
64
| test.cpp:36:3:36:8 | type mention | Use of <cstdio> type 'fpos_t'. |
7-
| test.cpp:50:14:50:19 | type mention | Use of <cstdio> type 'size_t'. |

‎cpp/autosar/test/rules/M27-0-1/test.cpp

Copy file name to clipboardExpand all lines: cpp/autosar/test/rules/M27-0-1/test.cpp
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,5 @@ void *test_cstdio_is_used() {
5757
printf("foo"); // NON_COMPLIANT
5858
puts("all done!"); // NON_COMPLIANT
5959

60-
return NULL; // NON_COMPLIANT
60+
return NULL; // COMPLIANT - NULL is not uniquely defined by cstdio
6161
}

0 commit comments

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