Skip to content

Commit

Permalink
Fix format issues
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelRFairhurst committed Jan 16, 2025
1 parent bd3e06b commit a5eb426
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
15 changes: 7 additions & 8 deletions c/misra/src/codingstandards/c/misra/EssentialTypes.qll
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,7 @@ class EssentialBinaryArithmeticExpr extends EssentialExpr, BinaryArithmeticOpera
exists(
Type leftEssentialType, Type rightEssentialType,
EssentialTypeCategory leftEssentialTypeCategory,
EssentialTypeCategory rightEssentialTypeCategory,
int intTypeSize
EssentialTypeCategory rightEssentialTypeCategory, int intTypeSize
|
leftEssentialType = getEssentialType(getLeftOperand()) and
rightEssentialType = getEssentialType(getRightOperand()) and
Expand Down Expand Up @@ -340,19 +339,19 @@ class EssentialBinaryArithmeticExpr extends EssentialExpr, BinaryArithmeticOpera
) and
(
leftEssentialTypeCategory =
[EssentiallySignedType(), EssentiallyUnsignedType().(TEssentialTypeCategory)]
and leftEssentialType.getSize() <= intTypeSize
[EssentiallySignedType(), EssentiallyUnsignedType().(TEssentialTypeCategory)] and
leftEssentialType.getSize() <= intTypeSize
or
rightEssentialTypeCategory =
[EssentiallySignedType(), EssentiallyUnsignedType().(TEssentialTypeCategory)]
and rightEssentialType.getSize() <= intTypeSize
[EssentiallySignedType(), EssentiallyUnsignedType().(TEssentialTypeCategory)] and
rightEssentialType.getSize() <= intTypeSize
)
or
this instanceof SubExpr and
leftEssentialTypeCategory = EssentiallyCharacterType() and
rightEssentialTypeCategory =
[EssentiallySignedType(), EssentiallyUnsignedType().(TEssentialTypeCategory)]
and rightEssentialType.getSize() <= intTypeSize
[EssentiallySignedType(), EssentiallyUnsignedType().(TEssentialTypeCategory)] and
rightEssentialType.getSize() <= intTypeSize
then result instanceof PlainCharType
else result = this.getStandardType()
)
Expand Down
2 changes: 1 addition & 1 deletion c/misra/test/rules/RULE-7-4/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void w_call6() {
w_sample6(1, "string10"); // COMPLIANT by first (and only) exception
}

void w_sample7(char* x, ...) {}
void w_sample7(char *x, ...) {}

void w_call7() {
w_sample7("string11", 1); // NON_COMPLIANT, does not fit exceptional case
Expand Down
6 changes: 3 additions & 3 deletions cpp/common/test/rules/invalidatedenvstringpointers/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,18 +211,18 @@ void f11(void) {
void f12(void) {
time_t rawtime;
time(&rawtime);
char* r1 = ctime(&rawtime);
char *r1 = ctime(&rawtime);
asctime(localtime(&rawtime));
printf("%s", r1); // NON_COMPLIANT
}

void f13(void) {
time_t rawtime;
time(&rawtime);
char* r1 = ctime(&rawtime);
char *r1 = ctime(&rawtime);
printf("%s", r1); // COMPLIANT

char* r2 = asctime(localtime(&rawtime));
char *r2 = asctime(localtime(&rawtime));
printf("%s", r1); // NON_COMPLIANT
printf("%s", r2); // COMPLIANT

Expand Down

0 comments on commit a5eb426

Please sign in to comment.