SystemC  2.3.1
Accellera SystemC proof-of-concept library
sc_cmnhdr.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3  The following code is derived, directly or indirectly, from the SystemC
4  source code Copyright (c) 1996-2014 by all Contributors.
5  All Rights reserved.
6 
7  The contents of this file are subject to the restrictions and limitations
8  set forth in the SystemC Open Source License (the "License");
9  You may not use this file except in compliance with such restrictions and
10  limitations. You may obtain instructions on how to receive a copy of the
11  License at http://www.accellera.org/. Software distributed by Contributors
12  under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
13  ANY KIND, either express or implied. See the License for the specific
14  language governing rights and limitations under the License.
15 
16  *****************************************************************************/
17 
18 /*****************************************************************************
19 
20  sc_cmnhdr.h - Common header file containing handy pragmas, macros and
21  definitions common to all SystemC source files.
22 
23  Original Author: Amit Rao, Synopsys, Inc.
24 
25  CHANGE LOG AT THE END OF THE FILE
26  *****************************************************************************/
27 
28 
29 #ifndef SC_CMNHDR_H
30 #define SC_CMNHDR_H
31 
32 // include useful platform information from Boost
33 #include "sysc/packages/boost/config.hpp"
34 
35 #if defined(_WIN32) || defined(_MSC_VER) || defined(__BORLANDC__) || \
36  defined(__MINGW32__)
37 
38 // all windows 32-bit compilers should define WIN32
39 #if !defined(WIN32) && !defined(WIN64) && !defined(_WIN64)
40 #define WIN32
41 #endif
42 
43 // Windows Version Build Option
44 #ifndef _WIN32_WINNT
45 #define _WIN32_WINNT 0x0400
46 #endif
47 
48 // remember to later include windows.h, if needed
49 #define SC_HAS_WINDOWS_H_
50 
51 #endif // WIN32
52 
53 // ----------------------------------------------------------------------------
54 
55 #ifdef _MSC_VER
56 
57 // Disable VC++ warnings that are harmless
58 
59 // this : used in base member initializer list
60 #pragma warning(disable: 4355)
61 
62 // new and delete warning when exception handling is turned on
63 #pragma warning(disable: 4291)
64 
65 // in many places implicit conversion to bool
66 // from other integral types is performed
67 #pragma warning(disable: 4800)
68 
69 // unary minus operator applied to unsigned
70 #pragma warning(disable: 4146)
71 
72 // multiple copy constructors
73 #pragma warning(disable: 4521)
74 
75 // identifier was truncated to '255' characters in the browser information
76 #pragma warning(disable: 4786)
77 
78 #endif
79 
80 // ----------------------------------------------------------------------------
81 // helper macros to aid branch prediction on GCC (compatible) compilers
82 
83 #ifndef __GNUC__
84 # define SC_LIKELY_( x ) !!(x)
85 # define SC_UNLIKELY_( x ) !!(x)
86 #else
87 # define SC_LIKELY_( x ) __builtin_expect( !!(x), 1 )
88 # define SC_UNLIKELY_( x ) __builtin_expect( !!(x), 0 )
89 #endif
90 
91 // ----------------------------------------------------------------------------
92 
93 #include <cassert>
94 #include <cstdio>
95 #include <cstdlib>
96 
97 #endif // SC_CMNHDR_H
98 
99 // ----------------------------------------------------------------------------
100 // only include Windows.h, if explicitly requested
101 // (deliberately outside of include guards to enable later effect)
102 #if defined(SC_HAS_WINDOWS_H_) && defined(SC_INCLUDE_WINDOWS_H)
103 # undef SC_HAS_WINDOWS_H_
104 # include <Windows.h>
105 #endif
106 
107 // $Log: sc_cmnhdr.h,v $
108 // Revision 1.8 2011/08/26 20:46:09 acg
109 // Andy Goodrich: moved the modification log to the end of the file to
110 // eliminate source line number skew when check-ins are done.
111 //
112 // Revision 1.7 2011/05/09 04:07:48 acg
113 // Philipp A. Hartmann:
114 // (1) Restore hierarchy in all phase callbacks.
115 // (2) Ensure calls to before_end_of_elaboration.
116 //
117 // Revision 1.6 2011/05/05 17:45:27 acg
118 // Philip A. Hartmann: changes in WIN64 support.
119 // Andy Goodrich: additional DEBUG_MSG instances to trace process handling.
120 //
121 // Revision 1.5 2011/02/18 20:27:14 acg
122 // Andy Goodrich: Updated Copyrights.
123 //
124 // Revision 1.4 2011/02/13 21:47:37 acg
125 // Andy Goodrich: update copyright notice.
126 //
127 // Revision 1.3 2009/05/22 16:06:29 acg
128 // Andy Goodrich: process control updates.
129 //
130 // Revision 1.2 2008/05/22 17:06:24 acg
131 // Andy Goodrich: updated copyright notice to include 2008.
132 //
133 // Revision 1.1.1.1 2006/12/15 20:20:05 acg
134 // SystemC 2.3
135 //
136 // Revision 1.3 2006/01/13 18:44:29 acg
137 // Added $Log to record CVS changes into the source.
138 
139 // Taf!