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