From d65106374964c98c16837ebcb9fc5d2ff8bfcdb0 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sat, 16 Jan 2010 11:53:08 -0500 Subject: [PATCH] Fix Cygwin 1.7.x compiler error with uint32_t, bug204. --- Changes | 2 ++ include/verilatedos.h | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Changes b/Changes index ece36e9c2..f68adc9c5 100644 --- a/Changes +++ b/Changes @@ -50,6 +50,8 @@ indicates the contributor was also the author of the fix; Thanks! **** Fix MinGW compilation, bug184. [by Shankar Giri] +**** Fix Cygwin 1.7.x compiler error with uint32_t, bug204. [Ivan Djordjevic] + **** Fix `define argument mis-replacing system task of same name, bug191. **** Fix Verilator core dump on wide integer divides, bug178. [Byron Bradley] diff --git a/include/verilatedos.h b/include/verilatedos.h index ea51529a0..37d4f49aa 100644 --- a/include/verilatedos.h +++ b/include/verilatedos.h @@ -79,17 +79,25 @@ #ifdef VL_UINTS_DEFINED #elif defined(__CYGWIN__) + # include typedef unsigned char uint8_t; ///< 8-bit unsigned type (backward compatibility) typedef unsigned short int uint16_t; ///< 16-bit unsigned type (backward compatibility) -typedef unsigned long uint32_t; ///< 32-bit unsigned type (backward compatibility) typedef unsigned char vluint8_t; ///< 8-bit unsigned type typedef unsigned short int vluint16_t; ///< 16-bit unsigned type -typedef long vlsint32_t; ///< 32-bit signed type -typedef unsigned long vluint32_t; ///< 32-bit unsigned type +# ifdef __uint32_t_defined // Newer Cygwin uint32_t in stdint.h as an unsigned int +typedef int32_t vlsint32_t; ///< 32-bit signed type +typedef uint32_t vluint32_t; ///< 32-bit unsigned type +# else // Older Cygwin has long==uint32_t +typedef unsigned long uint32_t; ///< 32-bit unsigned type (backward compatibility) +typedef long vlsint32_t; ///< 32-bit signed type +typedef unsigned long vluint32_t; ///< 32-bit unsigned type +# endif typedef long long vlsint64_t; ///< 64-bit signed type typedef unsigned long long vluint64_t; ///< 64-bit unsigned type + #elif defined(_WIN32) && defined(_MSC_VER) + typedef unsigned char uint8_t; ///< 8-bit unsigned type (backward compatibility) typedef unsigned short int uint16_t; ///< 16-bit unsigned type (backward compatibility) typedef unsigned int uint32_t; ///< 32-bit unsigned type (backward compatibility) @@ -99,7 +107,9 @@ typedef int vlsint32_t; ///< 32-bit signed type typedef unsigned int vluint32_t; ///< 32-bit unsigned type typedef __int64 vlsint64_t; ///< 64-bit signed type typedef unsigned __int64 vluint64_t; ///< 64-bit unsigned type + #else // Linux or compliant Unix flavors, -m64 + # include // Linux and most flavors # include // Solaris typedef uint8_t vluint8_t; ///< 32-bit unsigned type