Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
2 changes: 2 additions & 0 deletions change_notes/2024-02-12-improve-a18-0-1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- `A18-0-1` - `CLibraryFacilitiesNotAccessedThroughCPPLibraryHeaders.ql`:
- Fix issue #7 - improve query logic to only match on exact standard library names (exclude local files with same names. Now excludes sys/header.h type headers as well from the results as those are not C standard libraries).
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ where
* not use any of 'signal.h's facilities, for example.
*/

filename = i.getIncludedFile().getBaseName() and
filename = i.getIncludeText().substring(1, i.getIncludeText().length() - 1) and
filename in [
"assert.h", "ctype.h", "errno.h", "fenv.h", "float.h", "inttypes.h", "limits.h", "locale.h",
"math.h", "setjmp.h", "signal.h", "stdarg.h", "stddef.h", "stdint.h", "stdio.h", "stdlib.h",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@
| test.cpp:19:1:19:18 | #include <uchar.h> | C library "uchar.h" is included instead of the corresponding C++ library <cuchar>. |
| test.cpp:20:1:20:18 | #include <wchar.h> | C library "wchar.h" is included instead of the corresponding C++ library <cwchar>. |
| test.cpp:21:1:21:19 | #include <wctype.h> | C library "wctype.h" is included instead of the corresponding C++ library <cwctype>. |
| test.cpp:45:1:45:17 | #include "time.h" | C library "time.h" is included instead of the corresponding C++ library <ctime>. |
4 changes: 4 additions & 0 deletions cpp/autosar/test/rules/A18-0-1/lib/example.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#ifndef LIB_EXAMPLE_H_
#define LIB_EXAMPLE_H_

#endif
5 changes: 4 additions & 1 deletion cpp/autosar/test/rules/A18-0-1/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,7 @@
#include <ctime> // COMPLIANT
#include <cuchar> // COMPLIANT
#include <cwchar> // COMPLIANT
#include <cwctype> // COMPLIANT
#include <cwctype> // COMPLIANT

#include "lib/example.h" // COMPLIANT
#include "time.h" // NON_COMPLIANT
4 changes: 4 additions & 0 deletions cpp/autosar/test/rules/A18-0-1/time.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#ifndef LIB_TIME_EXAMPLE_H_
#define LIB_TIME_EXAMPLE_H_
// may be a user lib or a std lib checked into a project
#endif