forked from SDL-Hercules-390/hyperion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ccnowarn.h
99 lines (80 loc) · 4.85 KB
/
ccnowarn.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/* ccnowarn.h (C) Copyright "Fish" (David B. Trout), 2011 */
/* */
/* Released under "The Q Public License Version 1" */
/* (http://www.hercules-390.org/herclic.html) */
/* as modifications to Hercules. */
/*-------------------------------------------------------------------*/
/* The "DISABLE_xxx_WARNING" and "ENABLE_xxx_WARNING" macros allow */
/* you to temporarily suppress certain harmless compiler warnings. */
/* Use the "_DISABLE" macro before the source statement which is */
/* causing the problem and the "_ENABLE" macro shortly afterwards. */
/* PLEASE DO NOT GO OVERBOARD (overdo or overuse) THE SUPPRESSION */
/* OF WARNINGS! Most warnings are actually bugs waiting to happen. */
/* The "DISABLE_xxx_WARNING" and "ENABLE_xxx_WARNING" macros are */
/* only meant as a temporary measure until the warning itself can */
/* be properly investigated and resolved. */
/*-------------------------------------------------------------------*/
#include "ccfixme.h" /* need "QSTR" macro, etc */
#ifndef _CCNOWARN_H_
#define _CCNOWARN_H_
/*---------------------------------------------------------------*/
/* Microsoft Visual C++ */
/*---------------------------------------------------------------*/
#if defined( _MSVC_ )
#define DISABLE_MSVC_WARNING( _num, _msg ) \
\
__pragma( warning( push ) ) \
__pragma( warning( disable : _num ) ) \
FIXME( _msg )
#define ENABLE_MSVC_WARNING( _num ) \
\
__pragma( warning( pop ) )
/* Globally disable some uninteresting MSVC compiler warnings */
#pragma warning( disable: 4127 ) // "conditional expression is constant"
#pragma warning( disable: 4142 ) // "benign redefinition of type"
#pragma warning( disable: 4146 ) // "unary minus operator applied to unsigned type, result still unsigned"
#pragma warning( disable: 4200 ) // "nonstandard extension used : zero-sized array in struct/union"
#pragma warning( disable: 4244 ) // (floating-point only?) "conversion from 'x' to 'y', possible loss of data"
#pragma warning( disable: 4267 ) // "conversion from size_t to int possible loss of data"
#pragma warning( disable: 4748 ) // "/GS can not protect parameters and local variables from local buffer overrun because optimizations are disabled in function"
#endif
#ifndef DISABLE_MSVC_WARNING
#define DISABLE_MSVC_WARNING( _opt, _msg ) /* (do nothing) */
#define ENABLE_MSVC_WARNING( _opt ) /* (do nothing) */
#endif
/*---------------------------------------------------------------*/
/* GNU Compiler Collection */
/*---------------------------------------------------------------*/
#if defined( __GNUC__ )
#ifdef HAVE_GCC_DIAG_PRAGMA
#define PRAGMA_GCC_DIAG( _opt ) _Pragma( GCC diagnostic _opt )
#define GCC_WARNING_ON( _opt ) PRAGMA_GCC_DIAG( warning QSTR2( -W, _opt ) )
#define GCC_WARNING_OFF( _opt, _msg ) PRAGMA_GCC_DIAG( ignored QSTR2( -W, _opt ) ) \
FIXME( _msg )
#ifdef HAVE_GCC_DIAG_PUSHPOP
#define DISABLE_GCC_WARNING( _opt, _msg ) PRAGMA_GCC_DIAG( push ) \
GCC_WARNING_OFF( _opt, _msg )
#define ENABLE_GCC_WARNING( _opt ) PRAGMA_GCC_DIAG( pop )
#else
#define DISABLE_GCC_WARNING( _opt, _msg ) GCC_WARNING_OFF( _opt, _msg )
#define ENABLE_GCC_WARNING( _opt ) GCC_WARNING_ON( _opt )
#endif
/* Globally disable some rather annoying GCC compiler warnings which */
/* frequently occurs due to our build multiple architectures design. */
#if GCC_VERSION >= 40304
#pragma GCC diagnostic ignored "-Wunused-function" // "'xxxxxxxx' defined but not used"
#endif
#if GCC_VERSION >= 40600
#pragma GCC diagnostic ignored "-Wunused-but-set-variable" // "variable 'xxx' set but not used"
#endif
#endif
#endif
#ifndef DISABLE_GCC_WARNING
#define DISABLE_GCC_WARNING( _opt, _msg ) /* (do nothing) */
#define ENABLE_GCC_WARNING( _opt ) /* (do nothing) */
#endif
/*---------------------------------------------------------------*/
/* ((((((((( define support for other compilers here ))))))))) */
/*---------------------------------------------------------------*/
/* ( don't forget to define a "FIXME" macro too. See ccfixme.h ) */
#endif /* _CCNOWARN_H_ */