Clean up MCS/GNU portability hacks in header files.

This commit is contained in:
Stephen Williams 2015-07-23 17:35:31 -07:00
parent d766e82aa1
commit 64b72cf7e1
2 changed files with 22 additions and 36 deletions

View File

@ -41,6 +41,12 @@
# define __attribute__(x)
#endif
#if defined(__cplusplus) && defined(_MSC_VER)
# define ENUM_UNSIGNED_INT : unsigned int
#else
# define ENUM_UNSIGNED_INT
#endif
_BEGIN_DECL
/*
@ -201,11 +207,7 @@ typedef enum ivl_dis_domain_e {
IVL_DIS_CONTINUOUS = 2
} ivl_dis_domain_t;
#if defined(__cplusplus) && !defined(__GNUC__)
typedef enum ivl_drive_e : unsigned int {
#else
typedef enum ivl_drive_e {
#endif
typedef enum ivl_drive_e ENUM_UNSIGNED_INT {
IVL_DR_HiZ = 0,
IVL_DR_SMALL = 1,
IVL_DR_MEDIUM = 2,
@ -247,11 +249,7 @@ typedef enum ivl_expr_type_e {
IVL_EX_UNARY = 14
} ivl_expr_type_t;
#if defined(__cplusplus) && !defined(__GNUC__)
typedef enum ivl_select_type_e : unsigned int {
#else
typedef enum ivl_select_type_e {
#endif
typedef enum ivl_select_type_e ENUM_UNSIGNED_INT {
IVL_SEL_OTHER = 0,
IVL_SEL_IDX_UP = 1,
IVL_SEL_IDX_DOWN = 2
@ -353,11 +351,7 @@ typedef enum ivl_path_edge_e {
/* Processes are initial, always, or final blocks with a statement. This is
the type of the ivl_process_t object. */
#if defined(__cplusplus) && !defined(__GNUC__)
typedef enum ivl_process_type_e : unsigned int {
#else
typedef enum ivl_process_type_e {
#endif
typedef enum ivl_process_type_e ENUM_UNSIGNED_INT {
IVL_PR_INITIAL = 0,
IVL_PR_ALWAYS = 1,
IVL_PR_FINAL = 2
@ -443,11 +437,7 @@ typedef enum ivl_sfunc_as_task_e {
/* This is the type of a variable, and also used as the type for an
expression. */
#if defined(__cplusplus) && !defined(__GNUC__)
typedef enum ivl_variable_type_e : unsigned int {
#else
typedef enum ivl_variable_type_e {
#endif
typedef enum ivl_variable_type_e ENUM_UNSIGNED_INT {
IVL_VT_VOID = 0, /* Not used */
IVL_VT_NO_TYPE = 1, /* Place holder for missing/unknown type. */
IVL_VT_REAL = 2,
@ -2359,4 +2349,6 @@ typedef const char* (*target_query_f) (const char*key);
_END_DECL
#undef ENUM_UNSIGNED_INT
#endif /* IVL_ivl_target_H */

View File

@ -90,6 +90,12 @@ class netvector_t;
struct target;
struct functor_t;
#if defined(__cplusplus) && defined(_MSC_VER)
# define ENUM_UNSIGNED_INT : unsigned int
#else
# define ENUM_UNSIGNED_INT
#endif
ostream& operator << (ostream&o, ivl_variable_type_t val);
extern void join_island(NetPins*obj);
@ -102,12 +108,7 @@ class Link {
friend class NexusSet;
public:
#if defined(__cplusplus) && !defined(__GNUC__)
enum DIR : unsigned int { PASSIVE, INPUT, OUTPUT };
#else
enum DIR { PASSIVE, INPUT, OUTPUT };
#endif
enum DIR ENUM_UNSIGNED_INT { PASSIVE, INPUT, OUTPUT };
private: // Only NetPins can create/delete Link objects
Link();
~Link();
@ -623,11 +624,7 @@ class NetDelaySrc : public NetObj {
class PortType
{
public:
#if defined(__cplusplus) && !defined(__GNUC__)
enum Enum : unsigned int { NOT_A_PORT, PIMPLICIT, PINPUT, POUTPUT, PINOUT, PREF };
#else
enum Enum { NOT_A_PORT, PIMPLICIT, PINPUT, POUTPUT, PINOUT, PREF };
#endif
enum Enum ENUM_UNSIGNED_INT { NOT_A_PORT, PIMPLICIT, PINPUT, POUTPUT, PINOUT, PREF };
/*
* Merge Port types (used to construct a sane combined port-type
@ -655,11 +652,7 @@ struct PortInfo
class NetNet : public NetObj, public PortType {
public:
#if defined(__cplusplus) && !defined(__GNUC__)
enum Type : unsigned int { NONE, IMPLICIT, IMPLICIT_REG, INTEGER, WIRE, TRI, TRI1,
#else
enum Type { NONE, IMPLICIT, IMPLICIT_REG, INTEGER, WIRE, TRI, TRI1,
#endif
enum Type ENUM_UNSIGNED_INT { NONE, IMPLICIT, IMPLICIT_REG, INTEGER, WIRE, TRI, TRI1,
SUPPLY0, SUPPLY1, WAND, TRIAND, TRI0, WOR, TRIOR, REG,
UNRESOLVED_WIRE };
@ -5017,4 +5010,5 @@ inline unsigned Link::get_pin() const
return pin_;
}
#undef ENUM_UNSIGNED_INT
#endif /* IVL_netlist_H */