F:\Libs\notepad2\src>cppcheck Dialogs.c
Checking Dialogs.c ...
Dialogs.c:260:37: error: There is an unknown macro here somewhere. Configuration is required. If TEXT is a macro then please configure it. [unknownMacro]
SetDlgItemText(hwnd, IDC_VERSION, VERSION_FILEVERSION_LONG);
^
Checking Dialogs.c: APSTUDIO_INVOKED...
Checking Dialogs.c: NP2_FORCE_COMPILE_C_AS_CPP=0...
Checking Dialogs.c: VERSION_BUILD_TOOL_BUILD...
Checking Dialogs.c: _ARM64_;_M_ARM64;__aarch64__;_WIN64...
Checking Dialogs.c: _ARM_;_M_ARM;__arm__...
Checking Dialogs.c: _IA64_;_M_IA64;__ia64__;_WIN64...
Checking Dialogs.c: _MSC_VER...
Checking Dialogs.c: _WIN64...
Checking Dialogs.c: _WIN64;__AVX2__...
Checking Dialogs.c: __GNUC__...
Checking Dialogs.c: __GNUC__;__NO_INLINE__...
nofile:0:0: information: Too many #ifdef configurations - cppcheck only checks 12 configurations. Use --force to check all configurations. For more details, use --enable=information. [toomanyconfigs]
cppcheck.exe test.c
Checking test.c ...
test.c:9:25: error: There is an unknown macro here somewhere. Configuration is required. If TEXT is a macro then please configure it. [unknownMacro]
SetWindowText(hwnd, VERSION_TEXT);
it works after delete L"prefix" or L"suffix" from VERSION_TEXT.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
test.c works with Cppcheck 1.90, this is a regression change between 1.90 and 2.00.
For Notepad2, Cppcheck 1.90 only has the AST broken error, no unknownMacro for TEXT.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The sample file is at https://github.com/zufuliu/notepad2/blob/master/src/Dialogs.c#L260
where
VERSION_FILEVERSION_LONG
is defiend at https://github.com/zufuliu/notepad2/blob/master/src/Version.h#L94however, directly use
SetDlgItemText(hwnd, TEXT("string"))
works.reduced test case:
it works after delete
L"prefix"
orL"suffix"
fromVERSION_TEXT
.Please try
--library=windows
.If you use visual studio then I would suggest that you use the solution/project files for that ..
For instance:
cppcheck --project=notepad2.sln
I have the feeling that
--library=windows
is not needed then.Both not works, that's why I try clang.
following is https://github.com/zufuliu/notepad2/blob/master/Notepad2.cppcheck
test.c works with Cppcheck 1.90, this is a regression change between 1.90 and 2.00.
For Notepad2, Cppcheck 1.90 only has the AST broken error, no unknownMacro for TEXT.
ok I tried that also now.. and I can reproduce, this is not working well. :-(
I have created this Trac ticket: https://trac.cppcheck.net/ticket/9730