Skip to content

Commit

Permalink
Merge pull request godotengine#96244 from Repiteo/scons/msvc-__cplusplus
Browse files Browse the repository at this point in the history
SCons: Pass `/Zc:__cplusplus` in MSVC builds
akien-mga committed Sep 5, 2024
2 parents 38447c5 + 4c84cb6 commit a8e3feb
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions SConstruct
Original file line number Diff line number Diff line change
@@ -791,6 +791,8 @@ else:
# Note that this is still not complete conformance, as certain Windows-related headers
# don't compile under complete conformance.
env.Prepend(CCFLAGS=["/permissive-"])
# Allow use of `__cplusplus` macro to determine C++ standard universally.
env.Prepend(CXXFLAGS=["/Zc:__cplusplus"])

# Disable exception handling. Godot doesn't use exceptions anywhere, and this
# saves around 20% of binary size and very significant build time (GH-80513).
3 changes: 3 additions & 0 deletions core/typedefs.h
Original file line number Diff line number Diff line change
@@ -44,6 +44,9 @@
#include "core/error/error_list.h"
#include <cstdint>

// Ensure that C++ standard is at least C++17. If on MSVC, also ensures that the `Zc:__cplusplus` flag is present.
static_assert(__cplusplus >= 201703L);

// Turn argument to string constant:
// https://gcc.gnu.org/onlinedocs/cpp/Stringizing.html#Stringizing
#ifndef _STR

0 comments on commit a8e3feb

Please sign in to comment.