mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-20 23:44:08 +00:00
Use conforming preprocessor with modern MSVC
https://learn.microsoft.com/en-us/cpp/preprocessor/preprocessor-experimental-overview
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user