-
Notifications
You must be signed in to change notification settings - Fork 74
Add lifetime package #1024
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
knewbury01
wants to merge
1
commit into
github:main
Choose a base branch
from
knewbury01:knewbury01/Lifetime
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.
Draft
Add lifetime package #1024
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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 |
|---|---|---|
|
|
@@ -259,6 +259,7 @@ | |
| "Language1", | ||
| "Language2", | ||
| "Language3", | ||
| "Lifetime", | ||
| "Linkage1", | ||
| "Linkage2", | ||
| "Literals", | ||
|
|
||
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,4 +1,4 @@ | ||
| - `A3-1-1` - `ViolationsOfOneDefinitionRule.ql`: | ||
| - The query previously would incorrectly allow cases where something was defined with `extern` and did not use the defined external linkage library to find external linkage. This change may result in the query finding more results. Additionally a typo has been fixed in the alert message which will cause the old alerts for this query to now show up as new ones. | ||
| - `RULE-6-0-2`, `A3-1-4` - `ExternalLinkageArrayWithoutExplicitSizeMisra.ql`, `ExternalLinkageArrayWithoutExplicitSizeAutosar.ql`: | ||
| - `RULE-6-0-2`, `A3-1-4` - `ExternalLinkageArrayWithoutExplicitSizeMisra.ql`, `ExternalLinkageArrayWithoutExplicitSizeAutosar.ql`: | ||
| - The queries listed now find flexible member arrays in structs, as those do not have an explicit size. |
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 |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| - `A8-5-0`, `EXP53-CPP`, `EXP33-C`, `RULE-9-1` - `MemoryNotInitializedBeforeItIsRead.ql`, `DoNotReadUninitializedMemory.ql`, `DoNotReadUninitializedMemory.ql`, `ObjectWithAutoStorageDurationReadBeforeInit.ql`: | ||
| - The queries listed now find uses of the operator 'new' where there is no value initialization provided. |
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
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
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
24 changes: 24 additions & 0 deletions
24
cpp/misra/src/rules/RULE-11-6-2/ValueOfAnObjectMustNotBeReadBeforeItHasBeenSet.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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| /** | ||
| * @id cpp/misra/value-of-an-object-must-not-be-read-before-it-has-been-set | ||
| * @name RULE-11-6-2: The value of an object must not be read before it has been set | ||
| * @description Reading from uninitialized indeterminate values may produce undefined behavior. | ||
| * @kind problem | ||
| * @precision medium | ||
| * @problem.severity error | ||
| * @tags external/misra/id/rule-11-6-2 | ||
| * correctness | ||
| * security | ||
| * scope/system | ||
| * external/misra/enforcement/undecidable | ||
| * external/misra/obligation/mandatory | ||
| */ | ||
|
|
||
| import cpp | ||
| import codingstandards.cpp.misra | ||
| import codingstandards.cpp.rules.readofuninitializedmemory.ReadOfUninitializedMemory | ||
|
|
||
| class ValueOfAnObjectMustNotBeReadBeforeItHasBeenSetQuery extends ReadOfUninitializedMemorySharedQuery { | ||
| ValueOfAnObjectMustNotBeReadBeforeItHasBeenSetQuery() { | ||
| this = LifetimePackage::valueOfAnObjectMustNotBeReadBeforeItHasBeenSetQuery() | ||
| } | ||
| } |
1 change: 1 addition & 0 deletions
1
cpp/misra/test/rules/RULE-11-6-2/ValueOfAnObjectMustNotBeReadBeforeItHasBeenSet.testref
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 |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| cpp/common/test/rules/readofuninitializedmemory/ReadOfUninitializedMemory.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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| { | ||
| "MISRA-C++-2023": { | ||
| "RULE-11-6-2": { | ||
| "properties": { | ||
| "enforcement": "undecidable", | ||
| "obligation": "mandatory" | ||
| }, | ||
| "queries": [ | ||
| { | ||
| "description": "Reading from uninitialized indeterminate values may produce undefined behavior.", | ||
| "kind": "problem", | ||
| "name": "The value of an object must not be read before it has been set", | ||
| "precision": "medium", | ||
| "severity": "error", | ||
| "short_name": "ValueOfAnObjectMustNotBeReadBeforeItHasBeenSet", | ||
| "shared_implementation_short_name": "ReadOfUninitializedMemory", | ||
| "tags": [ | ||
| "correctness", | ||
| "security", | ||
| "scope/system" | ||
| ] | ||
| } | ||
| ], | ||
| "title": "The value of an object must not be read before it has been set" | ||
| }, | ||
| "RULE-6-8-3": { | ||
| "properties": { | ||
| "enforcement": "decidable", | ||
| "obligation": "required" | ||
| }, | ||
| "queries": [ | ||
| { | ||
| "description": "An assignment operator shall not assign the address of an object with automatic storage duration to an object with a greater lifetime", | ||
| "kind": "problem", | ||
| "name": "An assignment operator shall not assign the address of an object with automatic storage duration to", | ||
| "precision": "very-high", | ||
| "severity": "error", | ||
| "short_name": "AssignmentOperatorAssignTheAddressOfAnObjectWithAutomaticStorageDurationToAnObjectWithAGreaterLifetime", | ||
| "tags": [ | ||
| "scope/single-translation-unit" | ||
| ] | ||
| } | ||
| ], | ||
| "title": "An assignment operator shall not assign the address of an object with automatic storage duration to an object with a greater lifetime" | ||
| } | ||
| } | ||
| } |
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Single
=should be==