The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
global.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 - 2016 by David White <[email protected]>
3  Part of the Battle for Wesnoth Project http://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 #ifndef GLOBAL_HPP_INCLUDED
16 #define GLOBAL_HPP_INCLUDED
17 
18 #ifdef _MSC_VER
19 
20 // Enable C99 support for VC14
21 #if _MSC_VER>=1900
22 #define STDC99
23 #else
24 #undef snprintf
25 #define snprintf _snprintf
26 #endif
27 
28 // Disable warning about source encoding not in current code page.
29 #pragma warning(disable: 4819)
30 
31 // Disable warning about deprecated functions.
32 #pragma warning(disable: 4996)
33 
34 // Disable warning when using time_t in snprintf.
35 #pragma warning(disable: 4477)
36 
37 // Disable some MSVC warnings which are useless according to mordante
38 #pragma warning(disable: 4244)
39 #pragma warning(disable: 4345)
40 #pragma warning(disable: 4250)
41 #pragma warning(disable: 4355)
42 #pragma warning(disable: 4351)
43 
44 #endif //_MSC_VER
45 
46 #ifdef NDEBUG
47 /*
48  * Wesnoth uses asserts to avoid undefined behaviour. For example, to make sure
49  * pointers are not nullptr before deferring them, or collections are not empty
50  * before accessing their elements. Therefore Wesnoth should not be compiled
51  * with assertions disabled.
52  */
53 #error "Compilation with NDEBUG defined isn't supported, Wesnoth depends on asserts."
54 #endif
55 
56 #define UNUSED(x) ((void)(x)) /* to avoid warnings */
57 
58 // To allow using some optional C++14 features
59 #if __cplusplus >= 201402L
60 #define HAVE_CXX14
61 #endif
62 
63 #endif //GLOBAL_HPP_INCLUDED