From 39f243b18e4b25594835d7e5b63130ed52f78b59 Mon Sep 17 00:00:00 2001 From: Cary R Date: Wed, 7 Oct 2009 18:58:27 -0700 Subject: [PATCH 1/3] Add a configure check to see if uint64_t and unsigned long are identical. This is needed to get vvp to compile under MacOS 10.6 and possibly other 64 bit systems that define uint64_t as unsigned long long vs unsigned long (both are 64 bits). --- configure.in | 25 +++++++++++++++++++++++++ vvp/config.h.in | 3 ++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 04c70c207..4d14fcac3 100644 --- a/configure.in +++ b/configure.in @@ -167,6 +167,31 @@ AC_SEARCH_LIBS([nan], [m], [AC_DEFINE([HAVE_NAN], [1])]) AC_SEARCH_LIBS([fmin], [m], [AC_DEFINE([HAVE_FMIN], [1])]) AC_SEARCH_LIBS([fmax], [m], [AC_DEFINE([HAVE_FMAX], [1])]) +# Check to see if an unsigned long and uint64_t are the same from +# a compiler perspective. We can not just check that they are the +# same size since unsigned long and unsigned long long are not the +# same from an overloading perspective even though they could be +# the same size on some 64 bit machines. The result from this test +# is only used if inttypes.h is available, so if the test fails for +# that reason we don't care. +AC_LANG(C++) +AC_MSG_CHECKING(if uint64_t and unsigned long are identical) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include "inttypes.h" +static bool check(unsigned long val) +{ + return val != 0; +} +static bool check(uint64_t val) +{ + return val != 0; +}]], [[unsigned long ulval = 1; +bool result = check(ulval); +uint64_t uival = 1; +result &= check(uival); +return !result;]])], + [AC_MSG_RESULT(no)], + [AC_DEFINE([UINT64_T_AND_ULONG_SAME], [1]) AC_MSG_RESULT(yes)]) + # Linker option used when compiling the target AX_LD_RDYNAMIC diff --git a/vvp/config.h.in b/vvp/config.h.in index 71691a402..50b4c5450 100644 --- a/vvp/config.h.in +++ b/vvp/config.h.in @@ -49,6 +49,7 @@ # undef HAVE_INTTYPES_H # undef HAVE_LROUND # undef HAVE_NAN +# undef UINT64_T_AND_ULONG_SAME /* * Define this if you want to compile vvp with memory freeing and @@ -89,7 +90,7 @@ typedef uint64_t vvp_time64_t; # define TIME_FMT_U PRIu64 # define TIME_FMT_X PRIx64 -# if SIZEOF_UNSIGNED_LONG == 8 +# if UINT64_T_AND_ULONG_SAME # define UL_AND_TIME64_SAME # endif From 3303cc144fbccf7ab36d0dfc6db67c637bb79202 Mon Sep 17 00:00:00 2001 From: Cary R Date: Thu, 8 Oct 2009 11:39:16 -0700 Subject: [PATCH 2/3] Fix obscure valgrind memory leak. --- ivlpp/main.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ivlpp/main.c b/ivlpp/main.c index 1b3906c55..9c360fad9 100644 --- a/ivlpp/main.c +++ b/ivlpp/main.c @@ -370,7 +370,7 @@ int main(int argc, char*argv[]) } } - if(dep_path) { + if (dep_path) { depend_file = fopen(dep_path, "a"); if (depend_file == 0) { perror(dep_path); @@ -389,8 +389,8 @@ int main(int argc, char*argv[]) if (yylex()) return -1; destroy_lexor(); - if(depend_file) { - fclose(depend_file); + if (depend_file) { + fclose(depend_file); } if (precomp_out) { @@ -398,6 +398,10 @@ int main(int argc, char*argv[]) fclose(precomp_out); } + if (out_path) { + fclose(out); + } + /* Free the source and include directory lists. */ for (lp = 0; lp < source_cnt; lp += 1) { free(source_list[lp]); From ff39575dc0cb9ee6408d90b4d9f396edd3f16874 Mon Sep 17 00:00:00 2001 From: Cary R Date: Thu, 8 Oct 2009 13:06:59 -0700 Subject: [PATCH 3/3] We must have autoconf version 2.60 or later. When AC_PROG_CC_C99 was added recently we created an implicit requirement for autoconf version 2.60. This patch makes that implicit requirement and explicit requirement. --- configure.in | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/configure.in b/configure.in index 4d14fcac3..5def57326 100644 --- a/configure.in +++ b/configure.in @@ -11,6 +11,12 @@ AC_CONFIG_HEADER(tgt-vhdl/vhdl_config.h) AC_CANONICAL_HOST dnl Checks for programs. AC_PROG_CC +# AC_PROG_CC_C99 is only available in autoconf version 2.60 and later. +# If you must use an older version then comment out the following two +# lines, but be warned that there could be issues with finding the +# nan(), etc. functions. It is really best to upgrade to a supported +# version of autoconf. +AC_PREREQ([2.60]) AC_PROG_CC_C99 AC_PROG_CXX AC_PROG_RANLIB