Skip to content

C: Address remaining gcc compiler compatability issues #247

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

Merged
merged 11 commits into from
Mar 13, 2023

Conversation

lcartey
Copy link
Collaborator

@lcartey lcartey commented Mar 13, 2023

Description

This PR addresses all the remaining gcc issues C compiler compatibility issues.

In line with the previous issues we've reviewed, the majority of the fixes are either (a) fixing test cases with syntactically invalid C code; or (b) including a different expected results file for different compilers, because the results are morally equivalent but textually different.

The sole exception in this PR is STR37-C. This rule prohibits the use of the <ctype> functions. However, the C standard allows these "functions" to be implemented either as functions or macros, and we only detected the former. Detecting "arguments" to macros is tricky, because they are textually expanded and may appear in multiple places in the AST generated from the macro, with no easy way to determine which aspects came from the argument itself. We handle this by looking for specific AST patterns corresponding to known, supported compilers, and identifying a "unique" element to report as the argument itself.

Fixes #246.

Finally, as an additional "bonus" I've updated Rule 2.4 to excluded template parameters.

Change request type

  • Release or process automation (GitHub workflows, internal scripts)
  • Internal documentation
  • External documentation
  • Query files (.ql, .qll, .qls or unit tests)
  • External scripts (analysis report or other code shipped as part of a release)

Rules with added or modified queries

  • No rules added
  • Queries have been added for the following rules:
    • rule number here
  • Queries have been modified for the following rules:
    • Rule 2.4
    • Rule 2.6
    • Rule 21.1
    • DCL41-C
    • Rule 8.2
    • STR34-C
    • STR37-C

Release change checklist

A change note (development_handbook.md#change-notes) is required for any pull request which modifies:

  • The structure or layout of the release artifacts.
  • The evaluation performance (memory, execution time) of an existing query.
  • The results of an existing query in any circumstance.

If you are only adding new rule queries, a change note is not required.

Author: Is a change note required?

  • Yes
  • No

🚨🚨🚨
Reviewer: Confirm that format of shared queries (not the .qll file, the
.ql file that imports it) is valid by running them within VS Code.

  • Confirmed

Reviewer: Confirm that either a change note is not required or the change note is required and has been added.

  • Confirmed

Query development review checklist

For PRs that add new queries or modify existing queries, the following checklist should be completed by both the author and reviewer:

Author

  • Have all the relevant rule package description files been checked in?
  • Have you verified that the metadata properties of each new query is set appropriately?
  • Do all the unit tests contain both "COMPLIANT" and "NON_COMPLIANT" cases?
  • Are the alert messages properly formatted and consistent with the style guide?
  • Have you run the queries on OpenPilot and verified that the performance and results are acceptable?
    As a rule of thumb, predicates specific to the query should take no more than 1 minute, and for simple queries be under 10 seconds. If this is not the case, this should be highlighted and agreed in the code review process.
  • Does the query have an appropriate level of in-query comments/documentation?
  • Have you considered/identified possible edge cases?
  • Does the query not reinvent features in the standard library?
  • Can the query be simplified further (not golfed!)

Reviewer

  • Have all the relevant rule package description files been checked in?
  • Have you verified that the metadata properties of each new query is set appropriately?
  • Do all the unit tests contain both "COMPLIANT" and "NON_COMPLIANT" cases?
  • Are the alert messages properly formatted and consistent with the style guide?
  • Have you run the queries on OpenPilot and verified that the performance and results are acceptable?
    As a rule of thumb, predicates specific to the query should take no more than 1 minute, and for simple queries be under 10 seconds. If this is not the case, this should be highlighted and agreed in the code review process.
  • Does the query have an appropriate level of in-query comments/documentation?
  • Have you considered/identified possible edge cases?
  • Does the query not reinvent features in the standard library?
  • Can the query be simplified further (not golfed!)

lcartey added 10 commits March 10, 2023 13:06
This test case had some syntactically invalid C code, and a name clash,
which have now been addressed.
Labels cannot be before declarations, only before expressions or
statements.
Compliers already exclude the #define defined case.
Cases are labels, and cannot be before declarations.
This rule has a clang specific error, not permitting certain function
declarations. Update test case and expected results to reflect this.
For this test case our standard library stubs (MUSL) use a different
form of macro for these standard library functions that gcc and clang,
so update the expected result files.
The <ctype.h> commonly implements its APIs using either macros or
functions or some combination of the two. Our query only assumed
functions were used, whereas macros are practically used by both gcc and
clang, and these can vary depending on compiler flags.

The CharFunctions.qll library now provides a unified interface from
which to get a unique expression for each use of an API in the library,
hopefully regardless of whether it is a macro or a function. To do this
we have had to hard code assumptions about the structure of the macros,
however our matrix compiler testing should flag if these assumptions are
broken with a particular version of a supported compiler.
@github-actions
Copy link

🤖 Beep Boop! Matrix Testing for this PR has been initiated. Please check back later for results.

💡 If you do not hear back from me please check my status! I will report even if this PR does not contain files eligible for matrix testing.

@jsinglet
Copy link
Contributor

🤖 Beep Boop! clang/cpp/x86_64 Matrix Testing for this PR has been completed but I didn't find anything to test!

@jsinglet
Copy link
Contributor

🤖 Beep Boop! gcc/cpp/x86_64 Matrix Testing for this PR has been completed but I didn't find anything to test!

@jsinglet
Copy link
Contributor

🤖 Beep Boop! gcc/c/x86_64 Matrix Testing for this PR has been completed. See below for the results!


COMPILE_PASS         : True
QUERY                : ToCharacterHandlingFunctionsRepresentableAsUChar
RULE                 : STR37-C
TEST_DIFFERENCE      : --- expected
                       +++ actual
                       @@ -1,28 +1,28 @@
                       -| test.c:7:3:7:9 | call to isalnum | $@ to character-handling function may not be representable as an unsigned char. | test.c:7:11:7:12 | * ... | Argument |
                       -| test.c:8:3:8:13 | isalpha(a) | $@ to character-handling function may not be representable as an unsigned char. | test.c:8:11:8:12 | * ... | Argument |
                       -| test.c:10:3:10:9 | call to isblank | $@ to character-handling function may not be representable as an unsigned char. | test.c:10:11:10:12 | * ... | Argument |
                       -| test.c:11:3:11:9 | call to iscntrl | $@ to character-handling function may not be representable as an unsigned char. | test.c:11:11:11:12 | * ... | Argument |
                       -| test.c:12:3:12:13 | isdigit(a) | $@ to character-handling function may not be representable as an unsigned char. | test.c:12:3:12:13 | (...) | Argument |
                       -| test.c:13:3:13:13 | isgraph(a) | $@ to character-handling function may not be representable as an unsigned char. | test.c:13:3:13:13 | (...) | Argument |
                       -| test.c:14:3:14:13 | islower(a) | $@ to character-handling function may not be representable as an unsigned char. | test.c:14:3:14:13 | (...) | Argument |
                       -| test.c:15:3:15:13 | isprint(a) | $@ to character-handling function may not be representable as an unsigned char. | test.c:15:3:15:13 | (...) | Argument |
                       -| test.c:16:3:16:9 | call to ispunct | $@ to character-handling function may not be representable as an unsigned char. | test.c:16:11:16:12 | * ... | Argument |
                       -| test.c:17:3:17:13 | call to __isspace | $@ to character-handling function may not be representable as an unsigned char. | test.c:17:11:17:12 | * ... | Argument |
                       -| test.c:18:3:18:13 | isupper(a) | $@ to character-handling function may not be representable as an unsigned char. | test.c:18:3:18:13 | (...) | Argument |
                       -| test.c:19:3:19:10 | call to isxdigit | $@ to character-handling function may not be representable as an unsigned char. | test.c:19:12:19:13 | * ... | Argument |
                       +| test.c:7:3:7:13 | isalnum(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:7:3:7:13 | (...) | Argument |
                       +| test.c:8:3:8:13 | isalpha(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:8:3:8:13 | (...) | Argument |
                       +| test.c:10:3:10:13 | isblank(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:10:3:10:13 | (...) | Argument |
                       +| test.c:11:3:11:13 | iscntrl(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:11:3:11:13 | (...) | Argument |
                       +| test.c:12:3:12:13 | isdigit(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:12:3:12:13 | (...) | Argument |
                       +| test.c:13:3:13:13 | isgraph(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:13:3:13:13 | (...) | Argument |
                       +| test.c:14:3:14:13 | islower(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:14:3:14:13 | (...) | Argument |
                       +| test.c:15:3:15:13 | isprint(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:15:3:15:13 | (...) | Argument |
                       +| test.c:16:3:16:13 | ispunct(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:16:3:16:13 | (...) | Argument |
                       +| test.c:17:3:17:13 | isspace(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:17:3:17:13 | (...) | Argument |
                       +| test.c:18:3:18:13 | isupper(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:18:3:18:13 | (...) | Argument |
                       +| test.c:19:3:19:14 | isxdigit(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:19:3:19:14 | (...) | Argument |
                        | test.c:21:3:21:9 | call to toupper | $@ to character-handling function may not be representable as an unsigned char. | test.c:21:11:21:12 | * ... | Argument |
                        | test.c:22:3:22:9 | call to tolower | $@ to character-handling function may not be representable as an unsigned char. | test.c:22:11:22:12 | * ... | Argument |
                       -| test.c:70:3:70:9 | call to isalnum | $@ to character-handling function may not be representable as an unsigned char. | test.c:70:11:70:11 | t | Argument |
                       -| test.c:71:3:71:12 | isalpha(a) | $@ to character-handling function may not be representable as an unsigned char. | test.c:71:11:71:11 | t | Argument |
                       -| test.c:73:3:73:9 | call to isblank | $@ to character-handling function may not be representable as an unsigned char. | test.c:73:11:73:11 | t | Argument |
                       -| test.c:74:3:74:9 | call to iscntrl | $@ to character-handling function may not be representable as an unsigned char. | test.c:74:11:74:11 | t | Argument |
                       -| test.c:75:3:75:12 | isdigit(a) | $@ to character-handling function may not be representable as an unsigned char. | test.c:75:3:75:12 | (...) | Argument |
                       -| test.c:76:3:76:12 | isgraph(a) | $@ to character-handling function may not be representable as an unsigned char. | test.c:76:3:76:12 | (...) | Argument |
                       -| test.c:77:3:77:12 | islower(a) | $@ to character-handling function may not be representable as an unsigned char. | test.c:77:3:77:12 | (...) | Argument |
                       -| test.c:78:3:78:12 | isprint(a) | $@ to character-handling function may not be representable as an unsigned char. | test.c:78:3:78:12 | (...) | Argument |
                       -| test.c:79:3:79:9 | call to ispunct | $@ to character-handling function may not be representable as an unsigned char. | test.c:79:11:79:11 | t | Argument |
                       -| test.c:80:3:80:12 | call to __isspace | $@ to character-handling function may not be representable as an unsigned char. | test.c:80:11:80:11 | t | Argument |
                       -| test.c:81:3:81:12 | isupper(a) | $@ to character-handling function may not be representable as an unsigned char. | test.c:81:3:81:12 | (...) | Argument |
                       -| test.c:82:3:82:10 | call to isxdigit | $@ to character-handling function may not be representable as an unsigned char. | test.c:82:12:82:12 | t | Argument |
                       +| test.c:70:3:70:12 | isalnum(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:70:3:70:12 | (...) | Argument |
                       +| test.c:71:3:71:12 | isalpha(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:71:3:71:12 | (...) | Argument |
                       +| test.c:73:3:73:12 | isblank(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:73:3:73:12 | (...) | Argument |
                       +| test.c:74:3:74:12 | iscntrl(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:74:3:74:12 | (...) | Argument |
                       +| test.c:75:3:75:12 | isdigit(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:75:3:75:12 | (...) | Argument |
                       +| test.c:76:3:76:12 | isgraph(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:76:3:76:12 | (...) | Argument |
                       +| test.c:77:3:77:12 | islower(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:77:3:77:12 | (...) | Argument |
                       +| test.c:78:3:78:12 | isprint(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:78:3:78:12 | (...) | Argument |
                       +| test.c:79:3:79:12 | ispunct(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:79:3:79:12 | (...) | Argument |
                       +| test.c:80:3:80:12 | isspace(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:80:3:80:12 | (...) | Argument |
                       +| test.c:81:3:81:12 | isupper(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:81:3:81:12 | (...) | Argument |
                       +| test.c:82:3:82:13 | isxdigit(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:82:3:82:13 | (...) | Argument |
                        | test.c:84:3:84:9 | call to toupper | $@ to character-handling function may not be representable as an unsigned char. | test.c:84:11:84:11 | t | Argument |
                        | test.c:85:3:85:9 | call to tolower | $@ to character-handling function may not be representable as an unsigned char. | test.c:85:11:85:11 | t | Argument |
                       [1/1 comp 36.7s eval 1.3s] FAILED(RESULT) /__w/codeql-coding-standards-release-engineering/codeql-coding-standards-release-engineering/codeql-coding-standards/c/cert/test/rules/STR37-C/ToCharacterHandlingFunctionsRepresentableAsUChar.qlref
                       
PACKAGE              : Strings2
COMPILE_ERROR_OUTPUT : 
TEST_PASS            : False
SUITE                : CERT-C

COMPILE_PASS         : True
QUERY                : VariablesInsideSwitchStatement
RULE                 : DCL41-C
TEST_DIFFERENCE      : 
PACKAGE              : Declarations2
COMPILE_ERROR_OUTPUT : 
TEST_PASS            : True
SUITE                : CERT-C

COMPILE_PASS         : True
QUERY                : CastCharBeforeConvertingToLargerSizes
RULE                 : STR34-C
TEST_DIFFERENCE      : 
PACKAGE              : Strings3
COMPILE_ERROR_OUTPUT : 
TEST_PASS            : True
SUITE                : CERT-C

COMPILE_PASS         : True
QUERY                : UnusedTagDeclaration
RULE                 : RULE-2-4
TEST_DIFFERENCE      : 
PACKAGE              : DeadCode
COMPILE_ERROR_OUTPUT : 
TEST_PASS            : True
SUITE                : MISRA-C-2012

COMPILE_PASS         : True
QUERY                : UnusedLabelDeclaration
RULE                 : RULE-2-6
TEST_DIFFERENCE      : 
PACKAGE              : DeadCode
COMPILE_ERROR_OUTPUT : 
TEST_PASS            : True
SUITE                : MISRA-C-2012

COMPILE_PASS         : True
QUERY                : DefineAndUndefUsedOnReservedIdentifierOrMacroName
RULE                 : RULE-21-1
TEST_DIFFERENCE      : 
PACKAGE              : Preprocessor4
COMPILE_ERROR_OUTPUT : 
TEST_PASS            : True
SUITE                : MISRA-C-2012

COMPILE_PASS         : True
QUERY                : FunctionTypesNotInPrototypeForm
RULE                 : RULE-8-2
TEST_DIFFERENCE      : 
PACKAGE              : Declarations4
COMPILE_ERROR_OUTPUT : 
TEST_PASS            : True
SUITE                : MISRA-C-2012


@jsinglet
Copy link
Contributor

🤖 Beep Boop! clang/c/x86_64 Matrix Testing for this PR has been completed. See below for the results!


TEST_PASS            : False
PACKAGE              : Strings2
RULE                 : STR37-C
COMPILE_PASS         : True
QUERY                : ToCharacterHandlingFunctionsRepresentableAsUChar
SUITE                : CERT-C
COMPILE_ERROR_OUTPUT : 
TEST_DIFFERENCE      : --- expected
                       +++ actual
                       @@ -1,28 +1,28 @@
                       -| test.c:7:3:7:9 | call to isalnum | $@ to character-handling function may not be representable as an unsigned char. | test.c:7:11:7:12 | * ... | Argument |
                       -| test.c:8:3:8:13 | isalpha(a) | $@ to character-handling function may not be representable as an unsigned char. | test.c:8:11:8:12 | * ... | Argument |
                       -| test.c:10:3:10:9 | call to isblank | $@ to character-handling function may not be representable as an unsigned char. | test.c:10:11:10:12 | * ... | Argument |
                       -| test.c:11:3:11:9 | call to iscntrl | $@ to character-handling function may not be representable as an unsigned char. | test.c:11:11:11:12 | * ... | Argument |
                       -| test.c:12:3:12:13 | isdigit(a) | $@ to character-handling function may not be representable as an unsigned char. | test.c:12:3:12:13 | (...) | Argument |
                       -| test.c:13:3:13:13 | isgraph(a) | $@ to character-handling function may not be representable as an unsigned char. | test.c:13:3:13:13 | (...) | Argument |
                       -| test.c:14:3:14:13 | islower(a) | $@ to character-handling function may not be representable as an unsigned char. | test.c:14:3:14:13 | (...) | Argument |
                       -| test.c:15:3:15:13 | isprint(a) | $@ to character-handling function may not be representable as an unsigned char. | test.c:15:3:15:13 | (...) | Argument |
                       -| test.c:16:3:16:9 | call to ispunct | $@ to character-handling function may not be representable as an unsigned char. | test.c:16:11:16:12 | * ... | Argument |
                       -| test.c:17:3:17:13 | call to __isspace | $@ to character-handling function may not be representable as an unsigned char. | test.c:17:11:17:12 | * ... | Argument |
                       -| test.c:18:3:18:13 | isupper(a) | $@ to character-handling function may not be representable as an unsigned char. | test.c:18:3:18:13 | (...) | Argument |
                       -| test.c:19:3:19:10 | call to isxdigit | $@ to character-handling function may not be representable as an unsigned char. | test.c:19:12:19:13 | * ... | Argument |
                       +| test.c:7:3:7:13 | isalnum(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:7:3:7:13 | (...) | Argument |
                       +| test.c:8:3:8:13 | isalpha(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:8:3:8:13 | (...) | Argument |
                       +| test.c:10:3:10:13 | isblank(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:10:3:10:13 | (...) | Argument |
                       +| test.c:11:3:11:13 | iscntrl(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:11:3:11:13 | (...) | Argument |
                       +| test.c:12:3:12:13 | isdigit(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:12:3:12:13 | (...) | Argument |
                       +| test.c:13:3:13:13 | isgraph(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:13:3:13:13 | (...) | Argument |
                       +| test.c:14:3:14:13 | islower(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:14:3:14:13 | (...) | Argument |
                       +| test.c:15:3:15:13 | isprint(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:15:3:15:13 | (...) | Argument |
                       +| test.c:16:3:16:13 | ispunct(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:16:3:16:13 | (...) | Argument |
                       +| test.c:17:3:17:13 | isspace(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:17:3:17:13 | (...) | Argument |
                       +| test.c:18:3:18:13 | isupper(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:18:3:18:13 | (...) | Argument |
                       +| test.c:19:3:19:14 | isxdigit(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:19:3:19:14 | (...) | Argument |
                        | test.c:21:3:21:9 | call to toupper | $@ to character-handling function may not be representable as an unsigned char. | test.c:21:11:21:12 | * ... | Argument |
                        | test.c:22:3:22:9 | call to tolower | $@ to character-handling function may not be representable as an unsigned char. | test.c:22:11:22:12 | * ... | Argument |
                       -| test.c:70:3:70:9 | call to isalnum | $@ to character-handling function may not be representable as an unsigned char. | test.c:70:11:70:11 | t | Argument |
                       -| test.c:71:3:71:12 | isalpha(a) | $@ to character-handling function may not be representable as an unsigned char. | test.c:71:11:71:11 | t | Argument |
                       -| test.c:73:3:73:9 | call to isblank | $@ to character-handling function may not be representable as an unsigned char. | test.c:73:11:73:11 | t | Argument |
                       -| test.c:74:3:74:9 | call to iscntrl | $@ to character-handling function may not be representable as an unsigned char. | test.c:74:11:74:11 | t | Argument |
                       -| test.c:75:3:75:12 | isdigit(a) | $@ to character-handling function may not be representable as an unsigned char. | test.c:75:3:75:12 | (...) | Argument |
                       -| test.c:76:3:76:12 | isgraph(a) | $@ to character-handling function may not be representable as an unsigned char. | test.c:76:3:76:12 | (...) | Argument |
                       -| test.c:77:3:77:12 | islower(a) | $@ to character-handling function may not be representable as an unsigned char. | test.c:77:3:77:12 | (...) | Argument |
                       -| test.c:78:3:78:12 | isprint(a) | $@ to character-handling function may not be representable as an unsigned char. | test.c:78:3:78:12 | (...) | Argument |
                       -| test.c:79:3:79:9 | call to ispunct | $@ to character-handling function may not be representable as an unsigned char. | test.c:79:11:79:11 | t | Argument |
                       -| test.c:80:3:80:12 | call to __isspace | $@ to character-handling function may not be representable as an unsigned char. | test.c:80:11:80:11 | t | Argument |
                       -| test.c:81:3:81:12 | isupper(a) | $@ to character-handling function may not be representable as an unsigned char. | test.c:81:3:81:12 | (...) | Argument |
                       -| test.c:82:3:82:10 | call to isxdigit | $@ to character-handling function may not be representable as an unsigned char. | test.c:82:12:82:12 | t | Argument |
                       +| test.c:70:3:70:12 | isalnum(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:70:3:70:12 | (...) | Argument |
                       +| test.c:71:3:71:12 | isalpha(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:71:3:71:12 | (...) | Argument |
                       +| test.c:73:3:73:12 | isblank(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:73:3:73:12 | (...) | Argument |
                       +| test.c:74:3:74:12 | iscntrl(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:74:3:74:12 | (...) | Argument |
                       +| test.c:75:3:75:12 | isdigit(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:75:3:75:12 | (...) | Argument |
                       +| test.c:76:3:76:12 | isgraph(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:76:3:76:12 | (...) | Argument |
                       +| test.c:77:3:77:12 | islower(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:77:3:77:12 | (...) | Argument |
                       +| test.c:78:3:78:12 | isprint(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:78:3:78:12 | (...) | Argument |
                       +| test.c:79:3:79:12 | ispunct(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:79:3:79:12 | (...) | Argument |
                       +| test.c:80:3:80:12 | isspace(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:80:3:80:12 | (...) | Argument |
                       +| test.c:81:3:81:12 | isupper(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:81:3:81:12 | (...) | Argument |
                       +| test.c:82:3:82:13 | isxdigit(c) | $@ to character-handling function may not be representable as an unsigned char. | test.c:82:3:82:13 | (...) | Argument |
                        | test.c:84:3:84:9 | call to toupper | $@ to character-handling function may not be representable as an unsigned char. | test.c:84:11:84:11 | t | Argument |
                        | test.c:85:3:85:9 | call to tolower | $@ to character-handling function may not be representable as an unsigned char. | test.c:85:11:85:11 | t | Argument |
                       [1/1 comp 37.8s eval 1.6s] FAILED(RESULT) /__w/codeql-coding-standards-release-engineering/codeql-coding-standards-release-engineering/codeql-coding-standards/c/cert/test/rules/STR37-C/ToCharacterHandlingFunctionsRepresentableAsUChar.qlref
                       

TEST_PASS            : True
PACKAGE              : Declarations2
RULE                 : DCL41-C
COMPILE_PASS         : True
QUERY                : VariablesInsideSwitchStatement
SUITE                : CERT-C
COMPILE_ERROR_OUTPUT : 
TEST_DIFFERENCE      : 

TEST_PASS            : True
PACKAGE              : Strings3
RULE                 : STR34-C
COMPILE_PASS         : True
QUERY                : CastCharBeforeConvertingToLargerSizes
SUITE                : CERT-C
COMPILE_ERROR_OUTPUT : 
TEST_DIFFERENCE      : 

TEST_PASS            : True
PACKAGE              : DeadCode
RULE                 : RULE-2-4
COMPILE_PASS         : True
QUERY                : UnusedTagDeclaration
SUITE                : MISRA-C-2012
COMPILE_ERROR_OUTPUT : 
TEST_DIFFERENCE      : 

TEST_PASS            : True
PACKAGE              : DeadCode
RULE                 : RULE-2-6
COMPILE_PASS         : True
QUERY                : UnusedLabelDeclaration
SUITE                : MISRA-C-2012
COMPILE_ERROR_OUTPUT : 
TEST_DIFFERENCE      : 

TEST_PASS            : True
PACKAGE              : Preprocessor4
RULE                 : RULE-21-1
COMPILE_PASS         : True
QUERY                : DefineAndUndefUsedOnReservedIdentifierOrMacroName
SUITE                : MISRA-C-2012
COMPILE_ERROR_OUTPUT : 
TEST_DIFFERENCE      : 

TEST_PASS            : True
PACKAGE              : Declarations4
RULE                 : RULE-8-2
COMPILE_PASS         : True
QUERY                : FunctionTypesNotInPrototypeForm
SUITE                : MISRA-C-2012
COMPILE_ERROR_OUTPUT : 
TEST_DIFFERENCE      : 


@jsinglet
Copy link
Contributor

🤖 Beep Boop! Matrix Testing for this PR has been completed. If no reports were posted it means this PR does not contain things that need matrix testing!

@github-actions
Copy link

🤖 Beep Boop! Matrix Testing for this PR has been initiated. Please check back later for results.

💡 If you do not hear back from me please check my status! I will report even if this PR does not contain files eligible for matrix testing.

@jsinglet
Copy link
Contributor

🤖 Beep Boop! clang/cpp/x86_64 Matrix Testing for this PR has been completed but I didn't find anything to test!

@jsinglet
Copy link
Contributor

🤖 Beep Boop! gcc/cpp/x86_64 Matrix Testing for this PR has been completed but I didn't find anything to test!

@jsinglet
Copy link
Contributor

🤖 Beep Boop! clang/c/x86_64 Matrix Testing for this PR has been completed. See below for the results!


TEST_DIFFERENCE      : 
TEST_PASS            : True
RULE                 : STR37-C
QUERY                : ToCharacterHandlingFunctionsRepresentableAsUChar
COMPILE_PASS         : True
PACKAGE              : Strings2
COMPILE_ERROR_OUTPUT : 
SUITE                : CERT-C

TEST_DIFFERENCE      : 
TEST_PASS            : True
RULE                 : DCL41-C
QUERY                : VariablesInsideSwitchStatement
COMPILE_PASS         : True
PACKAGE              : Declarations2
COMPILE_ERROR_OUTPUT : 
SUITE                : CERT-C

TEST_DIFFERENCE      : 
TEST_PASS            : True
RULE                 : STR34-C
QUERY                : CastCharBeforeConvertingToLargerSizes
COMPILE_PASS         : True
PACKAGE              : Strings3
COMPILE_ERROR_OUTPUT : 
SUITE                : CERT-C

TEST_DIFFERENCE      : 
TEST_PASS            : True
RULE                 : RULE-2-4
QUERY                : UnusedTagDeclaration
COMPILE_PASS         : True
PACKAGE              : DeadCode
COMPILE_ERROR_OUTPUT : 
SUITE                : MISRA-C-2012

TEST_DIFFERENCE      : 
TEST_PASS            : True
RULE                 : RULE-2-6
QUERY                : UnusedLabelDeclaration
COMPILE_PASS         : True
PACKAGE              : DeadCode
COMPILE_ERROR_OUTPUT : 
SUITE                : MISRA-C-2012

TEST_DIFFERENCE      : 
TEST_PASS            : True
RULE                 : RULE-21-1
QUERY                : DefineAndUndefUsedOnReservedIdentifierOrMacroName
COMPILE_PASS         : True
PACKAGE              : Preprocessor4
COMPILE_ERROR_OUTPUT : 
SUITE                : MISRA-C-2012

TEST_DIFFERENCE      : 
TEST_PASS            : True
RULE                 : RULE-8-2
QUERY                : FunctionTypesNotInPrototypeForm
COMPILE_PASS         : True
PACKAGE              : Declarations4
COMPILE_ERROR_OUTPUT : 
SUITE                : MISRA-C-2012


@jsinglet
Copy link
Contributor

🤖 Beep Boop! gcc/c/x86_64 Matrix Testing for this PR has been completed. See below for the results!


TEST_PASS            : True
RULE                 : STR37-C
QUERY                : ToCharacterHandlingFunctionsRepresentableAsUChar
TEST_DIFFERENCE      : 
COMPILE_PASS         : True
SUITE                : CERT-C
COMPILE_ERROR_OUTPUT : 
PACKAGE              : Strings2

TEST_PASS            : True
RULE                 : DCL41-C
QUERY                : VariablesInsideSwitchStatement
TEST_DIFFERENCE      : 
COMPILE_PASS         : True
SUITE                : CERT-C
COMPILE_ERROR_OUTPUT : 
PACKAGE              : Declarations2

TEST_PASS            : True
RULE                 : STR34-C
QUERY                : CastCharBeforeConvertingToLargerSizes
TEST_DIFFERENCE      : 
COMPILE_PASS         : True
SUITE                : CERT-C
COMPILE_ERROR_OUTPUT : 
PACKAGE              : Strings3

TEST_PASS            : True
RULE                 : RULE-2-4
QUERY                : UnusedTagDeclaration
TEST_DIFFERENCE      : 
COMPILE_PASS         : True
SUITE                : MISRA-C-2012
COMPILE_ERROR_OUTPUT : 
PACKAGE              : DeadCode

TEST_PASS            : True
RULE                 : RULE-2-6
QUERY                : UnusedLabelDeclaration
TEST_DIFFERENCE      : 
COMPILE_PASS         : True
SUITE                : MISRA-C-2012
COMPILE_ERROR_OUTPUT : 
PACKAGE              : DeadCode

TEST_PASS            : True
RULE                 : RULE-21-1
QUERY                : DefineAndUndefUsedOnReservedIdentifierOrMacroName
TEST_DIFFERENCE      : 
COMPILE_PASS         : True
SUITE                : MISRA-C-2012
COMPILE_ERROR_OUTPUT : 
PACKAGE              : Preprocessor4

TEST_PASS            : True
RULE                 : RULE-8-2
QUERY                : FunctionTypesNotInPrototypeForm
TEST_DIFFERENCE      : 
COMPILE_PASS         : True
SUITE                : MISRA-C-2012
COMPILE_ERROR_OUTPUT : 
PACKAGE              : Declarations4


@jsinglet
Copy link
Contributor

🤖 Beep Boop! Matrix Testing for this PR has been completed. If no reports were posted it means this PR does not contain things that need matrix testing!

Copy link
Contributor

@jsinglet jsinglet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @lcartey! Make sure to close the backing issues before/after merging!

@jsinglet jsinglet added this pull request to the merge queue Mar 13, 2023
Merged via the queue into main with commit 466eae8 Mar 13, 2023
@jsinglet jsinglet deleted the lcartey/c-compat-fixes-2 branch March 13, 2023 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

STR37-C: <ctype> functions implemented as macros not properly detected
2 participants