SST  7.0.0
StructuralSimulationToolkit
warnmacros.h
1 // -*- c++ -*-
2 
3 // Copyright 2009-2017 Sandia Corporation. Under the terms
4 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S.
5 // Government retains certain rights in this software.
6 //
7 // Copyright (c) 2009-2017, Sandia Corporation
8 // All rights reserved.
9 //
10 // This file is part of the SST software package. For license
11 // information, see the LICENSE file in the top level directory of the
12 // distribution.
13 
14 #ifndef SST_CORE_WARNMACROS_H
15 #define SST_CORE_WARNMACROS_H
16 
17 
18 #define UNUSED(x) x __attribute__((unused))
19 
20 
21 #define DIAG_STR(s) #s
22 #define DIAG_JOINSTR(x,y) DIAG_STR(x ## y)
23 #define DIAG_DO_PRAGMA(x) _Pragma(#x)
24 #define DIAG_PRAGMA(compiler,x) DIAG_DO_PRAGMA(compiler diagnostic x)
25 
26 
27 #define DIAG_DISABLE(option) \
28  DIAG_PRAGMA(DIAG_COMPILER,push) \
29  DIAG_PRAGMA(DIAG_COMPILER,ignored DIAG_JOINSTR(-W,option))
30 
31 #define REENABLE_WARNING \
32  DIAG_PRAGMA(DIAG_COMPILER,pop)
33 
34 #if defined(__clang__)
35 #define DIAG_COMPILER clang
36 
37 
38 #define DISABLE_WARN_DEPRECATED_REGISTER \
39  DIAG_DISABLE(deprecated-register)
40 
41 #define DISABLE_WARN_STRICT_ALIASING \
42  DIAG_DISABLE(strict-aliasing)
43 
44 #define DISABLE_WARN_MISSING_OVERRIDE \
45  DIAG_DISABLE(inconsistent-missing-override)
46 
47 
48 #elif defined(__GNUC__)
49 #define DIAG_COMPILER GCC
50 
51 #define DISABLE_WARN_DEPRECATED_REGISTER
52 
53 #define DISABLE_WARN_STRICT_ALIASING \
54  DIAG_DISABLE(strict-aliasing)
55 
56 #if (__GNUC__ >= 5)
57 #define DISABLE_WARN_MISSING_OVERRIDE \
58  DIAG_DISABLE(suggest-override)
59 #else
60 #define DISABLE_WARN_MISSING_OVERRIDE
61 #endif
62 
63 #else
64 
65 #undef REENABLE_WARNING
66 #define REENABLE_WARNING
67 #define DISABLE_WARN_DEPRECATED_REGISTER
68 #define DISABLE_WARN_STRICT_ALIASING
69 #define DISABLE_WARN_MISSING_OVERRIDE
70 #endif
71 
72 #endif