forked from SDL-Hercules-390/hyperion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ccfixme.h
114 lines (91 loc) · 4.68 KB
/
ccfixme.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/* ccfixme.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. */
/*-------------------------------------------------------------------*/
/* This header file #defines a generic "FIXME" macro used to mark */
/* suspicious code needing fixed or at least further investigated. */
/* Sample usage: TODO( "Figure out a better way to calculate foo" ) */
/* It is designed to work identically for GCC as well as MSVC. The */
/* only argument is the "fixme" message you wish to be issued. To */
/* suppress a compiler warning, use the "DISABLE_xxx_WARNING" and */
/* "ENABLE_xxx_WARNING" macros instead, defined in "ccnowarn.h". */
/*-------------------------------------------------------------------*/
#ifndef _CCFIXME_H_
#define _CCFIXME_H_
/*-------------------------------------------------------------------*/
/* Construct a GCC "version" constant for easier gcc version testing */
/*-------------------------------------------------------------------*/
#if defined( __GNUC__ )
#define GCC_VERSION \
(__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
#endif
/*-------------------------------------------------------------------*/
/* Macros for issuing compiler messages */
/*-------------------------------------------------------------------*/
#define Q( _s ) #_s
#define QSTR( _s ) Q( _s )
#define QLINE __FILE__ "(" QSTR( __LINE__ ) ") : "
#define WARN_LINE QLINE "warning : "
#define FIXME_LINE QLINE "FIXME : "
#define TODO_LINE QLINE "TODO : "
#define NOTE_LINE QLINE "NOTE : "
/*-------------------------------------------------------------------*/
/* Macro to suppress compiler "unreferenced variable" warnings */
/*-------------------------------------------------------------------*/
#define UNREFERENCED(x) do{}while(0 && x)
#define UNREFERENCED_370(x) do{}while(0 && x)
#define UNREFERENCED_390(x) do{}while(0 && x)
#define UNREFERENCED_900(x) do{}while(0 && x)
/*-------------------------------------------------------------------*/
/* Determine GCC diagnostic pragma support level */
/*-------------------------------------------------------------------*/
#if defined(HAVE_GCC_DIAG_PRAGMA)
#define QPRAGMA( x ) _Pragma( #x )
#endif
/*-------------------------------------------------------------------*/
/* The "FIXME" macro itself to mark code needing further research */
/*-------------------------------------------------------------------*/
#if defined( _MSVC_ )
#define FIXME( _str ) __pragma( message( FIXME_LINE _str ))
#elif defined( __GNUC__ ) && defined( HAVE_GCC_DIAG_PRAGMA )
#define FIXME( _str ) QPRAGMA( message( FIXME_LINE _str ))
#endif
#ifndef FIXME
#define FIXME( _str ) /* (do nothing) */
#endif
/*-------------------------------------------------------------------*/
/* Same idea, but for unfinished code items still under development */
/*-------------------------------------------------------------------*/
#if defined( _MSVC_ )
#define TODO( _str ) __pragma( message( TODO_LINE _str ))
#elif defined( __GNUC__ ) && defined( HAVE_GCC_DIAG_PRAGMA )
#define TODO( _str ) QPRAGMA( message( TODO_LINE _str ))
#endif
#ifndef TODO
#define TODO( _str ) /* (do nothing) */
#endif
/*-------------------------------------------------------------------*/
/* Same idea, but for issuing a build "#warning ..." message */
/*-------------------------------------------------------------------*/
#if defined( _MSVC_ )
#define WARNING( _str ) __pragma( message( WARN_LINE _str ))
#elif defined( __GNUC__ ) && defined( HAVE_GCC_DIAG_PRAGMA )
#define WARNING( _str ) QPRAGMA( message( WARN_LINE _str ))
#endif
#ifndef WARNING
#define WARNING( _str ) /* (do nothing) */
#endif
/*-------------------------------------------------------------------*/
/* Same idea, but for issuing an informative note during compile */
/*-------------------------------------------------------------------*/
#if defined( _MSVC_ )
#define NOTE( _str ) __pragma( message( NOTE_LINE _str ))
#elif defined( __GNUC__ ) && defined( HAVE_GCC_DIAG_PRAGMA )
#define NOTE( _str ) QPRAGMA( message( NOTE_LINE _str ))
#endif
#ifndef NOTE
#define NOTE( _str ) /* (do nothing) */
#endif
#endif /* _CCFIXME_H_ */