Skip to content

Commit ead1b9e

Browse files
committed
deprecated platform types win32A and win32W in favor of win32a and win32w
1 parent 14833a4 commit ead1b9e

11 files changed

+373
-345
lines changed

cfg/windows.cfg

+328-328
Large diffs are not rendered by default.

cli/cmdlineparser.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1500,9 +1500,9 @@ void CmdLineParser::printHelp() const
15001500
" 32 bit unix variant\n"
15011501
" * unix64\n"
15021502
" 64 bit unix variant\n"
1503-
" * win32A\n"
1503+
" * win32a\n"
15041504
" 32 bit Windows ASCII character encoding\n"
1505-
" * win32W\n"
1505+
" * win32w\n"
15061506
" 32 bit Windows UNICODE character encoding\n"
15071507
" * win64\n"
15081508
" 64 bit Windows\n"

gui/projectfile.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ class ProjectFile : public QObject {
165165

166166
/**
167167
* @brief Get platform.
168-
* @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", ..)
168+
* @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", ..)
169169
*/
170170
QString getPlatform() const {
171171
return mPlatform;

lib/platform.cpp

+10-2
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,17 @@ bool Platform::set(Type t)
152152

153153
bool Platform::set(const std::string& platformstr, std::string& errstr, const std::vector<std::string>& paths, bool verbose)
154154
{
155-
if (platformstr == "win32A")
155+
if (platformstr == "win32A") {
156+
std::cout << "Platform 'win32A' is deprecated and will be removed in a future version. Please use 'win32a' instead." << std::endl;
156157
set(Type::Win32A);
157-
else if (platformstr == "win32W")
158+
}
159+
else if (platformstr == "win32a")
160+
set(Type::Win32A);
161+
else if (platformstr == "win32W") {
162+
std::cout << "Platform 'win32W' is deprecated and will be removed in a future version. Please use 'win32w' instead." << std::endl;
163+
set(Type::Win32W);
164+
}
165+
else if (platformstr == "win32w")
158166
set(Type::Win32W);
159167
else if (platformstr == "win64")
160168
set(Type::Win64);

lib/platform.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,9 @@ class CPPCHECKLIB Platform {
155155
case Type::Native:
156156
return "native";
157157
case Type::Win32A:
158-
return "win32A";
158+
return "win32a";
159159
case Type::Win32W:
160-
return "win32W";
160+
return "win32w";
161161
case Type::Win64:
162162
return "win64";
163163
case Type::Unix32:

man/cppcheck.1.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ There are false positives with this option. Each result must be carefully invest
511511
</term>
512512
<listitem>
513513
<para>Specifies platform specific types and sizes.The available platforms are:
514-
<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>
514+
<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>
515515
By default the platform which was used to compile Cppcheck is used.
516516
</para>
517517
</listitem>

releasenotes.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Changed interface:
1313
-
1414

1515
Deprecations:
16-
-
16+
- The platform types 'Win32A' and 'Win32W' have been deprecated and will be removed in a future version. Please use 'win32a' and 'win32w' respectively.
1717

1818
Other:
1919
- Added CMake option 'EXTERNALS_AS_SYSTEM' to treat external includes as 'SYSTEM' ones.

test/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ if (BUILD_TESTS)
160160
add_cfg(sqlite3.c)
161161
add_cfg(std.c)
162162
add_cfg(std.cpp)
163-
add_cfg(windows.cpp NAME windows32A PLATFORM win32A)
164-
add_cfg(windows.cpp NAME windows32W PLATFORM win32W)
163+
add_cfg(windows.cpp NAME windows32A PLATFORM win32a)
164+
add_cfg(windows.cpp NAME windows32W PLATFORM win32w)
165165
add_cfg(windows.cpp NAME windows64 PLATFORM win64)
166166
add_cfg(wxwidgets.cpp)
167167

test/cfg/runtests.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -529,8 +529,8 @@ function check_file {
529529
;;
530530
windows.cpp)
531531
windows_fn
532-
${CPPCHECK} ${CPPCHECK_OPT} --platform=win32A --library=$lib ${DIR}$f
533-
${CPPCHECK} ${CPPCHECK_OPT} --platform=win32W --library=$lib ${DIR}$f
532+
${CPPCHECK} ${CPPCHECK_OPT} --platform=win32a --library=$lib ${DIR}$f
533+
${CPPCHECK} ${CPPCHECK_OPT} --platform=win32w --library=$lib ${DIR}$f
534534
${CPPCHECK} ${CPPCHECK_OPT} --platform=win64 --library=$lib ${DIR}$f
535535
;;
536536
wxwidgets.cpp)

test/testcmdlineparser.cpp

+20
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,9 @@ class TestCmdlineParser : public TestFixture {
224224
TEST_CASE(stdunknown2);
225225
TEST_CASE(platformWin64);
226226
TEST_CASE(platformWin32A);
227+
TEST_CASE(platformWin32a);
227228
TEST_CASE(platformWin32W);
229+
TEST_CASE(platformWin32w);
228230
TEST_CASE(platformUnix32);
229231
TEST_CASE(platformUnix32Unsigned);
230232
TEST_CASE(platformUnix64);
@@ -1304,6 +1306,15 @@ class TestCmdlineParser : public TestFixture {
13041306
ASSERT(settings->platform.set(Platform::Type::Unspecified));
13051307
ASSERT_EQUALS_ENUM(CmdLineParser::Result::Success, parser->parseFromArgs(3, argv));
13061308
ASSERT_EQUALS(Platform::Type::Win32A, settings->platform.type);
1309+
ASSERT_EQUALS("Platform 'win32A' is deprecated and will be removed in a future version. Please use 'win32a' instead.\n", GET_REDIRECT_OUTPUT);
1310+
}
1311+
1312+
void platformWin32a() {
1313+
REDIRECT;
1314+
const char * const argv[] = {"cppcheck", "--platform=win32a", "file.cpp"};
1315+
ASSERT(settings->platform.set(Platform::Type::Unspecified));
1316+
ASSERT_EQUALS_ENUM(CmdLineParser::Result::Success, parser->parseFromArgs(3, argv));
1317+
ASSERT_EQUALS(Platform::Type::Win32A, settings->platform.type);
13071318
}
13081319

13091320
void platformWin32W() {
@@ -1312,6 +1323,15 @@ class TestCmdlineParser : public TestFixture {
13121323
ASSERT(settings->platform.set(Platform::Type::Unspecified));
13131324
ASSERT_EQUALS_ENUM(CmdLineParser::Result::Success, parser->parseFromArgs(3, argv));
13141325
ASSERT_EQUALS(Platform::Type::Win32W, settings->platform.type);
1326+
ASSERT_EQUALS("Platform 'win32W' is deprecated and will be removed in a future version. Please use 'win32w' instead.\n", GET_REDIRECT_OUTPUT);
1327+
}
1328+
1329+
void platformWin32w() {
1330+
REDIRECT;
1331+
const char * const argv[] = {"cppcheck", "--platform=win32w", "file.cpp"};
1332+
ASSERT(settings->platform.set(Platform::Type::Unspecified));
1333+
ASSERT_EQUALS_ENUM(CmdLineParser::Result::Success, parser->parseFromArgs(3, argv));
1334+
ASSERT_EQUALS(Platform::Type::Win32W, settings->platform.type);
13151335
}
13161336

13171337
void platformUnix32() {

test/testtokenize.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -5656,10 +5656,10 @@ class TestTokenizer : public TestFixture {
56565656
"float * ptrToFloat ;";
56575657

56585658
// These types should be defined the same on all Windows platforms
5659-
const std::string win32A = tokenizeAndStringifyWindows(code, true, Platform::Type::Win32A);
5660-
ASSERT_EQUALS(expected, win32A);
5661-
ASSERT_EQUALS(win32A, tokenizeAndStringifyWindows(code, true, Platform::Type::Win32W));
5662-
ASSERT_EQUALS(win32A, tokenizeAndStringifyWindows(code, true, Platform::Type::Win64));
5659+
const std::string win32a = tokenizeAndStringifyWindows(code, true, Platform::Type::Win32A);
5660+
ASSERT_EQUALS(expected, win32a);
5661+
ASSERT_EQUALS(win32a, tokenizeAndStringifyWindows(code, true, Platform::Type::Win32W));
5662+
ASSERT_EQUALS(win32a, tokenizeAndStringifyWindows(code, true, Platform::Type::Win64));
56635663
}
56645664

56655665
void platformWin32A() {

0 commit comments

Comments
 (0)