Skip to content

Commit

Permalink
Fix clang-tidy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jarun committed Apr 28, 2024
1 parent 31193bc commit 548e8bb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
Checks: 'clang-diagnostic-*,clang-analyzer-*,readability-*,modernize-*,bugprone-*,misc-*,-misc-unused-parameters,google-runtime-int,-llvm-header-guard,fuchsia-restrict-system-includes,-clang-analyzer-valist.Uninitialized,-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,-clang-analyzer-security.insecureAPI.rand,-clang-analyzer-alpha.*,-readability-magic-numbers,-readability-braces-around-statements,-readability-function-cognitive-complexity,-readability-isolate-declaration,-readability-identifier-length,-bugprone-easily-swappable-parameters,-modernize-macro-to-enum'
Checks: 'clang-diagnostic-*,clang-analyzer-*,readability-*,modernize-*,bugprone-*,misc-*,-misc-unused-parameters,google-runtime-int,-llvm-header-guard,fuchsia-restrict-system-includes,-clang-analyzer-valist.Uninitialized,-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,-clang-analyzer-security.insecureAPI.rand,-clang-analyzer-alpha.*,-misc-include-cleaner,-readability-magic-numbers,-readability-braces-around-statements,-readability-function-cognitive-complexity,-readability-isolate-declaration,-readability-identifier-length,-bugprone-easily-swappable-parameters,-modernize-macro-to-enum'
WarningsAsErrors: '*'
HeaderFilterRegex: '.*(?<!lookup3.c)$'
FormatStyle: 'file'
Expand Down
4 changes: 2 additions & 2 deletions inc/dslib.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ static void cleanqueue(queue **front)
}
}

#if 0
/*
static void printstack(stack *top)
{
stack *i;
Expand Down Expand Up @@ -154,4 +154,4 @@ static void printqueue(queue *front)
printf("\n");
}
#endif
*/
14 changes: 9 additions & 5 deletions src/bcal.c
Original file line number Diff line number Diff line change
Expand Up @@ -1333,6 +1333,7 @@ static int priority(char sign) /* Get the priority of operators, higher priprity
case '%':
case '/':
case '*': return 6;
default : return 0;
}

return 0;
Expand Down Expand Up @@ -1553,6 +1554,8 @@ static maxuint_t eval(queue **front, queue **rear, int *out)
case '^':
c = a ^ b;
break;
default:
break;
}

if (raw_a.unit)
Expand Down Expand Up @@ -1624,7 +1627,8 @@ static maxuint_t eval(queue **front, queue **rear, int *out)
break;
}

log(ERROR, "unit mismatch in modulo\n");
log(ERROR, "unit mismatch in modulo\n"); // fallthrough
default:
goto error;
}

Expand Down Expand Up @@ -1701,8 +1705,8 @@ static int isoperator(int c)
}
}

#if 0
/* Check if valid storage arithmetic expression */
/*
static int checkexp(char *exp)
{
while (*exp) {
Expand All @@ -1714,7 +1718,7 @@ static int checkexp(char *exp)
return 0;
}
#endif
*/

/* Trim ending newline and whitespace from both ends, in place */
static void strstrip(char *s)
Expand Down Expand Up @@ -1772,13 +1776,13 @@ static char *fixexpr(char *exp, int *unitless)
strstrip(exp);
removeinnerspaces(exp);

#if 0
/*
if (!checkexp(exp)) {
log(DEBUG, "no unit in expression [%s]\n", exp);
*unitless = 1;
return NULL;
}
#endif
*/

int i = 0, j = 0;
char *parsed = (char *)calloc(1, 2 * strlen(exp) * sizeof(char));
Expand Down

0 comments on commit 548e8bb

Please sign in to comment.