Skip to content

Commit

Permalink
Merge branch 'main' into fix-issue-629
Browse files Browse the repository at this point in the history
  • Loading branch information
lcartey authored Nov 15, 2024
2 parents 98c7610 + 373b793 commit 301d133
Show file tree
Hide file tree
Showing 69 changed files with 1,111 additions and 118 deletions.
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every week
interval: "weekly"
2 changes: 1 addition & 1 deletion .github/workflows/code-scanning-pack-gen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:

- name: Cache CodeQL
id: cache-codeql
uses: actions/cache@v2.1.3
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/codeql_home
key: codeql-home-${{ matrix.os }}-${{ matrix.codeql_cli }}-${{ matrix.codeql_standard_library }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql_unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
uses: actions/checkout@v4

- name: Install Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.9"

Expand All @@ -57,7 +57,7 @@ jobs:

- name: Cache CodeQL
id: cache-codeql
uses: actions/cache@v3
uses: actions/cache@v4
with:
# A list of files, directories, and wildcard patterns to cache and restore
path: ${{github.workspace}}/codeql_home
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/extra-rule-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Check Rules
shell: pwsh
Expand All @@ -33,7 +33,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Ensure CPP Shared Rules Have Valid Structure
shell: pwsh
Expand All @@ -44,13 +44,13 @@ jobs:
run: scripts/util/Test-SharedImplementationsHaveTestCases.ps1 -Language c -CIMode


- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: failure()
with:
name: missing-test-report.csv
path: MissingTestReport*.csv

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: failure()
with:
name: test-report.csv
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/finalize-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
path: tooling

- name: Install Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.9"

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/generate-html-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.9"

Expand All @@ -35,7 +35,7 @@ jobs:
python scripts/documentation/generate_iso26262_docs.py coding-standards-html-docs
- name: Upload HTML documentation
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: coding-standards-docs-${{ github.sha }}
path: coding-standards-html-docs/
4 changes: 2 additions & 2 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}

- name: Install Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.9"

Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/standard_library_upgrade_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
matrix: ${{ steps.export-unit-test-matrix.outputs.matrix }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Export unit test matrix
id: export-unit-test-matrix
Expand All @@ -41,16 +41,16 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup Python 3
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Cache CodeQL
id: cache-codeql
uses: actions/cache@v2.1.3
uses: actions/cache@v4
with:
# A list of files, directories, and wildcard patterns to cache and restore
path: ${{github.workspace}}/codeql_home
Expand Down Expand Up @@ -157,7 +157,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Install Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.9"

Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/tooling-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
matrix: ${{ steps.export-supported-codeql-env-matrix.outputs.matrix }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Export supported CodeQL environment matrix
id: export-supported-codeql-env-matrix
Expand All @@ -40,10 +40,10 @@ jobs:
matrix: ${{ fromJSON(needs.prepare-supported-codeql-env-matrix.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.9"

Expand All @@ -52,7 +52,7 @@ jobs:

- name: Cache CodeQL
id: cache-codeql
uses: actions/cache@v2.1.3
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/codeql_home
key: codeql-home-${{ matrix.os }}-${{ matrix.codeql_cli }}-${{ matrix.codeql_standard_library }}
Expand Down Expand Up @@ -83,10 +83,10 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.9"

Expand All @@ -102,10 +102,10 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.9"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
ref: ${{ inputs.head-sha }}

- name: Install Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.9"

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/validate-package-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}

- name: Install Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.9"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/validate-query-formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/validate-query-help.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/validate-query-test-case-formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/verify-standard-library-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
matrix: ${{ steps.export-matrix.outputs.matrix }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Export unit test matrix
id: export-matrix
Expand All @@ -44,16 +44,16 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup Python 3
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.9"

- name: Cache CodeQL
id: cache-codeql
uses: actions/cache@v2.1.3
uses: actions/cache@v4
with:
# A list of files, directories, and wildcard patterns to cache and restore
path: ${{github.workspace}}/codeql_home
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// GENERATED FILE - DO NOT MODIFY
import codingstandards.cpp.rules.functiontypesnotinprototypeformshared.FunctionTypesNotInPrototypeFormShared

class TestFileQuery extends FunctionTypesNotInPrototypeFormSharedSharedQuery, TestQuery { }
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// GENERATED FILE - DO NOT MODIFY
import codingstandards.cpp.rules.missingstaticspecifierobjectredeclarationshared.MissingStaticSpecifierObjectRedeclarationShared

class TestFileQuery extends MissingStaticSpecifierObjectRedeclarationSharedSharedQuery, TestQuery {
}
File renamed without changes.
22 changes: 22 additions & 0 deletions c/misra/src/rules/RULE-1-5/CallToObsolescentFunctionGets.ql
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* @id c/misra/call-to-obsolescent-function-gets
* @name RULE-1-5: Disallowed usage of obsolescent function 'gets'
* @description The function 'gets' is an obsolescent language feature which was removed in C11.
* @kind problem
* @precision very-high
* @problem.severity error
* @tags external/misra/id/rule-1-5
* external/misra/c/2012/amendment3
* security
* maintainability
* external/misra/obligation/required
*/

import cpp
import codingstandards.c.misra

from FunctionCall fc
where
not isExcluded(fc, Language4Package::callToObsolescentFunctionGetsQuery()) and
fc.getTarget().hasGlobalOrStdName("gets")
select fc, "Call to obsolescent function 'gets'."
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* @id c/misra/function-types-not-in-prototype-form-obsolete
* @name RULE-1-5: Function types shall be in prototype form with named parameters
* @description The use of non-prototype format parameter type declarators is an obsolescent
* language feature.
* @kind problem
* @precision medium
* @problem.severity error
* @tags external/misra/id/rule-1-5
* correctness
* external/misra/c/2012/amendment3
* external/misra/obligation/required
*/

import cpp
import codingstandards.c.misra
import codingstandards.cpp.rules.functiontypesnotinprototypeformshared.FunctionTypesNotInPrototypeFormShared

class FunctionTypesNotInPrototypeFormObsoleteQuery extends FunctionTypesNotInPrototypeFormSharedSharedQuery
{
FunctionTypesNotInPrototypeFormObsoleteQuery() {
this = Language4Package::functionTypesNotInPrototypeFormObsoleteQuery()
}
}
32 changes: 32 additions & 0 deletions c/misra/src/rules/RULE-1-5/InvalidDefineOrUndefOfStdBoolMacro.ql
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* @id c/misra/invalid-define-or-undef-of-std-bool-macro
* @name RULE-1-5: Programs may not undefine or redefine the macros bool, true, or false
* @description Directives that undefine and/or redefine the standard boolean macros has been
* declared an obsolescent language feature since C99.
* @kind problem
* @precision very-high
* @problem.severity warning
* @tags external/misra/id/rule-1-5
* maintainability
* readability
* external/misra/c/2012/amendment3
* external/misra/obligation/required
*/

import cpp
import codingstandards.c.misra

string getABoolMacroName() { result = ["true", "false", "bool"] }

from PreprocessorDirective directive, string opString, string macroName
where
not isExcluded(directive, Language4Package::invalidDefineOrUndefOfStdBoolMacroQuery()) and
macroName = getABoolMacroName() and
(
macroName = directive.(Macro).getName() and
opString = "define"
or
macroName = directive.(PreprocessorUndef).getName() and
opString = "undefine"
)
select directive, "Invalid " + opString + " of boolean standard macro '" + macroName + "'."
Loading

0 comments on commit 301d133

Please sign in to comment.