Pyrogenesis  trunk
ScriptTypes.h
Go to the documentation of this file.
1 /* Copyright (C) 2016 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 #endif
59 
60 #include "jspubtd.h"
61 #include "jsapi.h"
62 
63 // restore user flags and re-enable the warnings disabled a few lines above
64 #if MSC_VERSION
65 # pragma warning(pop)
66 #endif
67 #if CLANG_VERSION
68 # pragma clang diagnostic pop
69 #endif
70 #if GCC_VERSION
71 # pragma GCC diagnostic pop
72 #endif
73 
74 #if MOZJS_MAJOR_VERSION != 38
75 #error Your compiler is trying to use an incorrect major version of the \
76 SpiderMonkey library. The only version that works is the one in the \
77 libraries/spidermonkey/ directory, and it will not work with a typical \
78 system-installed version. Make sure you have got all the right files and \
79 include paths.
80 #endif
81 
82 #if MOZJS_MINOR_VERSION != 3
83 #error Your compiler is trying to use an untested minor version of the \
84 SpiderMonkey library. If you are a package maintainer, please make sure \
85 to check very carefully that this version does not change the behaviour \
86 of the code executed by SpiderMonkey. Different parts of the game (e.g. \
87 the multiplayer mode) rely on deterministic behaviour of the JavaScript \
88 engine. A simple way for testing this would be playing a network game \
89 with one player using the old version and one player using the new \
90 version. Another way for testing is running replays and comparing the \
91 final hash (check trac.wildfiregames.com/wiki/Debugging#Replaymode). \
92 For more information check this link: trac.wildfiregames.com/wiki/Debugging#Outofsync
93 #endif
94 
95 class ScriptInterface;
96 
97 #endif // INCLUDED_SCRIPTTYPES
Abstraction around a SpiderMonkey JSContext.
Definition: ScriptInterface.h:71