Skip to content

Commit 44779fb

Browse files
committed
Compiler flag Zc:__cplusplus
Add /Zc:__cplusplus compiler flag so value of __cplusplus macro will be properly set. Although I'm not yet using this macro in this project, it might be needed in the future, and this macro is available with other compilers as well.
1 parent b477159 commit 44779fb

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

CConsole/CConsole.vcxproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@
141141
<RuntimeTypeInfo>true</RuntimeTypeInfo>
142142
<FunctionLevelLinking>true</FunctionLevelLinking>
143143
<LanguageStandard>stdcpp17</LanguageStandard>
144+
<AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
144145
</ClCompile>
145146
<Link>
146147
<SubSystem>Windows</SubSystem>
@@ -172,6 +173,7 @@
172173
<RuntimeTypeInfo>true</RuntimeTypeInfo>
173174
<FunctionLevelLinking>true</FunctionLevelLinking>
174175
<LanguageStandard>stdcpp17</LanguageStandard>
176+
<AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
175177
</ClCompile>
176178
<Link>
177179
<SubSystem>Windows</SubSystem>
@@ -203,6 +205,7 @@
203205
<RuntimeTypeInfo>true</RuntimeTypeInfo>
204206
<FunctionLevelLinking>true</FunctionLevelLinking>
205207
<LanguageStandard>stdcpp17</LanguageStandard>
208+
<AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
206209
</ClCompile>
207210
<Link>
208211
<SubSystem>Windows</SubSystem>
@@ -232,6 +235,7 @@
232235
<RuntimeTypeInfo>true</RuntimeTypeInfo>
233236
<FunctionLevelLinking>true</FunctionLevelLinking>
234237
<LanguageStandard>stdcpp17</LanguageStandard>
238+
<AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
235239
</ClCompile>
236240
<Link>
237241
<SubSystem>Windows</SubSystem>
@@ -266,6 +270,7 @@
266270
<TreatWarningAsError>true</TreatWarningAsError>
267271
<RuntimeTypeInfo>true</RuntimeTypeInfo>
268272
<LanguageStandard>stdcpp17</LanguageStandard>
273+
<AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
269274
</ClCompile>
270275
<Link>
271276
<SubSystem>Windows</SubSystem>
@@ -299,6 +304,7 @@
299304
<TreatWarningAsError>true</TreatWarningAsError>
300305
<RuntimeTypeInfo>true</RuntimeTypeInfo>
301306
<LanguageStandard>stdcpp17</LanguageStandard>
307+
<AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
302308
</ClCompile>
303309
<Link>
304310
<SubSystem>Windows</SubSystem>
@@ -327,6 +333,7 @@
327333
<WholeProgramOptimization>false</WholeProgramOptimization>
328334
<RuntimeTypeInfo>true</RuntimeTypeInfo>
329335
<LanguageStandard>stdcpp17</LanguageStandard>
336+
<AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
330337
</ClCompile>
331338
<Link>
332339
<SubSystem>Windows</SubSystem>

CConsole/src/conmain.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,13 +293,17 @@ static void threadFunc(CConsole& con, CConsole::FormatSignal fs)
293293
int nHiddenLogs = 0;
294294
for (int i = 1; i <= 10; i++)
295295
{
296-
if (i % 3 == 0)
296+
if (i % 2 == 0)
297297
{
298298
const bool bModuleEnabled = (PFL::random(0, 1) == 1);
299299
if (con.getLoggingState(sThreadName.c_str()) != bModuleEnabled)
300300
{
301301
// here we use empty string for getConsoleInstance() because this way log will always appear regardless of module filter state
302-
CConsole::getConsoleInstance("").OLn("%s: has %s logging for its module name", sThreadName.c_str(), bModuleEnabled ? "enabled" : "disabled");
302+
CConsole::getConsoleInstance("").OLn("%s: has %s logging for its module name with %d visible and %d hidden logs so far",
303+
sThreadName.c_str(),
304+
bModuleEnabled ? "enabled" : "disabled",
305+
nVisibleLogs,
306+
nHiddenLogs);
303307
// note that using empty string will actually clear the logger module name for current thread, so make sure
304308
// we always use the logger module name with getConsoleInstance() whenever we are logging something, to set the name again!
305309
con.SetLoggingState(sThreadName.c_str(), bModuleEnabled);

0 commit comments

Comments
 (0)