Skip to content

Commit 21163e8

Browse files
authored
fixed #14198 - cleaned up usage of Windows-specific architecture macros in Visual Studio builds (#8003)
1 parent e491f90 commit 21163e8

File tree

9 files changed

+20
-21
lines changed

9 files changed

+20
-21
lines changed

cli/cli.vcxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
<BufferSecurityCheck>true</BufferSecurityCheck>
9090
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
9191
<Optimization>Disabled</Optimization>
92-
<PreprocessorDefinitions>CPPCHECKLIB_IMPORT;TINYXML2_IMPORT;WIN32;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
92+
<PreprocessorDefinitions>CPPCHECKLIB_IMPORT;TINYXML2_IMPORT;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
9393
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
9494
<WarningLevel>Level4</WarningLevel>
9595
<DisableSpecificWarnings>4018;4127;4146;4244;4251;4267;4389;4701;4706;4800;4805</DisableSpecificWarnings>
@@ -118,7 +118,7 @@
118118
<BufferSecurityCheck>true</BufferSecurityCheck>
119119
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
120120
<Optimization>Disabled</Optimization>
121-
<PreprocessorDefinitions>CPPCHECKLIB_IMPORT;TINYXML2_IMPORT;WIN32;HAVE_RULES;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
121+
<PreprocessorDefinitions>CPPCHECKLIB_IMPORT;TINYXML2_IMPORT;HAVE_RULES;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
122122
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
123123
<WarningLevel>Level4</WarningLevel>
124124
<DisableSpecificWarnings>4018;4127;4146;4244;4251;4267;4389;4701;4706;4800;4805</DisableSpecificWarnings>
@@ -146,7 +146,7 @@
146146
<AdditionalIncludeDirectories>..\lib;..\frontend;..\externals;..\externals\picojson;..\externals\simplecpp;..\externals\tinyxml2;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
147147
<BufferSecurityCheck>false</BufferSecurityCheck>
148148
<Optimization>MaxSpeed</Optimization>
149-
<PreprocessorDefinitions>CPPCHECKLIB_IMPORT;TINYXML2_IMPORT;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
149+
<PreprocessorDefinitions>CPPCHECKLIB_IMPORT;TINYXML2_IMPORT;NDEBUG;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
150150
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
151151
<WarningLevel>Level4</WarningLevel>
152152
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
@@ -184,7 +184,7 @@
184184
<AdditionalIncludeDirectories>..\lib;..\frontend;..\externals;..\externals\picojson;..\externals\simplecpp;..\externals\tinyxml2;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
185185
<BufferSecurityCheck>false</BufferSecurityCheck>
186186
<Optimization>MaxSpeed</Optimization>
187-
<PreprocessorDefinitions>CPPCHECKLIB_IMPORT;TINYXML2_IMPORT;NDEBUG;WIN32;HAVE_RULES;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
187+
<PreprocessorDefinitions>CPPCHECKLIB_IMPORT;TINYXML2_IMPORT;NDEBUG;HAVE_RULES;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
188188
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
189189
<WarningLevel>Level4</WarningLevel>
190190
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>

cli/cppcheckexecutor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
#include <windows.h>
7575
#endif
7676

77-
#if !defined(WIN32) && !defined(__MINGW32__)
77+
#if !defined(_WIN32) && !defined(__MINGW32__)
7878
#include <sys/wait.h> // WIFEXITED and friends
7979
#endif
8080

@@ -684,7 +684,7 @@ int CppCheckExecutor::executeCommand(std::string exe, std::vector<std::string> a
684684
//std::cout << "pclose() errno " << std::to_string(err) << std::endl;
685685
return res;
686686
}
687-
#if !defined(WIN32) && !defined(__MINGW32__)
687+
#if !defined(_WIN32) && !defined(__MINGW32__)
688688
if (WIFEXITED(res)) {
689689
return WEXITSTATUS(res);
690690
}

cli/processexecutor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
#include "processexecutor.h"
2424

25-
#if !defined(WIN32) && !defined(__MINGW32__)
25+
#if !defined(_WIN32) && !defined(__MINGW32__)
2626

2727
#include "cppcheck.h"
2828
#include "errorlogger.h"

cmake/compilerDefinitions.cmake

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@ if(MSVC)
44
# Visual Studio only sets _DEBUG
55
add_compile_definitions($<$<CONFIG:Debug>:DEBUG>)
66

7-
add_definitions(-DWIN32)
87
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
98
add_definitions(-DWIN32_LEAN_MEAN)
10-
add_definitions(-D_WIN64)
119
endif()
1210

1311
# TODO: this should probably apply to the compiler and not the platform - I think it is only "broken" with MinGW

lib/cppcheck.vcxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@
260260
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
261261
<MultiProcessorCompilation>true</MultiProcessorCompilation>
262262
<Optimization>Disabled</Optimization>
263-
<PreprocessorDefinitions>CPPCHECKLIB_EXPORT;TINYXML2_EXPORT;SIMPLECPP_EXPORT;$(HaveBoost);WIN32;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
263+
<PreprocessorDefinitions>CPPCHECKLIB_EXPORT;TINYXML2_EXPORT;SIMPLECPP_EXPORT;$(HaveBoost);_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
264264
<WarningLevel>Level4</WarningLevel>
265265
<AdditionalIncludeDirectories>..\externals;..\externals\picojson;..\externals\simplecpp;..\externals\tinyxml2;$(BoostInclude);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
266266
<DisableSpecificWarnings>4018;4127;4146;4244;4251;4267;4389;4701;4706;4800;4805</DisableSpecificWarnings>
@@ -294,7 +294,7 @@ if exist "$(OutDir)platforms\unix64-unsigned.xml" del /q "$(OutDir)platforms\uni
294294
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
295295
<MultiProcessorCompilation>true</MultiProcessorCompilation>
296296
<Optimization>Disabled</Optimization>
297-
<PreprocessorDefinitions>CPPCHECKLIB_EXPORT;TINYXML2_EXPORT;SIMPLECPP_EXPORT;$(HaveBoost);WIN32;HAVE_RULES;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
297+
<PreprocessorDefinitions>CPPCHECKLIB_EXPORT;TINYXML2_EXPORT;SIMPLECPP_EXPORT;$(HaveBoost);HAVE_RULES;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
298298
<WarningLevel>Level4</WarningLevel>
299299
<AdditionalIncludeDirectories>..\externals;..\externals\picojson;..\externals\simplecpp;..\externals\tinyxml2;$(BoostInclude);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
300300
<DisableSpecificWarnings>4018;4127;4146;4244;4251;4267;4389;4701;4706;4800;4805</DisableSpecificWarnings>
@@ -336,7 +336,7 @@ if exist "$(OutDir)platforms\unix64-unsigned.xml" del /q "$(OutDir)platforms\uni
336336
<FunctionLevelLinking>true</FunctionLevelLinking>
337337
<AdditionalIncludeDirectories>..\externals;..\externals\picojson;..\externals\simplecpp;..\externals\tinyxml2;$(BoostInclude);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
338338
<DisableSpecificWarnings>4018;4127;4146;4244;4251;4267;4389;4701;4706;4800;4805</DisableSpecificWarnings>
339-
<PreprocessorDefinitions>CPPCHECKLIB_EXPORT;TINYXML2_EXPORT;SIMPLECPP_EXPORT;$(HaveBoost);NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
339+
<PreprocessorDefinitions>CPPCHECKLIB_EXPORT;TINYXML2_EXPORT;SIMPLECPP_EXPORT;$(HaveBoost);NDEBUG;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
340340
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
341341
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
342342
<MultiProcessorCompilation>true</MultiProcessorCompilation>
@@ -379,7 +379,7 @@ if exist "$(OutDir)platforms\unix64-unsigned.xml" del /q "$(OutDir)platforms\uni
379379
<FunctionLevelLinking>true</FunctionLevelLinking>
380380
<AdditionalIncludeDirectories>..\externals;..\externals\picojson;..\externals\simplecpp;..\externals\tinyxml2;$(BoostInclude);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
381381
<DisableSpecificWarnings>4018;4127;4146;4244;4251;4267;4389;4701;4706;4800;4805</DisableSpecificWarnings>
382-
<PreprocessorDefinitions>CPPCHECKLIB_EXPORT;TINYXML2_EXPORT;SIMPLECPP_EXPORT;$(HaveBoost);NDEBUG;WIN32;HAVE_RULES;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
382+
<PreprocessorDefinitions>CPPCHECKLIB_EXPORT;TINYXML2_EXPORT;SIMPLECPP_EXPORT;$(HaveBoost);NDEBUG;HAVE_RULES;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
383383
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
384384
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
385385
<MultiProcessorCompilation>true</MultiProcessorCompilation>

releasenotes.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,6 @@ Infrastructure & dependencies:
4242
- Updated Qt to 6.10.0 (official Windows release only).
4343
- The official Windows binary is now built against Boost 1.89 for increased performance.
4444
- Updated to simplecpp 1.6.2
45+
- The Visual Studio builds not longer set the `WIN32` define.
4546

4647
The changes focus heavily on stability (crash fixes), C/C++ compatibility, reducing false positives, and improving performance.

test/testprocessexecutor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ class TestProcessExecutorBase : public TestFixture {
112112
}
113113

114114
void run() override {
115-
#if !defined(WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__)
115+
#if !defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__)
116116
mNewTemplate = true;
117117
TEST_CASE(deadlock_with_many_errors);
118118
TEST_CASE(many_threads);

test/testrunner.vcxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@
207207
<BufferSecurityCheck>true</BufferSecurityCheck>
208208
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
209209
<Optimization>Disabled</Optimization>
210-
<PreprocessorDefinitions>CPPCHECKLIB_IMPORT;SIMPLECPP_IMPORT;$(HaveBoost);WIN32;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
210+
<PreprocessorDefinitions>CPPCHECKLIB_IMPORT;SIMPLECPP_IMPORT;$(HaveBoost);_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
211211
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
212212
<WarningLevel>Level4</WarningLevel>
213213
<DisableSpecificWarnings>4018;4127;4146;4244;4251;4267;4389;4701;4706;4800;4805</DisableSpecificWarnings>
@@ -236,7 +236,7 @@
236236
<BufferSecurityCheck>true</BufferSecurityCheck>
237237
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
238238
<Optimization>Disabled</Optimization>
239-
<PreprocessorDefinitions>CPPCHECKLIB_IMPORT;SIMPLECPP_IMPORT;$(HaveBoost);WIN32;HAVE_RULES;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
239+
<PreprocessorDefinitions>CPPCHECKLIB_IMPORT;SIMPLECPP_IMPORT;$(HaveBoost);HAVE_RULES;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
240240
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
241241
<WarningLevel>Level4</WarningLevel>
242242
<DisableSpecificWarnings>4018;4127;4146;4244;4251;4267;4389;4701;4706;4800;4805</DisableSpecificWarnings>
@@ -264,7 +264,7 @@
264264
<AdditionalIncludeDirectories>..\cli;..\frontend;..\lib;..\externals;..\externals\picojson;..\externals\simplecpp;..\externals\tinyxml2;$(BoostInclude);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
265265
<BufferSecurityCheck>false</BufferSecurityCheck>
266266
<Optimization>MaxSpeed</Optimization>
267-
<PreprocessorDefinitions>CPPCHECKLIB_IMPORT;SIMPLECPP_IMPORT;$(HaveBoost);NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
267+
<PreprocessorDefinitions>CPPCHECKLIB_IMPORT;SIMPLECPP_IMPORT;$(HaveBoost);NDEBUG;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
268268
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
269269
<WarningLevel>Level4</WarningLevel>
270270
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
@@ -304,7 +304,7 @@
304304
<AdditionalIncludeDirectories>..\cli;..\frontend;..\lib;..\externals;..\externals\picojson;..\externals\simplecpp;..\externals\tinyxml2;$(BoostInclude);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
305305
<BufferSecurityCheck>false</BufferSecurityCheck>
306306
<Optimization>MaxSpeed</Optimization>
307-
<PreprocessorDefinitions>CPPCHECKLIB_IMPORT;SIMPLECPP_IMPORT;$(HaveBoost);NDEBUG;WIN32;HAVE_RULES;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
307+
<PreprocessorDefinitions>CPPCHECKLIB_IMPORT;SIMPLECPP_IMPORT;$(HaveBoost);NDEBUG;HAVE_RULES;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
308308
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
309309
<WarningLevel>Level4</WarningLevel>
310310
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>

test/testsuppressions.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class TestSuppressions : public TestFixture {
6060
TEST_CASE(suppressionsSettingsFS);
6161
TEST_CASE(suppressionsSettingsThreadsFiles);
6262
TEST_CASE(suppressionsSettingsThreadsFS);
63-
#if !defined(WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__)
63+
#if !defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__)
6464
TEST_CASE(suppressionsSettingsProcessesFiles);
6565
TEST_CASE(suppressionsSettingsProcessesFS);
6666
#endif
@@ -342,7 +342,7 @@ class TestSuppressions : public TestFixture {
342342
return exitCode;
343343
}
344344

345-
#if !defined(WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__)
345+
#if !defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__)
346346
unsigned int checkSuppressionProcessesFiles(const char code[], const std::string &suppression = "") {
347347
return _checkSuppressionProcesses(code, false, suppression);
348348
}
@@ -928,7 +928,7 @@ class TestSuppressions : public TestFixture {
928928
runChecks(&TestSuppressions::checkSuppressionThreadsFS);
929929
}
930930

931-
#if !defined(WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__)
931+
#if !defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__)
932932
void suppressionsSettingsProcessesFiles() {
933933
runChecks(&TestSuppressions::checkSuppressionProcessesFiles);
934934
}

0 commit comments

Comments
 (0)