mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-16 05:13:58 -07:00
Use conforming preprocessor with modern MSVC
https://learn.microsoft.com/en-us/cpp/preprocessor/preprocessor-experimental-overview
This commit is contained in:
parent
251f6bfc86
commit
03fff3572f
5 changed files with 7 additions and 46 deletions
|
|
@ -296,6 +296,11 @@ function project_set_build_flags()
|
|||
-- Finally since VS2012 it's enabled implicitely when not set.
|
||||
vectorextensions "SSE2"
|
||||
|
||||
-- SpiderMonkey only supports building with MSVC on a best-effort basis,
|
||||
-- and the traditional MSVC preprocessor is incompatible with some headers.
|
||||
-- Use the modern, standard-compliant MSVC preprocessor instead.
|
||||
usestandardpreprocessor "On"
|
||||
|
||||
-- use native wchar_t type (not typedef to unsigned short)
|
||||
nativewchar "on"
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ cd /D "%~dp0"
|
|||
|
||||
rem **SVN revision to checkout for windows-libs or windows-libs-amd64**
|
||||
rem **Update this line when you commit an update to windows-libs or windows-libs-amd64**
|
||||
set "svnrev=28267"
|
||||
set "svnrev=28268"
|
||||
|
||||
if "%1" == "--amd64" (
|
||||
set "LIBS_PATH=win64"
|
||||
|
|
|
|||
|
|
@ -205,12 +205,6 @@ if [ "${OS}" = "Windows_NT" ]; then
|
|||
cd "${FOLDER}"/build-release/dist/include
|
||||
rm -f mozzconf.h zconf.h zlib.h
|
||||
)
|
||||
|
||||
# SpiderMonkey can be linked/included in projects built with MSVC, however, since clang is now the only
|
||||
# supported compiler on Windows, the codebase has accumulated some divergences with MSVC.
|
||||
# Upstream tries on a best-effort basis to keep the SM headers MSVC-compatible.
|
||||
patch -d "${FOLDER}"/build-debug/dist/include -p1 <patches/FixHeadersForMSVC.diff
|
||||
patch -d "${FOLDER}"/build-release/dist/include -p1 <patches/FixHeadersForMSVC.diff
|
||||
fi
|
||||
|
||||
# js-config.h is different for debug and release builds, so we need different include directories for both
|
||||
|
|
|
|||
|
|
@ -1,38 +0,0 @@
|
|||
diff --git a/jspubtd.h b/jspubtd.h
|
||||
index 97de470db..1507b6b6b 100644
|
||||
--- a/jspubtd.h
|
||||
+++ b/jspubtd.h
|
||||
@@ -51,6 +51,11 @@ enum JSType {
|
||||
enum JSProtoKey {
|
||||
#define PROTOKEY_AND_INITIALIZER(name, clasp) JSProto_##name,
|
||||
JS_FOR_EACH_PROTOTYPE(PROTOKEY_AND_INITIALIZER)
|
||||
+// Workaround MSVC's __VA_ARGS__ quirk, until bug 1768634 is solved
|
||||
+// https://bugzilla.mozilla.org/show_bug.cgi?id=1768634
|
||||
+#ifdef _MSC_VER
|
||||
+ ,
|
||||
+#endif
|
||||
#undef PROTOKEY_AND_INITIALIZER
|
||||
JSProto_LIMIT
|
||||
};
|
||||
|
||||
diff --git a/mozilla/Result.h b/mozilla/Result.h
|
||||
index cc4f87826..0e763a300 100644
|
||||
--- a/mozilla/Result.h
|
||||
+++ b/mozilla/Result.h
|
||||
@@ -212,10 +212,16 @@ using UnsignedIntType = std::conditional_t<
|
||||
*/
|
||||
template <typename V, typename E>
|
||||
class ResultImplementation<V, E, PackingStrategy::LowBitTagIsError> {
|
||||
+// These assertions fail with MSVC 14.1. Similar bugs:
|
||||
+// https://bugzilla.mozilla.org/show_bug.cgi?id=1778246
|
||||
+// https://bugzilla.mozilla.org/show_bug.cgi?id=1778247
|
||||
+// TODO: test with recent MSVC before reporting a bug
|
||||
+#ifndef _MSC_VER
|
||||
static_assert(std::is_trivially_copyable_v<V> &&
|
||||
std::is_trivially_destructible_v<V>);
|
||||
static_assert(std::is_trivially_copyable_v<E> &&
|
||||
std::is_trivially_destructible_v<E>);
|
||||
+#endif
|
||||
|
||||
static constexpr size_t kRequiredSize = std::max(sizeof(V), sizeof(E));
|
||||
|
||||
|
|
@ -1337,7 +1337,7 @@ static bool udt_should_suppress(const wchar_t* type_name)
|
|||
// removed obsolete defs: HEVENT, HFILE, HUMPD
|
||||
if(type_name[0] != 'H')
|
||||
goto not_handle;
|
||||
#define SUPPRESS_HANDLE(name) if(!wcscmp(type_name, L#name L"__")) return true;
|
||||
#define SUPPRESS_HANDLE(name) if(!wcscmp(type_name, L""#name L"__")) return true;
|
||||
SUPPRESS_HANDLE(HACCEL);
|
||||
SUPPRESS_HANDLE(HBITMAP);
|
||||
SUPPRESS_HANDLE(HBRUSH);
|
||||
|
|
|
|||
Loading…
Reference in a new issue