checksrc: ensure using ifdef/ifndef when possible, fix fallouts

Follow-up to 89771d19d5 #18018

Closes #20065
This commit is contained in:
Viktor Szakats 2025-12-21 15:45:53 +01:00
parent e8415a8296
commit 4ad87f2cb8
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
9 changed files with 30 additions and 11 deletions

View file

@ -79,6 +79,13 @@ void startfunc(int a, int b) {
if(sprintf(buffer, "%s", moo)) {}
*buffer_len = (ssize_t)alsobad((char *)buffer, NULL, 16);
# if defined(SINGLE_MACRO)
#if ! defined(__macro_10)
#elif !defined(TESTMACRO)
#endif
#endif
#endif
// CPP comment ?
/* comment does not end
@ -205,7 +212,13 @@ void startfunc(int a, int b) {
./%LOGDIR/code1185.c:62:25: warning: use of alsobad is banned (BANNEDFUNC)
*buffer_len = (ssize_t)alsobad((char *)buffer, NULL, 16);
^
./%LOGDIR/code1185.c:64:2: warning: // comment (CPPCOMMENTS)
./%LOGDIR/code1185.c:64:1: warning: use ifdef/ifndef for single macro checks (IFDEFSINGLE)
# if defined(SINGLE_MACRO)
^
./%LOGDIR/code1185.c:65:1: warning: use ifdef/ifndef for single macro checks (IFDEFSINGLE)
#if ! defined(__macro_10)
^
./%LOGDIR/code1185.c:71:2: warning: // comment (CPPCOMMENTS)
// CPP comment ?
^
./%LOGDIR/code1185.c:1:1: error: Missing copyright statement (COPYRIGHT)
@ -214,7 +227,7 @@ void startfunc(int a, int b) {
./%LOGDIR/code1185.c:1:1: error: Missing closing comment (OPENCOMMENT)
%SP
^
checksrc: 0 errors and 42 warnings
checksrc: 0 errors and 44 warnings
</stdout>
<errorcode>
5