diff --git a/cfg/windows.cfg b/cfg/windows.cfg index 8b4b19d6a718..5ac8429cc1a2 100644 --- a/cfg/windows.cfg +++ b/cfg/windows.cfg @@ -1,112 +1,112 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + @@ -114,308 +114,308 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + @@ -423,53 +423,53 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + @@ -477,13 +477,13 @@ - - + + - - + + @@ -492,106 +492,106 @@ - - + + - - + + - - + + - - + + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - + - - + + - - + + - - + + - - + + @@ -599,227 +599,227 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + @@ -828,13 +828,13 @@ - - + + - - + + @@ -842,43 +842,43 @@ - + - + - + - + - + - + - - + + - - + + - - + + @@ -886,45 +886,45 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - + + @@ -934,55 +934,55 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + @@ -991,48 +991,48 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + diff --git a/cli/cmdlineparser.cpp b/cli/cmdlineparser.cpp index 0eff7248e196..1e680f6d2f3e 100644 --- a/cli/cmdlineparser.cpp +++ b/cli/cmdlineparser.cpp @@ -1046,7 +1046,7 @@ bool CmdLineParser::parseFromArgs(int argc, const char* const argv[]) printMessage("Windows 64-bit binaries currently default to the 'win64' platform. Starting with Cppcheck 2.13 they will default to 'native' instead. Please specify '--platform=win64' explicitly if you rely on this."); #elif defined(_WIN32) if (SHOW_DEF_PLATFORM_MSG && default_platform) - printMessage("Windows 32-bit binaries currently default to the 'win32A' platform. Starting with Cppcheck 2.13 they will default to 'native' instead. Please specify '--platform=win32A' explicitly if you rely on this."); + printMessage("Windows 32-bit binaries currently default to the 'win32a' platform. Starting with Cppcheck 2.13 they will default to 'native' instead. Please specify '--platform=win32a' explicitly if you rely on this."); #endif // Print error only if we have "real" command and expect files @@ -1229,9 +1229,9 @@ void CmdLineParser::printHelp() " 32 bit unix variant\n" " * unix64\n" " 64 bit unix variant\n" - " * win32A\n" + " * win32a\n" " 32 bit Windows ASCII character encoding\n" - " * win32W\n" + " * win32w\n" " 32 bit Windows UNICODE character encoding\n" " * win64\n" " 64 bit Windows\n" diff --git a/gui/projectfile.h b/gui/projectfile.h index 3fd3f6a08a1d..4678f9ee4337 100644 --- a/gui/projectfile.h +++ b/gui/projectfile.h @@ -159,7 +159,7 @@ class ProjectFile : public QObject { /** * @brief Get platform. - * @return Current platform. If it ends with .xml then it is a file. Otherwise it must match one of the return values from @sa cppcheck::Platform::toString() ("win32A", "unix32", ..) + * @return Current platform. If it ends with .xml then it is a file. Otherwise it must match one of the return values from @sa cppcheck::Platform::toString() ("win32a", "unix32", ..) */ QString getPlatform() const { return mPlatform; diff --git a/lib/platform.cpp b/lib/platform.cpp index cf6235c90c63..29036999f423 100644 --- a/lib/platform.cpp +++ b/lib/platform.cpp @@ -159,9 +159,17 @@ bool cppcheck::Platform::set(Type t) bool cppcheck::Platform::set(const std::string& platformstr, std::string& errstr, const std::vector& paths, bool verbose) { - if (platformstr == "win32A") + if (platformstr == "win32A") { + std::cout << "Platform 'win32A' is deprecated and will be removed in Cppcheck 2.14. Please use 'win32a' instead." << std::endl; set(Type::Win32A); - else if (platformstr == "win32W") + } + else if (platformstr == "win32a") + set(Type::Win32A); + else if (platformstr == "win32W") { + std::cout << "Platform 'win32W' is deprecated and will be removed in Cppcheck 2.14. Please use 'win32w' instead." << std::endl; + set(Type::Win32W); + } + else if (platformstr == "win32w") set(Type::Win32W); else if (platformstr == "win64") set(Type::Win64); diff --git a/lib/platform.h b/lib/platform.h index 6d9833240d2f..b2dc43369fa8 100644 --- a/lib/platform.h +++ b/lib/platform.h @@ -153,9 +153,9 @@ namespace cppcheck { case Type::Native: return "native"; case Type::Win32A: - return "win32A"; + return "win32a"; case Type::Win32W: - return "win32W"; + return "win32w"; case Type::Win64: return "win64"; case Type::Unix32: diff --git a/man/cppcheck.1.xml b/man/cppcheck.1.xml index dd968ed26945..c45a80d29491 100644 --- a/man/cppcheck.1.xml +++ b/man/cppcheck.1.xml @@ -486,7 +486,7 @@ There are false positives with this option. Each result must be carefully invest Specifies platform specific types and sizes.The available platforms are: - unix3232 bit unix variantunix6464 bit unix variantwin32A32 bit Windows ASCII character encodingwin32W32 bit Windows UNICODE character encodingwin6464 bit Windows + unix3232 bit unix variantunix6464 bit unix variantwin32a32 bit Windows ASCII character encodingwin32w32 bit Windows UNICODE character encodingwin6464 bit Windows By default the platform which was used to compile Cppcheck is used. diff --git a/releasenotes.txt b/releasenotes.txt index e9eaafa6bc39..5392afdada7e 100644 --- a/releasenotes.txt +++ b/releasenotes.txt @@ -12,4 +12,4 @@ release notes for cppcheck-2.11 - `constVariable` - `constVariableReference` - `constVariablePointer` - +- The platform types 'Win32A' and 'Win32W' has been deprecated and will be removed in Cppcheck 2.14. Please use 'win32a' and 'win32w' respectively. diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 371654bb5796..e292b4d746e3 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -151,8 +151,8 @@ if (BUILD_TESTS) add_cfg(sqlite3.c) add_cfg(std.c) add_cfg(std.cpp) - add_cfg(windows.cpp NAME windows32A PLATFORM win32A) - add_cfg(windows.cpp NAME windows32W PLATFORM win32W) + add_cfg(windows.cpp NAME windows32A PLATFORM win32a) + add_cfg(windows.cpp NAME windows32W PLATFORM win32w) add_cfg(windows.cpp NAME windows64 PLATFORM win64) add_cfg(wxwidgets.cpp) diff --git a/test/cfg/runtests.sh b/test/cfg/runtests.sh index 30563dc9934c..f5774b7c75e7 100755 --- a/test/cfg/runtests.sh +++ b/test/cfg/runtests.sh @@ -500,8 +500,8 @@ function check_file { ;; windows.cpp) windows_fn - ${CPPCHECK} ${CPPCHECK_OPT} --platform=win32A --library=$lib ${DIR}$f - ${CPPCHECK} ${CPPCHECK_OPT} --platform=win32W --library=$lib ${DIR}$f + ${CPPCHECK} ${CPPCHECK_OPT} --platform=win32a --library=$lib ${DIR}$f + ${CPPCHECK} ${CPPCHECK_OPT} --platform=win32w --library=$lib ${DIR}$f ${CPPCHECK} ${CPPCHECK_OPT} --platform=win64 --library=$lib ${DIR}$f ;; wxwidgets.cpp) diff --git a/test/testcmdlineparser.cpp b/test/testcmdlineparser.cpp index 36776694044e..fc4794c994b1 100644 --- a/test/testcmdlineparser.cpp +++ b/test/testcmdlineparser.cpp @@ -136,7 +136,9 @@ class TestCmdlineParser : public TestFixture { TEST_CASE(stdunknown); TEST_CASE(platformWin64); TEST_CASE(platformWin32A); + TEST_CASE(platformWin32a); TEST_CASE(platformWin32W); + TEST_CASE(platformWin32w); TEST_CASE(platformUnix32); TEST_CASE(platformUnix32Unsigned); TEST_CASE(platformUnix64); @@ -1031,6 +1033,15 @@ class TestCmdlineParser : public TestFixture { ASSERT(settings.platform.set(cppcheck::Platform::Type::Unspecified)); ASSERT(defParser.parseFromArgs(3, argv)); ASSERT_EQUALS(cppcheck::Platform::Type::Win32A, settings.platform.type); + ASSERT_EQUALS("Platform 'win32A' is deprecated and will be removed in Cppcheck 2.14. Please use 'win32a' instead.\n", GET_REDIRECT_OUTPUT); + } + + void platformWin32a() { + REDIRECT; + const char * const argv[] = {"cppcheck", "--platform=win32a", "file.cpp"}; + ASSERT(settings.platform.set(cppcheck::Platform::Type::Unspecified)); + ASSERT(defParser.parseFromArgs(3, argv)); + ASSERT_EQUALS(cppcheck::Platform::Type::Win32A, settings.platform.type); ASSERT_EQUALS("", GET_REDIRECT_OUTPUT); } @@ -1040,6 +1051,15 @@ class TestCmdlineParser : public TestFixture { ASSERT(settings.platform.set(cppcheck::Platform::Type::Unspecified)); ASSERT(defParser.parseFromArgs(3, argv)); ASSERT_EQUALS(cppcheck::Platform::Type::Win32W, settings.platform.type); + ASSERT_EQUALS("Platform 'win32W' is deprecated and will be removed in Cppcheck 2.14. Please use 'win32w' instead.\n", GET_REDIRECT_OUTPUT); + } + + void platformWin32w() { + REDIRECT; + const char * const argv[] = {"cppcheck", "--platform=win32w", "file.cpp"}; + ASSERT(settings.platform.set(cppcheck::Platform::Type::Unspecified)); + ASSERT(defParser.parseFromArgs(3, argv)); + ASSERT_EQUALS(cppcheck::Platform::Type::Win32W, settings.platform.type); ASSERT_EQUALS("", GET_REDIRECT_OUTPUT); } @@ -1127,7 +1147,7 @@ class TestCmdlineParser : public TestFixture { ASSERT_EQUALS("cppcheck: Windows 64-bit binaries currently default to the 'win64' platform. Starting with Cppcheck 2.13 they will default to 'native' instead. Please specify '--platform=win64' explicitly if you rely on this.\n", GET_REDIRECT_OUTPUT); #elif defined(_WIN32) ASSERT_EQUALS(cppcheck::Platform::Type::Win32A, settings.platform.type); - ASSERT_EQUALS("cppcheck: Windows 32-bit binaries currently default to the 'win32A' platform. Starting with Cppcheck 2.13 they will default to 'native' instead. Please specify '--platform=win32A' explicitly if you rely on this.\n", GET_REDIRECT_OUTPUT); + ASSERT_EQUALS("cppcheck: Windows 32-bit binaries currently default to the 'win32a' platform. Starting with Cppcheck 2.13 they will default to 'native' instead. Please specify '--platform=win32a' explicitly if you rely on this.\n", GET_REDIRECT_OUTPUT); #endif CmdLineParser::SHOW_DEF_PLATFORM_MSG = false; diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index fbd036a1cfea..8e8eef617903 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -5442,10 +5442,10 @@ class TestTokenizer : public TestFixture { "float * ptrToFloat ;"; // These types should be defined the same on all Windows platforms - const std::string win32A = tokenizeAndStringifyWindows(code, true, cppcheck::Platform::Type::Win32A); - ASSERT_EQUALS(expected, win32A); - ASSERT_EQUALS(win32A, tokenizeAndStringifyWindows(code, true, cppcheck::Platform::Type::Win32W)); - ASSERT_EQUALS(win32A, tokenizeAndStringifyWindows(code, true, cppcheck::Platform::Type::Win64)); + const std::string win32a = tokenizeAndStringifyWindows(code, true, cppcheck::Platform::Type::Win32A); + ASSERT_EQUALS(expected, win32a); + ASSERT_EQUALS(win32a, tokenizeAndStringifyWindows(code, true, cppcheck::Platform::Type::Win32W)); + ASSERT_EQUALS(win32a, tokenizeAndStringifyWindows(code, true, cppcheck::Platform::Type::Win64)); } void platformWin32A() {