From b019c21f46b4feab06213747d0ed831d3137d87a Mon Sep 17 00:00:00 2001 From: Cary R Date: Thu, 3 Mar 2011 16:23:44 -0800 Subject: [PATCH] OpenSolaris portability/bug fixes. A valarray of an enum does not initialize to 0 so explicitly specify the value to fill the array with. This was causing the compiler to incorrectly report that fixed width elements in a concatenation had no size. The following was done to remove compiler warning when using the native compiler on OpenSolaris. Remove the anonymous unions in tgt-vlog95/stmt.c and tgt-vvp/vvp_process.c. Use UINT_MAX for the maximum unsigned unsigned instead of -1 in tgt-vvp/draw_net_input.c. Even though lex defines yywrap() to have no arguments when %option noyywrp is used it generates a define that takes an argument that is not used. The compiler warned about this so remove the option and add a dummy yywrap function. --- PExpr.cc | 2 +- tgt-vlog95/stmt.c | 12 ++++++------ tgt-vvp/draw_net_input.c | 5 +++-- tgt-vvp/vvp_process.c | 8 ++++---- vhdlpp/lexor.lex | 6 +++++- 5 files changed, 19 insertions(+), 14 deletions(-) diff --git a/PExpr.cc b/PExpr.cc index bd529f174..36c990fff 100644 --- a/PExpr.cc +++ b/PExpr.cc @@ -206,7 +206,7 @@ bool PECallFunction::has_aa_term(Design*des, NetScope*scope) const } PEConcat::PEConcat(const list&p, PExpr*r) -: parms_(p.size()), width_modes_(p.size()), repeat_(r) +: parms_(p.size()), width_modes_(SIZED, p.size()), repeat_(r) { int tmp_idx = 0; assert(parms_.size() == p.size()); diff --git a/tgt-vlog95/stmt.c b/tgt-vlog95/stmt.c index 5ad614fef..9740fdbbb 100644 --- a/tgt-vlog95/stmt.c +++ b/tgt-vlog95/stmt.c @@ -530,7 +530,7 @@ typedef struct port_expr_s { union { ivl_statement_t lval; ivl_expr_t rval; - }; + } expr; } *port_expr_t; /* @@ -539,11 +539,11 @@ typedef struct port_expr_s { static void emit_port(ivl_scope_t scope, struct port_expr_s port_expr) { if (port_expr.type == IVL_SIP_INPUT) { - emit_expr(scope, port_expr.rval, 0); + emit_expr(scope, port_expr.expr.rval, 0); } else { /* This is a self-determined context so we don't care about * the width of the L-value. */ - (void) emit_stmt_lval(scope, port_expr.lval); + (void) emit_stmt_lval(scope, port_expr.expr.lval); } } @@ -592,7 +592,7 @@ static unsigned is_utask_call_with_args(ivl_scope_t scope, port_exprs = (port_expr_t) malloc(sizeof(struct port_expr_s)*ports); for (idx = 0; idx < ports; idx += 1) { port_exprs[idx].type = IVL_SIP_NONE; - port_exprs[idx].rval = 0; + port_exprs[idx].expr.rval = 0; } /* Check that the input arguments are correct. */ for (idx = 0; idx < task_idx; idx += 1) { @@ -603,7 +603,7 @@ static unsigned is_utask_call_with_args(ivl_scope_t scope, return 0; } port_exprs[port].type = IVL_SIP_INPUT; - port_exprs[port].rval = ivl_stmt_rval(assign); + port_exprs[port].expr.rval = ivl_stmt_rval(assign); } /* Check that the output arguments are correct. */ for (idx = task_idx + 1; idx < count; idx += 1) { @@ -620,7 +620,7 @@ static unsigned is_utask_call_with_args(ivl_scope_t scope, } else { port_exprs[port].type = IVL_SIP_OUTPUT; } - port_exprs[port].lval = assign; + port_exprs[port].expr.lval = assign; } /* Check that the task call has the correct line number. */ if (lineno != ivl_stmt_lineno(ivl_stmt_block_stmt(stmt, task_idx))) { diff --git a/tgt-vvp/draw_net_input.c b/tgt-vvp/draw_net_input.c index 628210ad9..44d6840ae 100644 --- a/tgt-vvp/draw_net_input.c +++ b/tgt-vvp/draw_net_input.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001-2010 Stephen Williams (steve@icarus.com) + * Copyright (c) 2001-2011 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 @@ -22,6 +22,7 @@ # include # include # include +# include # include # include "ivl_alloc.h" @@ -564,7 +565,7 @@ static void display_multi_driver_error(ivl_nexus_t nex, unsigned ndrivers, mdriver_type_t type) { unsigned idx; - unsigned scope_len = -1; + unsigned scope_len = UINT_MAX; ivl_signal_t sig = 0; /* Find the signal. */ for (idx = 0 ; idx < ivl_nexus_ptrs(nex) ; idx += 1) { diff --git a/tgt-vvp/vvp_process.c b/tgt-vvp/vvp_process.c index 9804c49e1..8d64cfb58 100644 --- a/tgt-vvp/vvp_process.c +++ b/tgt-vvp/vvp_process.c @@ -2150,7 +2150,7 @@ typedef struct port_expr_s { union { ivl_statement_t lval; ivl_expr_t rval; - }; + } expr; } *port_expr_t; /* @@ -2198,7 +2198,7 @@ static unsigned is_utask_call_with_args(ivl_scope_t scope, port_exprs = (port_expr_t) malloc(sizeof(struct port_expr_s)*ports); for (idx = 0; idx < ports; idx += 1) { port_exprs[idx].type = IVL_SIP_NONE; - port_exprs[idx].rval = 0; + port_exprs[idx].expr.rval = 0; } /* Check that the input arguments are correct. */ for (idx = 0; idx < task_idx; idx += 1) { @@ -2209,7 +2209,7 @@ static unsigned is_utask_call_with_args(ivl_scope_t scope, return 0; } port_exprs[port].type = IVL_SIP_INPUT; - port_exprs[port].rval = ivl_stmt_rval(assign); + port_exprs[port].expr.rval = ivl_stmt_rval(assign); } /* Check that the output arguments are correct. */ for (idx = task_idx + 1; idx < count; idx += 1) { @@ -2226,7 +2226,7 @@ static unsigned is_utask_call_with_args(ivl_scope_t scope, } else { port_exprs[port].type = IVL_SIP_OUTPUT; } - port_exprs[port].lval = assign; + port_exprs[port].expr.lval = assign; } /* Check that the task call has the correct line number. */ if (lineno != ivl_stmt_lineno(ivl_stmt_block_stmt(stmt, task_idx))) { diff --git a/vhdlpp/lexor.lex b/vhdlpp/lexor.lex index 24d1b7c55..033fbc3c5 100644 --- a/vhdlpp/lexor.lex +++ b/vhdlpp/lexor.lex @@ -1,7 +1,6 @@ %option never-interactive %option nounput -%option noyywrap %{ /* @@ -502,3 +501,8 @@ void reset_lexor(FILE*fd, const char*path) yyparse_set_filepath(path); } + +int yywrap() +{ + return 1; +}