Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

M27-0-1: Permit elements defined in other headers#144

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
lcartey merged 3 commits intogithub:mainfromlcartey:m27-0-1/permit-non-cstdio-uses
Nov 25, 2022
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletionschange_notes/2022-11-21-null-sizet-not-cstdio.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
- `M27-0-1`
- `CstdioTypesUsed.ql` - Exclude `size_t` from this rule, as it can be provided by headers other than `<cstdio>`.
- `CstdioMacrosUsed.ql` - Exclude `NULL` from this rule, as it can be provided by headers other than `<cstdio>`.
4 changes: 2 additions & 2 deletionscpp/autosar/src/rules/M27-0-1/CstdioMacrosUsed.ql
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,7 +22,7 @@ from MacroInvocation mi
where
not isExcluded(mi, BannedLibrariesPackage::cstdioMacrosUsedQuery()) and
mi.getMacroName() in [
"BUFSIZ", "EOF", "FILENAME_MAX", "FOPEN_MAX", "L_tmpnam", "NULL", "TMP_MAX", "_IOFBF",
"IOLBF", "_IONBF", "SEEK_CUR", "SEEK_END", "SEEK_SET"
"BUFSIZ", "EOF", "FILENAME_MAX", "FOPEN_MAX", "L_tmpnam", "TMP_MAX", "_IOFBF", "IOLBF",
"_IONBF", "SEEK_CUR", "SEEK_END", "SEEK_SET"
]
select mi, "Use of <cstdio> macro '" + mi.getMacroName() + "'."
2 changes: 1 addition & 1 deletioncpp/autosar/src/rules/M27-0-1/CstdioTypesUsed.ql
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,5 +22,5 @@ from TypeMention tm, UserType ut
where
notisExcluded(tm, BannedLibrariesPackage::cstdioTypesUsedQuery())and
ut=tm.getMentionedType()and
ut.hasGlobalOrStdName(["FILE","fpos_t","size_t"])
ut.hasGlobalOrStdName(["FILE","fpos_t"])
selecttm,"Use of <cstdio> type '"+ut.getQualifiedName()+"'."
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,4 +7,3 @@
| test.cpp:30:29:30:37 | FOPEN_MAX | Use of <cstdio> macro 'FOPEN_MAX'. |
| test.cpp:41:14:41:16 | EOF | Use of <cstdio> macro 'EOF'. |
| test.cpp:50:24:50:31 | SEEK_SET | Use of <cstdio> macro 'SEEK_SET'. |
| test.cpp:60:10:60:13 | NULL | Use of <cstdio> macro 'NULL'. |
3 changes: 0 additions & 3 deletionscpp/autosar/test/rules/M27-0-1/CstdioTypesUsed.expected
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
| test.cpp:4:8:4:11 | type mention | Use of <cstdio> type 'std::FILE'. |
| test.cpp:6:8:6:13 | type mention | Use of <cstdio> type 'std::fpos_t'. |
| test.cpp:20:18:20:23 | type mention | Use of <cstdio> type 'size_t'. |
| test.cpp:21:18:21:23 | type mention | Use of <cstdio> type 'size_t'. |
| test.cpp:34:3:34:6 | type mention | Use of <cstdio> type 'FILE'. |
| test.cpp:36:3:36:8 | type mention | Use of <cstdio> type 'fpos_t'. |
| test.cpp:50:14:50:19 | type mention | Use of <cstdio> type 'size_t'. |
2 changes: 1 addition & 1 deletioncpp/autosar/test/rules/M27-0-1/test.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -57,5 +57,5 @@ void *test_cstdio_is_used() {
printf("foo"); // NON_COMPLIANT
puts("all done!"); // NON_COMPLIANT

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

[8]ページ先頭

©2009-2025 Movatter.jp