Skip to content

Commit

Permalink
deprecated platform types win32A and win32W in favor of win32a
Browse files Browse the repository at this point in the history
…and `win32w`
  • Loading branch information
firewave committed Mar 4, 2023
1 parent a00b6e1 commit f87d9ad
Show file tree
Hide file tree
Showing 11 changed files with 376 additions and 347 deletions.
656 changes: 328 additions & 328 deletions cfg/windows.cfg

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions cli/cmdlineparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1039,7 +1039,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
Expand Down Expand Up @@ -1215,9 +1215,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"
Expand Down
2 changes: 1 addition & 1 deletion gui/projectfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 10 additions & 2 deletions lib/platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,17 @@ bool cppcheck::Platform::set(Type t)

bool cppcheck::Platform::set(const std::string& platformstr, std::string& errstr, const std::vector<std::string>& paths, bool verbose)
{
if (platformstr == "win32A")
if (platformstr == "win32A") {
std::cout << "Platform 'win32A' is deprecated. 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. Please use 'win32w' instead." << std::endl;
set(Type::Win32W);
}
else if (platformstr == "win32w")
set(Type::Win32W);
else if (platformstr == "win64")
set(Type::Win64);
Expand Down
4 changes: 2 additions & 2 deletions lib/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion man/cppcheck.1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ There are false positives with this option. Each result must be carefully invest
</term>
<listitem>
<para>Specifies platform specific types and sizes.The available platforms are:
<glosslist><glossentry><glossterm>unix32</glossterm><glossdef><para>32 bit unix variant</para></glossdef></glossentry><glossentry><glossterm>unix64</glossterm><glossdef><para>64 bit unix variant</para></glossdef></glossentry><glossentry><glossterm>win32A</glossterm><glossdef><para>32 bit Windows ASCII character encoding</para></glossdef></glossentry><glossentry><glossterm>win32W</glossterm><glossdef><para>32 bit Windows UNICODE character encoding</para></glossdef></glossentry><glossentry><glossterm>win64</glossterm><glossdef><para>64 bit Windows</para></glossdef></glossentry></glosslist>
<glosslist><glossentry><glossterm>unix32</glossterm><glossdef><para>32 bit unix variant</para></glossdef></glossentry><glossentry><glossterm>unix64</glossterm><glossdef><para>64 bit unix variant</para></glossdef></glossentry><glossentry><glossterm>win32a</glossterm><glossdef><para>32 bit Windows ASCII character encoding</para></glossdef></glossentry><glossentry><glossterm>win32w</glossterm><glossdef><para>32 bit Windows UNICODE character encoding</para></glossdef></glossentry><glossentry><glossterm>win64</glossterm><glossdef><para>64 bit Windows</para></glossdef></glossentry></glosslist>
By default the platform which was used to compile Cppcheck is used.
</para>
</listitem>
Expand Down
3 changes: 2 additions & 1 deletion releasenotes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ release notes for cppcheck-2.11
- The platform type 'Unspecified' within .cppcheck projects has been deprecated and will be removed in Cppcheck 2.14. Please use 'unspecified' instead.
- It is no longer necessary to run "--check-config" to get detailed "missingInclude" and "missingIncludeSystem" messages. They will always be issued in the regular analysis if "missingInclude" is enabled.
- "missingInclude" and "missingIncludeSystem" are reported with "-j" is > 1 and processes are used in the backend (default in non-Windows binaries)
- "missingInclude" and "missingIncludeSystem" will now cause the "--error-exitcode" to be applied
- "missingInclude" and "missingIncludeSystem" will now cause the "--error-exitcode" to be applied
- The platform types 'Win32A' and 'Win32W' has been deprecated and will be removed in Cppcheck 2.14. Please use 'win32a' and 'win32w' respectively.
4 changes: 2 additions & 2 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,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)

Expand Down
4 changes: 2 additions & 2 deletions test/cfg/runtests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -499,8 +499,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)
Expand Down
22 changes: 21 additions & 1 deletion test/testcmdlineparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,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);
Expand Down Expand Up @@ -998,6 +1000,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. 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(Settings::Win32A, settings.platformType);
ASSERT_EQUALS("", GET_REDIRECT_OUTPUT);
}

Expand All @@ -1006,6 +1017,15 @@ class TestCmdlineParser : public TestFixture {
const char * const argv[] = {"cppcheck", "--platform=win32W", "file.cpp"};
ASSERT(settings.platform.set(cppcheck::Platform::Type::Unspecified));
ASSERT(defParser.parseFromArgs(3, argv));
ASSERT_EQUALS(Settings::Win32W, settings.platformType);
ASSERT_EQUALS("Platform 'win32W' is deprecated. 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);
}
Expand Down Expand Up @@ -1094,7 +1114,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;
Expand Down
8 changes: 4 additions & 4 deletions test/testtokenize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5433,10 +5433,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() {
Expand Down

0 comments on commit f87d9ad

Please sign in to comment.