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.
This commit is contained in:
Cary R 2011-03-03 16:23:44 -08:00 committed by Stephen Williams
parent 2a0d33608f
commit b019c21f46
5 changed files with 19 additions and 14 deletions

View File

@ -206,7 +206,7 @@ bool PECallFunction::has_aa_term(Design*des, NetScope*scope) const
}
PEConcat::PEConcat(const list<PExpr*>&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());

View File

@ -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))) {

View File

@ -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 <math.h>
# include <string.h>
# include <inttypes.h>
# include <limits.h>
# include <assert.h>
# 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) {

View File

@ -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))) {

View File

@ -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;
}