From 34c34e33cf67890ae6a76b386a8c6b058fe6826b Mon Sep 17 00:00:00 2001 From: Cary R Date: Fri, 11 Jun 2010 18:44:21 -0700 Subject: [PATCH] V0.9: back port of SunPro compiler support. This patch combines all the changes needed to back port support for the SunPro compilers to the stable branch. --- aclocal.m4 | 13 +++++++++++++ ivlpp/lexor.lex | 2 +- libveriuser/a_fetch_type.c | 11 ++++------- libveriuser/a_fetch_type_str.c | 9 +++------ net_scope.cc | 10 +++++----- tgt-vhdl/process.cc | 4 ++-- tgt-vhdl/scope.cc | 14 +++++++------- tgt-vhdl/support.hh | 4 ++-- tgt-vhdl/vhdl_syntax.hh | 12 ++++++------ tgt-vhdl/vhdl_target.h | 2 +- tgt-vhdl/vhdl_type.hh | 4 ++-- tgt-vvp/vvp_process.c | 12 ++---------- verinum.cc | 7 +++---- vpi/sys_clog2.c | 4 ++-- vpi/sys_convert.c | 4 +--- vpi/sys_deposit.c | 4 +--- vpi/sys_display.c | 5 +---- vpi/sys_fileio.c | 3 +-- vpi/sys_finish.c | 4 +--- vpi/sys_icarus.c | 5 ++--- vpi/sys_lxt.c | 6 ++---- vpi/sys_lxt2.c | 6 ++---- vpi/sys_plusargs.c | 3 +-- vpi/sys_priv.c | 2 +- vpi/sys_random.c | 3 +-- vpi/sys_random_mti.c | 3 +-- vpi/sys_readmem.c | 3 --- vpi/sys_scanf.c | 1 - vpi/sys_sdf.c | 7 ++----- vpi/sys_time.c | 7 ++----- vpi/sys_vcd.c | 1 - vpi/sys_vcdoff.c | 1 - vpi/v2005_math.c | 4 ++-- vpi/va_math.c | 4 ++-- vpi/vams_simparam.c | 5 ++--- vpi/vcd_priv.c | 3 +-- vvp/compile.cc | 4 ++-- vvp/schedule.cc | 2 +- vvp/statistics.h | 5 +++++ vvp/symbols.cc | 15 ++++++++------- vvp/vpi_signal.cc | 15 ++++++++++----- 41 files changed, 105 insertions(+), 128 deletions(-) diff --git a/aclocal.m4 b/aclocal.m4 index 368f7da60..0de601e2b 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -127,6 +127,13 @@ case "${host}" in *-*-darwin*) shared="-bundle -undefined suppress -flat_namespace" ;; + + *-*-solaris*) + if test ${using_sunpro_c} = 1 + then + shared="-G" + fi + ;; esac AC_SUBST(shared) AC_MSG_RESULT($shared) @@ -153,6 +160,12 @@ case "${host}" in PICFLAG=+z ;; + *-*-solaris*) + if test ${using_sunpro_c} = 1 + then + PICFLAG=-G + fi + ;; esac AC_SUBST(PICFLAG) AC_MSG_RESULT($PICFLAG) diff --git a/ivlpp/lexor.lex b/ivlpp/lexor.lex index fb2291bfd..796ee467f 100644 --- a/ivlpp/lexor.lex +++ b/ivlpp/lexor.lex @@ -1217,7 +1217,7 @@ static void macro_start_args() def_argo[0] = 0; def_argl[0] = 0; def_argc = 1; -}; +} static void macro_add_to_arg(int is_white_space) { diff --git a/libveriuser/a_fetch_type.c b/libveriuser/a_fetch_type.c index d5aa92a3d..2a61f7422 100644 --- a/libveriuser/a_fetch_type.c +++ b/libveriuser/a_fetch_type.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2009 Stephen Williams (steve@icarus.com) + * Copyright (c) 2003-2010 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -56,14 +56,11 @@ PLI_INT32 acc_fetch_type(handle obj) case vpiModule: return accModule; - - default: - vpi_printf("acc_fetch_type: vpiType %d is what accType?\n", - (int)vpi_get(vpiType, obj)); - return accUnknown; } - return 0; + vpi_printf("acc_fetch_type: vpiType %d is what accType?\n", + (int)vpi_get(vpiType, obj)); + return accUnknown; } PLI_INT32 acc_fetch_fulltype(handle obj) diff --git a/libveriuser/a_fetch_type_str.c b/libveriuser/a_fetch_type_str.c index 7dcc6144e..6b8b5464b 100644 --- a/libveriuser/a_fetch_type_str.c +++ b/libveriuser/a_fetch_type_str.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2009 Stephen Williams (steve@icarus.com) + * Copyright (c) 2003-2010 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -36,11 +36,8 @@ char* acc_fetch_type_str(PLI_INT32 type) case accConstant: return "accConstant"; - - default: - vpi_printf("XXXX acc_fetch_type_str(%d);\n", (int)type); - return "acc_fetch_type_str(unknown)"; } - return ""; + vpi_printf("acc_fetch_type_str: type %d is what accType?\n", (int)type); + return "acc_fetch_type_str(unknown)"; } diff --git a/net_scope.cc b/net_scope.cc index ae0497650..43ab93759 100644 --- a/net_scope.cc +++ b/net_scope.cc @@ -218,14 +218,14 @@ map::iterator NetScope::find_parameter(perm_ map::iterator idx; idx = parameters.find(key); - if (idx != parameters.end()) - return idx; + if (idx != parameters.end()) return idx; idx = localparams.find(perm_string::literal(key)); - if (idx != localparams.end()) - return idx; + if (idx != localparams.end()) return idx; - return (map::iterator) 0; + // To get here the parameter must already exist, so we should + // never get here. + assert(0); } NetScope::TYPE NetScope::type() const diff --git a/tgt-vhdl/process.cc b/tgt-vhdl/process.cc index d3813caa5..9440b25cf 100644 --- a/tgt-vhdl/process.cc +++ b/tgt-vhdl/process.cc @@ -1,7 +1,7 @@ /* * VHDL code generation for processes. * - * Copyright (C) 2008 Nick Gasson (nick@nickg.me.uk) + * Copyright (C) 2008-2010 Nick Gasson (nick@nickg.me.uk) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -83,7 +83,7 @@ static int generate_vhdl_process(vhdl_entity *ent, ivl_process_t proc) return 0; } -int draw_process(ivl_process_t proc, void *cd) +extern "C" int draw_process(ivl_process_t proc, void *cd) { ivl_scope_t scope = ivl_process_scope(proc); diff --git a/tgt-vhdl/scope.cc b/tgt-vhdl/scope.cc index ed81a37aa..0014e3012 100644 --- a/tgt-vhdl/scope.cc +++ b/tgt-vhdl/scope.cc @@ -1,7 +1,7 @@ /* * VHDL code generation for scopes. * - * Copyright (C) 2008-2009 Nick Gasson (nick@nickg.me.uk) + * Copyright (C) 2008-2010 Nick Gasson (nick@nickg.me.uk) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -921,7 +921,7 @@ static void create_skeleton_entity_for(ivl_scope_t scope, int depth) * A first pass through the hierarchy: create VHDL entities for * each unique Verilog module type. */ -static int draw_skeleton_scope(ivl_scope_t scope, void *_unused) +extern "C" int draw_skeleton_scope(ivl_scope_t scope, void *_unused) { static int depth = 0; @@ -949,7 +949,7 @@ static int draw_skeleton_scope(ivl_scope_t scope, void *_unused) return rc; } -static int draw_all_signals(ivl_scope_t scope, void *_parent) +extern "C" int draw_all_signals(ivl_scope_t scope, void *_parent) { if (!is_default_scope_instance(scope)) return 0; // Not interested in this instance @@ -981,7 +981,7 @@ static int draw_all_signals(ivl_scope_t scope, void *_parent) /* * Draw all tasks and functions in the hierarchy. */ -static int draw_functions(ivl_scope_t scope, void *_parent) +extern "C" int draw_functions(ivl_scope_t scope, void *_parent) { if (!is_default_scope_instance(scope)) return 0; // Not interested in this instance @@ -1005,7 +1005,7 @@ static int draw_functions(ivl_scope_t scope, void *_parent) * This also has the side effect of generating all the necessary * nexus code. */ -static int draw_constant_drivers(ivl_scope_t scope, void *_parent) +extern "C" int draw_constant_drivers(ivl_scope_t scope, void *_parent) { if (!is_default_scope_instance(scope)) return 0; // Not interested in this instance @@ -1080,7 +1080,7 @@ static int draw_constant_drivers(ivl_scope_t scope, void *_parent) return 0; } -static int draw_all_logic_and_lpm(ivl_scope_t scope, void *_parent) +extern "C" int draw_all_logic_and_lpm(ivl_scope_t scope, void *_parent) { if (!is_default_scope_instance(scope)) return 0; // Not interested in this instance @@ -1100,7 +1100,7 @@ static int draw_all_logic_and_lpm(ivl_scope_t scope, void *_parent) return ivl_scope_children(scope, draw_all_logic_and_lpm, scope); } -static int draw_hierarchy(ivl_scope_t scope, void *_parent) +extern "C" int draw_hierarchy(ivl_scope_t scope, void *_parent) { if (ivl_scope_type(scope) == IVL_SCT_MODULE && _parent) { ivl_scope_t parent = static_cast(_parent); diff --git a/tgt-vhdl/support.hh b/tgt-vhdl/support.hh index 2f55416e1..1487cb036 100644 --- a/tgt-vhdl/support.hh +++ b/tgt-vhdl/support.hh @@ -1,7 +1,7 @@ /* * Support functions for VHDL output. * - * Copyright (C) 2008 Nick Gasson (nick@nickg.me.uk) + * Copyright (C) 2008-2010 Nick Gasson (nick@nickg.me.uk) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -36,7 +36,7 @@ enum support_function_t { SF_TERNARY_SIGNED, SF_LOGIC_TO_INTEGER, SF_SIGNED_TO_LOGIC, - SF_UNSIGNED_TO_LOGIC, + SF_UNSIGNED_TO_LOGIC }; class support_function : public vhdl_function { diff --git a/tgt-vhdl/vhdl_syntax.hh b/tgt-vhdl/vhdl_syntax.hh index 2b596a227..9253eeff1 100644 --- a/tgt-vhdl/vhdl_syntax.hh +++ b/tgt-vhdl/vhdl_syntax.hh @@ -1,7 +1,7 @@ /* * VHDL abstract syntax elements. * - * Copyright (C) 2008-2009 Nick Gasson (nick@nickg.me.uk) + * Copyright (C) 2008-2010 Nick Gasson (nick@nickg.me.uk) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -96,7 +96,7 @@ enum vhdl_binop_t { VHDL_BINOP_DIV, VHDL_BINOP_MOD, VHDL_BINOP_POWER, - VHDL_BINOP_SRA, + VHDL_BINOP_SRA }; /* @@ -123,7 +123,7 @@ private: enum vhdl_unaryop_t { VHDL_UNARYOP_NOT, - VHDL_UNARYOP_NEG, + VHDL_UNARYOP_NEG }; class vhdl_unaryop_expr : public vhdl_expr { @@ -206,7 +206,7 @@ enum time_unit_t { TIME_UNIT_PS, TIME_UNIT_NS, TIME_UNIT_US, - TIME_UNIT_MS, + TIME_UNIT_MS }; class vhdl_const_time : public vhdl_expr { @@ -397,7 +397,7 @@ enum vhdl_wait_type_t { VHDL_WAIT_FOR, // Wait for a constant amount of time VHDL_WAIT_FOR0, // Special wait for zero time VHDL_WAIT_UNTIL, // Wait on an expression - VHDL_WAIT_ON, // Wait on a sensitivity list + VHDL_WAIT_ON // Wait on a sensitivity list }; /* @@ -657,7 +657,7 @@ enum vhdl_port_mode_t { VHDL_PORT_IN, VHDL_PORT_OUT, VHDL_PORT_INOUT, - VHDL_PORT_BUFFER, + VHDL_PORT_BUFFER }; /* diff --git a/tgt-vhdl/vhdl_target.h b/tgt-vhdl/vhdl_target.h index a70980493..8d99d97a1 100644 --- a/tgt-vhdl/vhdl_target.h +++ b/tgt-vhdl/vhdl_target.h @@ -15,7 +15,7 @@ void error(const char *fmt, ...); void debug_msg(const char *fmt, ...); int draw_scope(ivl_scope_t scope, void *_parent); -int draw_process(ivl_process_t net, void *cd); +extern "C" int draw_process(ivl_process_t net, void *cd); int draw_stmt(vhdl_procedural *proc, stmt_container *container, ivl_statement_t stmt, bool is_last = false); int draw_lpm(vhdl_arch *arch, ivl_lpm_t lpm); diff --git a/tgt-vhdl/vhdl_type.hh b/tgt-vhdl/vhdl_type.hh index f3bfb2211..3d551a3f2 100644 --- a/tgt-vhdl/vhdl_type.hh +++ b/tgt-vhdl/vhdl_type.hh @@ -1,7 +1,7 @@ /* * VHDL variable and signal types. * - * Copyright (C) 2008 Nick Gasson (nick@nickg.me.uk) + * Copyright (C) 2008-2010 Nick Gasson (nick@nickg.me.uk) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -34,7 +34,7 @@ enum vhdl_type_name_t { VHDL_TYPE_SIGNED, VHDL_TYPE_UNSIGNED, VHDL_TYPE_TIME, - VHDL_TYPE_ARRAY, + VHDL_TYPE_ARRAY }; /* diff --git a/tgt-vvp/vvp_process.c b/tgt-vvp/vvp_process.c index bab263b44..b2e679d22 100644 --- a/tgt-vvp/vvp_process.c +++ b/tgt-vvp/vvp_process.c @@ -583,19 +583,11 @@ static int show_stmt_assign(ivl_statement_t net) lval = ivl_stmt_lval(net, 0); sig = ivl_lval_sig(lval); - if (sig) switch (ivl_signal_data_type(sig)) { - - case IVL_VT_REAL: + if (sig && (ivl_signal_data_type(sig) == IVL_VT_REAL)) { return show_stmt_assign_sig_real(net); - - default: - return show_stmt_assign_vector(net); - - } else { - return show_stmt_assign_vector(net); } - return 0; + return show_stmt_assign_vector(net); } /* diff --git a/verinum.cc b/verinum.cc index 4c0250808..4e7be7668 100644 --- a/verinum.cc +++ b/verinum.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2009 Stephen Williams (steve@icarus.com) + * Copyright (c) 1998-2010 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -514,14 +514,13 @@ string verinum::as_string() const if (char_val == '"' || char_val == '\\') { char tmp[5]; - snprintf(tmp, sizeof tmp, "\\\%03o", char_val); + snprintf(tmp, sizeof tmp, "\\%03o", char_val); res = res + tmp; } else if (char_val == ' ' || isgraph(char_val)) { res = res + char_val; - } else { char tmp[5]; - snprintf(tmp, sizeof tmp, "\\\%03o", char_val); + snprintf(tmp, sizeof tmp, "\\%03o", char_val); res = res + tmp; } } diff --git a/vpi/sys_clog2.c b/vpi/sys_clog2.c index 34c7442a3..960f65915 100644 --- a/vpi/sys_clog2.c +++ b/vpi/sys_clog2.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2009 Cary R. (cygcary@yahoo.com) + * Copyright (C) 2008-2010 Cary R. (cygcary@yahoo.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,7 +19,7 @@ #include #include #include -#include +#include "vpi_user.h" /* * This routine returns 1 if the argument supports has a numeric value, diff --git a/vpi/sys_convert.c b/vpi/sys_convert.c index d8dd175c6..57a09c2af 100644 --- a/vpi/sys_convert.c +++ b/vpi/sys_convert.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2009 Michael Ruff (mruff at chiaro.com) + * Copyright (c) 2003-2010 Michael Ruff (mruff at chiaro.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -17,8 +17,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -# include "vpi_config.h" -# include "vpi_user.h" # include "sys_priv.h" # include # include diff --git a/vpi/sys_deposit.c b/vpi/sys_deposit.c index 401916aa2..603bcdb6b 100644 --- a/vpi/sys_deposit.c +++ b/vpi/sys_deposit.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999-2009 Stephen Williams (steve@icarus.com) + * Copyright (c) 1999-2010 Stephen Williams (steve@icarus.com) * Copyright (c) 2000 Stephan Boettcher * * This source code is free software; you can redistribute it @@ -18,8 +18,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -# include "vpi_config.h" -# include "vpi_user.h" # include "sys_priv.h" # include # include diff --git a/vpi/sys_display.c b/vpi/sys_display.c index d463f0781..6cb0c369c 100644 --- a/vpi/sys_display.c +++ b/vpi/sys_display.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999-2009 Stephen Williams (steve@icarus.com) + * Copyright (c) 1999-2010 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -17,9 +17,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -# include "vpi_config.h" - -# include "vpi_user.h" # include "sys_priv.h" # include # include diff --git a/vpi/sys_fileio.c b/vpi/sys_fileio.c index 938dee292..3e26b9516 100644 --- a/vpi/sys_fileio.c +++ b/vpi/sys_fileio.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2009 Stephen Williams (steve@icarus.com) + * Copyright (c) 2003-2010 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -17,7 +17,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -# include "vpi_user.h" # include "sys_priv.h" # include # include diff --git a/vpi/sys_finish.c b/vpi/sys_finish.c index f55dd312e..9f4b6e0a5 100644 --- a/vpi/sys_finish.c +++ b/vpi/sys_finish.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999-2008 Stephen Williams (steve@icarus.com) + * Copyright (c) 1999-2010 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -17,8 +17,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -#include "vpi_config.h" -#include "vpi_user.h" #include "sys_priv.h" #include diff --git a/vpi/sys_icarus.c b/vpi/sys_icarus.c index 8551057a8..d2c33430f 100644 --- a/vpi/sys_icarus.c +++ b/vpi/sys_icarus.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2009 Cary R. (cygcary@yahoo.com) + * Copyright (C) 2008-2010 Cary R. (cygcary@yahoo.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,9 +16,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include -#include #include "sys_priv.h" +#include static PLI_INT32 finish_and_return_calltf(PLI_BYTE8* name) { diff --git a/vpi/sys_lxt.c b/vpi/sys_lxt.c index d57412684..494b820c1 100644 --- a/vpi/sys_lxt.c +++ b/vpi/sys_lxt.c @@ -17,17 +17,15 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -/* The vpi_config.h include must be before the lxt_write.h include! */ -# include "vpi_config.h" -# include "lxt_write.h" +/* The sys_priv.h include must be before the lxt_write.h include! */ # include "sys_priv.h" +# include "lxt_write.h" # include "vcd_priv.h" /* * This file contains the implementations of the LXT related functions. */ -# include "vpi_user.h" # include # include # include diff --git a/vpi/sys_lxt2.c b/vpi/sys_lxt2.c index e7fa31e8d..eed1cc8b6 100644 --- a/vpi/sys_lxt2.c +++ b/vpi/sys_lxt2.c @@ -17,17 +17,15 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -/* The vpi_config.h include must be before the lxt2_write.h include! */ -# include "vpi_config.h" -# include "lxt2_write.h" +/* The sys_priv.h include must be before the lxt2_write.h include! */ # include "sys_priv.h" +# include "lxt2_write.h" # include "vcd_priv.h" /* * This file contains the implementations of the LXT2 related functions. */ -# include "vpi_user.h" # include # include # include diff --git a/vpi/sys_plusargs.c b/vpi/sys_plusargs.c index 09ee65f4a..526a65d93 100644 --- a/vpi/sys_plusargs.c +++ b/vpi/sys_plusargs.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2008 Stephen Williams (steve@icarus.com) + * Copyright (c) 2002-2010 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -18,7 +18,6 @@ */ # include "sys_priv.h" -# include # include # include # include diff --git a/vpi/sys_priv.c b/vpi/sys_priv.c index c0d13f5c8..a120b17a0 100644 --- a/vpi/sys_priv.c +++ b/vpi/sys_priv.c @@ -17,11 +17,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ +#include "sys_priv.h" #include #include #include #include -#include "sys_priv.h" PLI_UINT64 timerec_to_time64(const struct t_vpi_time*time) { diff --git a/vpi/sys_random.c b/vpi/sys_random.c index dce58decd..b45931cb9 100644 --- a/vpi/sys_random.c +++ b/vpi/sys_random.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2009 Stephen Williams (steve@icarus.com) + * Copyright (c) 2000-2010 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -20,7 +20,6 @@ # include "sys_priv.h" # include "sys_random.h" -# include # include # include # include diff --git a/vpi/sys_random_mti.c b/vpi/sys_random_mti.c index 7294e0f6a..faaaae77e 100644 --- a/vpi/sys_random_mti.c +++ b/vpi/sys_random_mti.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2009 Stephen Williams (steve@icarus.com) + * Copyright (c) 2000-2010 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -20,7 +20,6 @@ # include "sys_priv.h" # include "sys_random.h" -# include # include # include # include diff --git a/vpi/sys_readmem.c b/vpi/sys_readmem.c index 638d2ee83..180d8af07 100644 --- a/vpi/sys_readmem.c +++ b/vpi/sys_readmem.c @@ -17,9 +17,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -# include "vpi_config.h" - -# include "vpi_user.h" # include "sys_priv.h" # include # include diff --git a/vpi/sys_scanf.c b/vpi/sys_scanf.c index 52cd923ee..616cea87f 100644 --- a/vpi/sys_scanf.c +++ b/vpi/sys_scanf.c @@ -21,7 +21,6 @@ # define _ISOC99_SOURCE 1 # define _SVID_SOURCE 1 -# include "vpi_user.h" # include "sys_priv.h" # include # include diff --git a/vpi/sys_sdf.c b/vpi/sys_sdf.c index 3c999eba0..c0d9a5f2b 100644 --- a/vpi/sys_sdf.c +++ b/vpi/sys_sdf.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2009 Stephen Williams (steve@icarus.com) + * Copyright (c) 2007-2010 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -17,11 +17,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -# include "vpi_config.h" - -# include "vpi_user.h" -# include "sdf_priv.h" # include "sys_priv.h" +# include "sdf_priv.h" # include # include # include diff --git a/vpi/sys_time.c b/vpi/sys_time.c index 83ac46407..3f40c7e4d 100644 --- a/vpi/sys_time.c +++ b/vpi/sys_time.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2009 Stephen Williams (steve@icarus.com) + * Copyright (c) 2000-2010 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -17,13 +17,10 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -#include "vpi_config.h" - -#include "vpi_user.h" +#include "sys_priv.h" #include #include #include -#include static PLI_INT32 sys_time_calltf(PLI_BYTE8*name) { diff --git a/vpi/sys_vcd.c b/vpi/sys_vcd.c index eeed128c2..6edd7d052 100644 --- a/vpi/sys_vcd.c +++ b/vpi/sys_vcd.c @@ -24,7 +24,6 @@ * This file contains the implementations of the VCD related functions. */ -# include "vpi_user.h" # include # include # include diff --git a/vpi/sys_vcdoff.c b/vpi/sys_vcdoff.c index 51e8dd1b9..4a88be8fd 100644 --- a/vpi/sys_vcdoff.c +++ b/vpi/sys_vcdoff.c @@ -23,7 +23,6 @@ * This file contains do nothing stubs of all the VCD routines. */ -# include "vpi_user.h" # include # include # include diff --git a/vpi/v2005_math.c b/vpi/v2005_math.c index feda0818c..4b5f9ce7e 100644 --- a/vpi/v2005_math.c +++ b/vpi/v2005_math.c @@ -2,7 +2,7 @@ * Verilog-2005 math library for Icarus Verilog * http://www.icarus.com/eda/verilog/ * - * Copyright (C) 2007-2009 Cary R. (cygcary@yahoo.com) + * Copyright (C) 2007-2010 Cary R. (cygcary@yahoo.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,7 +24,7 @@ #include #include #include -#include +#include "vpi_user.h" /* Single argument functions. */ typedef struct s_single_data { diff --git a/vpi/va_math.c b/vpi/va_math.c index 576260a85..177c9fe3b 100644 --- a/vpi/va_math.c +++ b/vpi/va_math.c @@ -2,7 +2,7 @@ * Verilog-A math library for Icarus Verilog * http://www.icarus.com/eda/verilog/ * - * Copyright (C) 2007-2009 Cary R. (cygcary@yahoo.com) + * Copyright (C) 2007-2010 Cary R. (cygcary@yahoo.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,7 +24,7 @@ #include #include #include -#include +#include "vpi_user.h" /* * Compile time options: (set in the Makefile.) diff --git a/vpi/vams_simparam.c b/vpi/vams_simparam.c index ebe2375e4..cdc1f4c5f 100644 --- a/vpi/vams_simparam.c +++ b/vpi/vams_simparam.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2009 Cary R. (cygcary@yahoo.com) + * Copyright (C) 2008-2010 Cary R. (cygcary@yahoo.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,13 +16,12 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include "sys_priv.h" #include #include #include #include #include -#include -#include "sys_priv.h" #include "version_base.h" /* Once we have real string objects replace this with a dynamic string. */ diff --git a/vpi/vcd_priv.c b/vpi/vcd_priv.c index 38af265f4..6dc5c4c00 100644 --- a/vpi/vcd_priv.c +++ b/vpi/vcd_priv.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -#include "vpi_config.h" +#include "sys_priv.h" #include "vcd_priv.h" #include #include @@ -25,7 +25,6 @@ #include #include #include "stringheap.h" -#include int is_escaped_id(const char *name) { diff --git a/vvp/compile.cc b/vvp/compile.cc index 62c58c742..b34e0f39b 100644 --- a/vvp/compile.cc +++ b/vvp/compile.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001-2009 Stephen Williams (steve@icarus.com) + * Copyright (c) 2001-2010 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -64,7 +64,7 @@ enum operand_e { /* The operand is a second functor pointer */ OA_FUNC_PTR2, /* The operand is a VPI handle */ - OA_VPI_PTR, + OA_VPI_PTR }; struct opcode_table_s { diff --git a/vvp/schedule.cc b/vvp/schedule.cc index b7687779b..505cb713b 100644 --- a/vvp/schedule.cc +++ b/vvp/schedule.cc @@ -369,7 +369,7 @@ bool schedule_stopped(void) * These are the signal handling infrastructure. The SIGINT signal * leads to an implicit $stop. */ -static void signals_handler(int) +extern "C" void signals_handler(int) { schedule_stopped_flag = true; } diff --git a/vvp/statistics.h b/vvp/statistics.h index 8bf1c478d..56ce77748 100644 --- a/vvp/statistics.h +++ b/vvp/statistics.h @@ -19,7 +19,12 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ +// The SunPro C++ compiler is broken and does not define size_t in cstddef. +#ifdef __SUNPRO_CC +# include +#else # include +#endif extern unsigned long count_opcodes; extern unsigned long count_functors; diff --git a/vvp/symbols.cc b/vvp/symbols.cc index 425c5e3dd..83be8449d 100644 --- a/vvp/symbols.cc +++ b/vvp/symbols.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001-2008 Stephen Williams (steve@icarus.com) + * Copyright (c) 2001-2010 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -70,18 +70,19 @@ char*symbol_table_s::key_strdup_(const char*str) const unsigned leaf_width = 254; const unsigned node_width = 508; +struct tree_data_ { + char*key; + symbol_value_t val; +}; + struct tree_node_ { bool leaf_flag; unsigned count; struct tree_node_*parent; union { - struct { - char*key; - symbol_value_t val; - } leaf[leaf_width]; - - struct tree_node_*child[node_width]; + struct tree_data_ leaf[leaf_width]; + struct tree_node_ *child[node_width]; }; }; diff --git a/vvp/vpi_signal.cc b/vvp/vpi_signal.cc index 2558ef91c..8fa47dc29 100644 --- a/vvp/vpi_signal.cc +++ b/vvp/vpi_signal.cc @@ -1105,14 +1105,19 @@ static char* PV_get_str(int code, vpiHandle ref) case vpiName: case vpiFullName: { const char*nm = vpi_get_str(code, rfp->parent); - char full[1024+strlen(nm)]; - sprintf(full, "%s[%d:%d]", nm, (int)vpi_get(vpiLeftRange, ref), - (int)vpi_get(vpiRightRange, ref)); - return simple_set_rbuf_str(full); + size_t len = 256+strlen(nm); + char *full = (char *) malloc(len); + snprintf(full, len, "%s[%d:%d]", nm, + (int)vpi_get(vpiLeftRange, ref), + (int)vpi_get(vpiRightRange, ref)); + full[len-1] = 0; + char *res = simple_set_rbuf_str(full); + free(full); + return res; } default: - fprintf(stderr, "PV_get_str: property %d is unknown\n", code); + fprintf(stderr, "PV_get_str: property %d is unknown.\n", code); } return 0;