Pyrogenesis  trunk
ScriptTypes.h
Go to the documentation of this file.
1 /* Copyright (C) 2023 Wildfire Games.
2  * This file is part of 0 A.D.
3  *
4  * 0 A.D. is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * 0 A.D. is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef INCLUDED_SCRIPTTYPES
19 #define INCLUDED_SCRIPTTYPES
20 
21 #define JSGC_GENERATIONAL 1
22 #define JSGC_USE_EXACT_ROOTING 1
23 
24 #ifdef _WIN32
25 # define XP_WIN
26 # ifndef WIN32
27 # define WIN32 // SpiderMonkey expects this
28 # endif
29 #endif
30 
31 // Ignore some harmless warnings
32 #if GCC_VERSION
33 # pragma GCC diagnostic push
34 # pragma GCC diagnostic ignored "-Wunused-parameter"
35 # pragma GCC diagnostic ignored "-Wredundant-decls"
36 # pragma GCC diagnostic ignored "-Wundef" // Some versions of GCC will still print warnings (see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431).
37 # pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
38 # pragma GCC diagnostic ignored "-Wignored-qualifiers"
39 # pragma GCC diagnostic ignored "-Wextra"
40 #endif
41 #if CLANG_VERSION
42 # pragma clang diagnostic push
43 # pragma clang diagnostic ignored "-Wuninitialized"
44 # pragma clang diagnostic ignored "-Wc++11-extensions"
45 # pragma clang diagnostic ignored "-Wignored-qualifiers"
46 # pragma clang diagnostic ignored "-Wmismatched-tags"
47 // Ugly hack to deal with macro redefinitions from libc++
48 # ifdef nullptr
49 # undef nullptr
50 # endif
51 # ifdef decltype
52 # undef decltype
53 # endif
54 #endif
55 #if MSC_VERSION
56 // reduce the warning level for the SpiderMonkey headers
57 # pragma warning(push, 1)
58 // ignore C4291 in <mozilla/Vector.h>
59 # pragma warning(disable: 4291)
60 #endif
61 
62 #include "jspubtd.h"
63 #include "jsapi.h"
64 
65 // restore user flags and re-enable the warnings disabled a few lines above
66 #if MSC_VERSION
67 # pragma warning(pop)
68 #endif
69 #if CLANG_VERSION
70 # pragma clang diagnostic pop
71 #endif
72 #if GCC_VERSION
73 # pragma GCC diagnostic pop
74 #endif
75 
76 #if MOZJS_MAJOR_VERSION != 91
77 #error Your compiler is trying to use an incorrect major version of the \
78 SpiderMonkey library. The only version that works is the one in the \
79 libraries/spidermonkey/ directory, and it will not work with a typical \
80 system-installed version. Make sure you have got all the right files and \
81 include paths.
82 #endif
83 
84 #if MOZJS_MINOR_VERSION != 13
85 #error Your compiler is trying to use an untested minor version of the \
86 SpiderMonkey library. If you are a package maintainer, please make sure \
87 to check very carefully that this version does not change the behaviour \
88 of the code executed by SpiderMonkey. Different parts of the game (e.g. \
89 the multiplayer mode) rely on deterministic behaviour of the JavaScript \
90 engine. A simple way for testing this would be playing a network game \
91 with one player using the old version and one player using the new \
92 version. Another way for testing is running replays and comparing the \
93 final hash (check trac.wildfiregames.com/wiki/Debugging#Replaymode). \
94 For more information check this link: trac.wildfiregames.com/wiki/Debugging#Outofsync
95 #endif
96 
97 class ScriptInterface;
98 
99 #endif // INCLUDED_SCRIPTTYPES
Abstraction around a SpiderMonkey JS::Realm.
Definition: ScriptInterface.h:71