- Notifications
You must be signed in to change notification settings - Fork70
Improve identification of reuse of reserved names#951
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
Draft
lcartey wants to merge34 commits intomainChoose a base branch fromlcartey/standard-library-naming
base:main
Could not load branches
Branch not found:{{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
Uh oh!
There was an error while loading.Please reload this page.
Draft
Changes fromall commits
Commits
Show all changes
34 commits Select commitHold shift + click to select a range
be7f810 Add module for names from the C/C++ library
lcartey1554d78 Add mad generator for the C Standard Library
lcartey057c684 Add mad generator for the C++ Standard Library
lcarteybf715b1 Fix output locations
lcarteyaf00c9f Update models file
lcarteyea7e3b5 C: Support pointer return types in library generator
lcarteye21f6d3 Add missing update
lcarteycae5660 Add manual member variable models for C11 and C99.
lcartey189d66f Expose libraryMemberVariableModels
lcarteyfcbe4e7 Adopt StandardLibraryNames in the C DeclaredAReservedIdentifier query
lcartey5f738b3 Update message, add additional tests
lcartey221c0c1 Refine detection of reserved identifiers
lcarteyca51fda Correctly reflect tag and typedef name spaces
lcartey122a020 Exclude identifiers generated from library macros
lcartey172378f Only include macro names when the relevant header is included
lcarteyb91d527 Improve performance on large databases
lcartey1fd72e2 Migrate STR32-C to new naming library
lcarteyf5210ac Extract ReservedNames library.
lcartey92cfb2f Exclude NDEBUG, regenerate
lcartey6998ed0 Migrate Rule 21.2 to the ReservedNames library
lcartey927640b Unshared Rule 21.2, and implement with MISRA rules
lcarteya821de9 Replace Naming with StandardLibraryNames
lcartey7c94c8c Migrate A17-1-1 to use StandardLibraryNames
lcarteyc3977f2 Migrate M17-0-2 to StandardLibraryNames.
lcarteyb2ea30a C++: More accurately report declaring header
lcarteyd18ada0 C++: Remove unnamed and specialization types
lcarteya9a4613 C++: Exclude operator bool from the reserved names
lcarteybbd56e0 C++: Exclude member names unless the declaring type is visible
lcartey384b245 C++: Exclude name-header mappings for specializations
lcartey6ca9153 Add a predicate for identifying any name in a standard
lcarteycb5ddf5 Support C++ in reserved names
lcartey740c76d Migrate A17-0-1 to use ReservedName
lcartey7a1eeb2 M17-0-3: Migrate to StandardNaming
lcarteydeb849b A17-0-1: Accept output
lcarteyFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
2 changes: 1 addition & 1 deletion.codeqlmanifest.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletionsc/cert/src/rules/STR32-C/NonNullTerminatedToFunctionThatExpectsAString.ql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
47 changes: 42 additions & 5 deletionsc/common/test/rules/declaredareservedidentifier/DeclaredAReservedIdentifier.expected
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,42 @@ | ||
| | test.c:2:1:2:23 | #define _RESERVED_MACRO | Macro '_RESERVED_MACRO' declares a reserved name beginning _ followed by an uppercase letter. | | ||
| | test.c:6:1:6:28 | #define _also_reserved_MACRO | Macro '_also_reserved_MACRO' declares a name beginning with _ which is reserved in the ordinary and tag namespaces. | | ||
| | test.c:11:8:11:9 | _s | Type '_s' declares a name beginning with _ which is reserved in the tag name space. | | ||
| | test.c:15:6:15:7 | _f | Function '_f' declares a name beginning with _ which is reserved in the ordinary name space. | | ||
| | test.c:19:7:19:12 | malloc | Function 'malloc' declares a name which is reserved for external linkage from the C11 standard library header 'stdlib.h'. | | ||
| | test.c:25:5:25:9 | errno | Global variable 'errno' declares a name which is reserved for external linkage from the C11 standard library header 'errno.h'. | | ||
| | test.c:39:16:39:18 | log | Parameter 'log' declares a name reserved for a macro from the C11 standard library header 'tgmath.h'. | | ||
| | test.c:43:5:43:16 | _Test_global | Global variable '_Test_global' declares a reserved name beginning _ followed by an uppercase letter. | | ||
| | test.c:44:6:44:15 | _Test_func | Function '_Test_func' declares a reserved name beginning _ followed by an uppercase letter. | | ||
| | test.c:45:9:45:19 | _Test_param | Parameter '_Test_param' declares a reserved name beginning _ followed by an uppercase letter. | | ||
| | test.c:46:7:46:17 | _Test_local | Local variable '_Test_local' declares a reserved name beginning _ followed by an uppercase letter. | | ||
| | test.c:47:10:47:27 | _Test_struct_local | Type '_Test_struct_local' declares a reserved name beginning _ followed by an uppercase letter. | | ||
| | test.c:49:9:49:20 | _Test_member | Member variable '_Test_member' declares a reserved name beginning _ followed by an uppercase letter. | | ||
| | test.c:52:8:52:19 | _Test_struct | Type '_Test_struct' declares a reserved name beginning _ followed by an uppercase letter. | | ||
| | test.c:53:7:53:18 | _Test_member | Member variable '_Test_member' declares a reserved name beginning _ followed by an uppercase letter. | | ||
| | test.c:55:1:56:3 | #define _TEST_MACRO x | Macro '_TEST_MACRO' declares a reserved name beginning _ followed by an uppercase letter. | | ||
| | test.c:60:5:60:24 | __test_double_global | Global variable '__test_double_global' declares a reserved name beginning with __. | | ||
| | test.c:61:6:61:23 | __test_double_func | Function '__test_double_func' declares a reserved name beginning with __. | | ||
| | test.c:62:9:62:27 | __test_double_param | Parameter '__test_double_param' declares a reserved name beginning with __. | | ||
| | test.c:63:7:63:25 | __test_double_local | Local variable '__test_double_local' declares a reserved name beginning with __. | | ||
| | test.c:64:10:64:35 | __test_double_struct_local | Type '__test_double_struct_local' declares a reserved name beginning with __. | | ||
| | test.c:65:9:65:28 | __test_double_member | Member variable '__test_double_member' declares a reserved name beginning with __. | | ||
| | test.c:68:8:68:27 | __test_double_struct | Type '__test_double_struct' declares a reserved name beginning with __. | | ||
| | test.c:69:7:69:26 | __test_double_member | Member variable '__test_double_member' declares a reserved name beginning with __. | | ||
| | test.c:71:1:71:22 | #define __TEST_MACRO x | Macro '__TEST_MACRO' declares a reserved name beginning with __. | | ||
| | test.c:78:5:78:22 | _test_lower_global | Global variable '_test_lower_global' declares a name beginning with _ which is reserved in the ordinary name space. | | ||
| | test.c:79:6:79:21 | _test_lower_func | Function '_test_lower_func' declares a name beginning with _ which is reserved in the ordinary name space. | | ||
| | test.c:88:8:88:19 | _test_struct | Type '_test_struct' declares a name beginning with _ which is reserved in the tag name space. | | ||
| | test.c:91:1:92:3 | #define _test_macro x | Macro '_test_macro' declares a name beginning with _ which is reserved in the ordinary and tag namespaces. | | ||
| | test.c:96:5:96:14 | FE_INEXACT | Global variable 'FE_INEXACT' declares a name reserved for a macro from the C11 standard library header 'fenv.h'. | | ||
| | test.c:97:6:97:17 | FE_DIVBYZERO | Function 'FE_DIVBYZERO' declares a name reserved for a macro from the C11 standard library header 'fenv.h'. | | ||
| | test.c:98:9:98:18 | FE_INEXACT | Parameter 'FE_INEXACT' declares a name reserved for a macro from the C11 standard library header 'fenv.h'. | | ||
| | test.c:99:7:99:16 | FE_INVALID | Local variable 'FE_INVALID' declares a name reserved for a macro from the C11 standard library header 'fenv.h'. | | ||
| | test.c:100:10:100:19 | FE_INEXACT | Type 'FE_INEXACT' declares a name reserved for a macro from the C11 standard library header 'fenv.h'. | | ||
| | test.c:101:9:101:18 | FE_INEXACT | Member variable 'FE_INEXACT' declares a name reserved for a macro from the C11 standard library header 'fenv.h'. | | ||
| | test.c:104:8:104:17 | FE_INEXACT | Type 'FE_INEXACT' declares a name reserved for a macro from the C11 standard library header 'fenv.h'. | | ||
| | test.c:105:7:105:16 | FE_INEXACT | Member variable 'FE_INEXACT' declares a name reserved for a macro from the C11 standard library header 'fenv.h'. | | ||
| | test.c:107:1:108:3 | #define FE_INEXACT x | Macro 'FE_INEXACT' declares a name reserved for a macro from the C11 standard library header 'fenv.h'. | | ||
| | test.c:118:5:118:8 | exit | Global variable 'exit' declares a name which is reserved for external linkage from the C11 standard library header 'stdlib.h'. | | ||
| | test.c:120:6:120:9 | free | Function 'free' declares a name which is reserved for external linkage from the C11 standard library header 'stdlib.h'. | | ||
| | test.c:130:1:130:16 | #define strlen 0 | Macro 'strlen' declares a reserved name from the C11 standard library header 'string.h' which is included directly or indirectly in this translation unit. | | ||
| | test.c:140:1:140:16 | #define tm_sec 0 | Macro 'tm_sec' declares a reserved name from the C11 standard library header 'time.h' which is included directly or indirectly in this translation unit. | |
166 changes: 162 additions & 4 deletionsc/common/test/rules/declaredareservedidentifier/test.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
21 changes: 4 additions & 17 deletionsc/misra/src/rules/RULE-21-1/DefineAndUndefUsedOnReservedIdentifierOrMacroName.ql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
14 changes: 8 additions & 6 deletionsc/misra/src/rules/RULE-21-2/DoNotDeclareAReservedIdentifier.ql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletionsc/misra/test/rules/RULE-21-1/DefineAndUndefUsedOnReservedIdentifierOrMacroName.expected
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| | test.c:1:1:1:17 | #define _NOT_OKAY |Macro'_NOT_OKAY'declares a reserved name beginning _ followed by an uppercase letter. | | ||
| | test.c:2:1:2:16 | #undef _NOT_OKAY |Undef'_NOT_OKAY'declares a reserved name beginning _ followed by an uppercase letter. | | ||
| | test.c:5:1:5:13 | #define errno |Macro'errno'declares a name reserved for a macro from the C11 standard library header 'errno.h'. | |
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.