Fix implicit fallthrough warnings when building with recent GCC.

(cherry picked from commit f1608e163f)
This commit is contained in:
Martin Whitaker 2018-10-06 20:13:31 +01:00
parent 10fc8048ac
commit de63c0cedb
29 changed files with 69 additions and 31 deletions

View File

@ -2753,6 +2753,7 @@ NetExpr* PEConcat::elaborate_expr(Design*, NetScope*,
tmp->set_line(*this);
return tmp;
}
// fallthrough
default:
cerr << get_fileline() << ": internal error: "
<< "I don't know how to elaborate(ivl_type_t)"

View File

@ -1102,6 +1102,7 @@ NetEConst* NetEBShift::eval_arguments_(const NetExpr*l, const NetExpr*r) const
break;
case 'r':
lv.has_sign(false);
// fallthrough
case 'R':
val = cast_to_width(lv >> shift, wid);
break;
@ -1553,6 +1554,7 @@ NetEConst* NetEUReduce::eval_arguments_(const NetExpr*ex) const
case 'A':
invert = true;
// fallthrough
case '&': {
res = verinum::V1;
for (unsigned idx = 0 ; idx < val.len() ; idx += 1)
@ -1562,6 +1564,7 @@ NetEConst* NetEUReduce::eval_arguments_(const NetExpr*ex) const
case 'N':
invert = true;
// fallthrough
case '|': {
res = verinum::V0;
for (unsigned idx = 0 ; idx < val.len() ; idx += 1)
@ -1571,6 +1574,7 @@ NetEConst* NetEUReduce::eval_arguments_(const NetExpr*ex) const
case 'X':
invert = true;
// fallthrough
case '^': {
/* Reduction XOR. */
unsigned ones = 0, unknown = 0;
@ -1622,6 +1626,7 @@ NetExpr* NetECast::eval_arguments_(const NetExpr*ex) const
res_val = cast_to_width(res_val, expr_width());
res = new NetEConst(res_val);
}
// fallthrough
case 'v':
if (const NetECReal*val = dynamic_cast<const NetECReal*>(ex)) {
verinum res_val(val->value().as_double(), false);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999-2015 Stephen Williams (steve@icarus.com)
* Copyright (c) 1999-2018 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
@ -335,6 +335,7 @@ NetNet* NetEBComp::synthesize(Design*des, NetScope*scope, NetExpr*root)
des->errors += 1;
return 0;
}
// fallthrough
case 'e': // ==
connect(dev->pin_AEB(), osig->pin(0));
break;
@ -353,6 +354,7 @@ NetNet* NetEBComp::synthesize(Design*des, NetScope*scope, NetExpr*root)
des->errors += 1;
return 0;
}
// fallthrough
case 'n': // !=
connect(dev->pin_ANEB(), osig->pin(0));
break;

View File

@ -933,16 +933,22 @@ int main(int argc, char*argv[])
switch (generation_flag) {
case GN_VER2012:
lexor_keyword_mask |= GN_KEYWORDS_1800_2012;
// fallthrough
case GN_VER2009:
lexor_keyword_mask |= GN_KEYWORDS_1800_2009;
// fallthrough
case GN_VER2005_SV:
lexor_keyword_mask |= GN_KEYWORDS_1800_2005;
// fallthrough
case GN_VER2005:
lexor_keyword_mask |= GN_KEYWORDS_1364_2005;
// fallthrough
case GN_VER2001:
lexor_keyword_mask |= GN_KEYWORDS_1364_2001_CONFIG;
// fallthrough
case GN_VER2001_NOCONFIG:
lexor_keyword_mask |= GN_KEYWORDS_1364_2001;
// fallthrough
case GN_VER1995:
lexor_keyword_mask |= GN_KEYWORDS_1364_1995;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000-2015 Stephen Williams (steve@icarus.com)
* Copyright (c) 2000-2018 Stephen Williams (steve@icarus.com)
* Copyright CERN 2013 / Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
@ -1457,6 +1457,7 @@ extern "C" unsigned ivl_lpm_selects(ivl_lpm_t net)
case IVL_LPM_CONCATZ:
cerr << "error: ivl_lpm_selects() is no longer supported for "
"IVL_LPM_CONCAT, use ivl_lpm_size() instead." << endl;
// fallthrough
default:
assert(0);
return 0;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000-2015 Stephen Williams (steve@icarus.com)
* Copyright (c) 2000-2018 Stephen Williams (steve@icarus.com)
* Copyright CERN 2013 / Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
@ -2489,6 +2489,7 @@ void dll_target::scope(const NetScope*net)
case NetScope::PACKAGE:
cerr << "?:?" << ": internal error: "
<< "Package scopes should not have parents." << endl;
// fallthrough
case NetScope::MODULE:
scop->type_ = IVL_SCT_MODULE;
scop->tname_ = net->module_name();

View File

@ -1,7 +1,7 @@
/*
* VHDL code generation for statements.
*
* Copyright (C) 2008-2013 Nick Gasson (nick@nickg.me.uk)
* Copyright (C) 2008-2018 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
@ -683,8 +683,10 @@ static void get_nexuses_from_expr(ivl_expr_t expr, set<ivl_nexus_t> &out)
break;
case IVL_EX_TERNARY:
get_nexuses_from_expr(ivl_expr_oper3(expr), out);
// fallthrough
case IVL_EX_BINARY:
get_nexuses_from_expr(ivl_expr_oper2(expr), out);
// fallthrough
case IVL_EX_UNARY:
get_nexuses_from_expr(ivl_expr_oper1(expr), out);
break;

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2011-2014 Cary R. (cygcary@yahoo.com)
* Copyright (C) 2011-2018 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
@ -447,6 +447,7 @@ static void emit_expr_binary(ivl_scope_t scope, ivl_expr_t expr, unsigned wid,
ivl_expr_file(expr), ivl_expr_lineno(expr));
vlog_errors += 1;
}
//fallthrough
case '+':
case '-':
case '*':
@ -492,6 +493,7 @@ static void emit_expr_binary(ivl_scope_t scope, ivl_expr_t expr, unsigned wid,
ivl_expr_file(expr), ivl_expr_lineno(expr));
vlog_errors += 1;
}
// fallthrough
case 'l':
case 'r':
emit_expr(scope, oper1, wid, 0, 0, 0);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2011-2015 Cary R. (cygcary@yahoo.com)
* Copyright (C) 2011-2018 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
@ -1055,6 +1055,7 @@ static void emit_lpm_as_ca(ivl_scope_t scope, ivl_lpm_t lpm,
"should not be generated.\n",
ivl_lpm_file(lpm), ivl_lpm_lineno(lpm));
vlog_errors += 1;
// fallthrough
case IVL_LPM_CONCAT:
emit_lpm_concat(scope, lpm);
break;
@ -2167,10 +2168,9 @@ void dump_nexus_information(ivl_scope_t scope, ivl_nexus_t nex)
case IVL_VT_BOOL: fprintf(stderr, " bool"); break;
case IVL_VT_LOGIC: fprintf(stderr, " logic"); break;
case IVL_VT_STRING: fprintf(stderr, " string"); break;
case IVL_VT_DARRAY: fprintf(stderr, " dynamic array");
case IVL_VT_CLASS: fprintf(stderr, " class");
case IVL_VT_QUEUE: fprintf(stderr, " queue");
break;
case IVL_VT_DARRAY: fprintf(stderr, " dynamic array"); break;
case IVL_VT_CLASS: fprintf(stderr, " class"); break;
case IVL_VT_QUEUE: fprintf(stderr, " queue"); break;
}
if (ivl_signal_signed(sig)) fprintf(stderr, " <signed>");
} else fprintf(stderr, "Error: No/missing information!");

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2012-2014 Martin Whitaker. (icarus@martin-whitaker.me.uk)
* Copyright (C) 2012-2018 Martin Whitaker. (icarus@martin-whitaker.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
@ -33,6 +33,7 @@ static void check_net_arg(vpiHandle arg, vpiHandle callh, const char *name)
case vpiPartSelect:
if (vpi_get(vpiType, vpi_handle(vpiParent, arg)) != vpiNet)
break;
// fallthrough
case vpiNet:
if (vpi_get(vpiSize, arg) != 1)
break;

View File

@ -1138,7 +1138,7 @@ static int sys_check_args(vpiHandle callh, vpiHandle argv, const PLI_BYTE8*name,
name, vpi_get_str(vpiType, arg));
ret = 1;
}
// fallthrough
case vpiConstant:
case vpiParameter:
case vpiNet:

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003-2013 Stephen Williams (steve@icarus.com)
* Copyright (c) 2003-2018 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
@ -132,7 +132,7 @@ static PLI_INT32 sys_fopen_calltf(ICARUS_VPI_CONST PLI_BYTE8*name)
}
}
if (! fail) break;
// fallthrough
default:
vpi_printf("WARNING: %s:%d: ",
vpi_get_str(vpiFile, callh),

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002-2015 Stephen Williams (steve@icarus.com)
* Copyright (c) 2002-2018 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
@ -549,6 +549,7 @@ static void scan_item(unsigned depth, vpiHandle item, int skip)
PLI_INT32 idx = vpi_get(vpiIndex, item);
item = vpi_handle_by_index(array, idx);
}
// fallthrough
case vpiIntegerVar:
case vpiBitVar:
case vpiByteVar:

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003-2015 Stephen Williams (steve@icarus.com)
* Copyright (c) 2003-2018 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
@ -612,6 +612,7 @@ static void scan_item(unsigned depth, vpiHandle item, int skip)
PLI_INT32 idx = vpi_get(vpiIndex, item);
item = vpi_handle_by_index(array, idx);
}
// fallthrough
case vpiIntegerVar:
case vpiBitVar:
case vpiByteVar:

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2011-2014 Cary R. (cygcary@yahoo.com)
* Copyright (C) 2011-2018 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
@ -781,6 +781,7 @@ static PLI_INT32 fill_variable_with_scaled_time(vpiHandle var, uint64_t c_time)
switch (words) {
default:
val_ptr[1].aval = (c_time >> 32) & 0xffffffff;
// fallthrough
case 1:
val_ptr[0].aval = c_time & 0xffffffff;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999-2014 Stephen Williams (steve@icarus.com)
* Copyright (c) 1999-2018 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
@ -49,6 +49,7 @@ static void get_mem_params(vpiHandle argv, vpiHandle callh, const char *name,
case vpiConstant:
case vpiParameter:
if (vpi_get(vpiConstType, *start_item) != vpiRealConst) break;
// fallthrough
case vpiRealVar:
vpi_printf("WARNING: %s:%d: ", vpi_get_str(vpiFile, callh),
(int)vpi_get(vpiLineNo, callh));
@ -67,6 +68,7 @@ static void get_mem_params(vpiHandle argv, vpiHandle callh, const char *name,
if (vpi_get(vpiConstType, *stop_item) != vpiRealConst) {
break;
}
// fallthrough
case vpiRealVar:
vpi_printf("WARNING: %s:%d: ",
vpi_get_str(vpiFile, callh),

View File

@ -1258,6 +1258,7 @@ static int is_assignable_obj(vpiHandle obj)
break;
case vpiPartSelect:
if (! is_assignable_obj(vpi_handle(vpiParent, obj))) break;
// fallthrough
case vpiIntegerVar:
case vpiBitVar:
case vpiByteVar:
@ -1403,7 +1404,7 @@ static PLI_INT32 sys_sscanf_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name)
case vpiConstant:
case vpiParameter:
if (vpi_get(vpiConstType, reg) == vpiStringConst) break;
// fallthrough
default:
vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh),
(int)vpi_get(vpiLineNo, callh));

View File

@ -108,6 +108,7 @@ static PLI_INT32 ivl_enum_method_next_prev_compiletf(ICARUS_VPI_CONST PLI_BYTE8*
case vpiConstant:
case vpiParameter:
if (vpi_get(vpiConstType, arg_count) != vpiStringConst) break;
// fallthrough
default:
vpi_printf("%s:%d: compiler error: ",
vpi_get_str(vpiFile, sys),

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003-2013 Stephen Williams (steve@icarus.com)
* Copyright (c) 2003-2018 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
@ -373,6 +373,7 @@ static void cmd_trace(unsigned argc, char*argv[])
break;
default:
printf("Only using the first argument to trace.\n");
// fallthrough
case 2:
if ((strcmp(argv[1], "on") == 0) || (strcmp(argv[1], "1") == 0)) {
show_file_line = true;

View File

@ -796,7 +796,7 @@ static void real_signal_value(struct t_vpi_value*vp, double rval)
switch (vp->format) {
case vpiObjTypeVal:
vp->format = vpiRealVal;
// fallthrough
case vpiRealVal:
vp->value.real = rval;
break;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001-2014 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2018 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
@ -129,7 +129,7 @@ void __vpiStringConst::vpi_get_value(p_vpi_value vp)
case vpiObjTypeVal:
/* String parameters by default have vpiStringVal values. */
vp->format = vpiStringVal;
// fallthrough
case vpiStringVal:
rbuf = (char *) need_result_buf(size + 1, RBUF_VAL);
strcpy(rbuf, value_);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2017 Stephen Williams (steve@icarus.com)
* Copyright (c) 2008-2018 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
@ -724,7 +724,7 @@ void vpip_vec4_get_value(const vvp_vector4_t&word_val, unsigned width,
case vpiObjTypeVal:
// Use the following case to actually set the value!
vp->format = vpiVectorVal;
// fallthrough
case vpiVectorVal: {
unsigned hwid = (width + 31)/32;
@ -784,6 +784,7 @@ void vpip_vec2_get_value(const vvp_vector2_t&word_val, unsigned width,
case vpiObjTypeVal:
vp->format = vpiIntVal;
// fallthrough
case vpiIntVal:
vector2_to_value(word_val, vp->value.integer, signed_flag);
break;
@ -862,7 +863,7 @@ void vpip_real_get_value(double real, s_vpi_value*vp)
case vpiObjTypeVal:
// Use the following case to actually set the value!
vp->format = vpiRealVal;
// fallthrough
case vpiRealVal:
vp->value.real = real;
break;
@ -944,7 +945,7 @@ void vpip_string_get_value(const string&val, s_vpi_value*vp)
case vpiObjTypeVal:
// Use the following case to actually set the value!
vp->format = vpiStringVal;
// fallthrough
case vpiStringVal:
rbuf = (char *) need_result_buf(val.size() + 1, RBUF_VAL);
strcpy(rbuf, val.c_str());

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001-2016 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2018 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
@ -1200,6 +1200,7 @@ static int PV_get(int code, vpiHandle ref)
case vpiLeftRange:
rval += rfp->width - 1;
// fallthrough
case vpiRightRange:
rval += vpi_get(vpiRightRange, rfp->parent) + PV_get_base(rfp);
return rval;

View File

@ -475,6 +475,7 @@ vpiHandle sysfunc_4net::vpi_put_value(p_vpi_value vp, int)
(int)vp->value.scalar);
assert(0);
}
break;
}
case vpiIntVal: {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001-2014 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2018 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
@ -131,6 +131,7 @@ static void timevar_get_value(vpiHandle ref, s_vpi_value*vp, bool is_int_func,
case vpiObjTypeVal:
/* The default format is vpiTimeVal. */
vp->format = vpiTimeVal;
// fallthrough
case vpiTimeVal:
vp->value.time = &time_value;
vp->value.time->type = vpiSimTime;

View File

@ -108,6 +108,7 @@ static void vthr_real_get_value(vpiHandle ref, s_vpi_value*vp)
case vpiObjTypeVal:
vp->format = vpiRealVal;
// fallthrough
case vpiRealVal:
vp->value.real = val;
break;
@ -258,6 +259,7 @@ void __vpiVThrStrStack::vpi_get_value(p_vpi_value vp)
case vpiObjTypeVal:
vp->format = vpiStringVal;
// fallthrough
case vpiStringVal:
rbuf = (char *) need_result_buf(val.size()+1, RBUF_VAL);
strcpy(rbuf, val.c_str());
@ -376,6 +378,7 @@ void __vpiVThrVec4Stack::vpi_get_value(p_vpi_value vp)
break;
case vpiObjTypeVal:
vp->format = vpiVectorVal;
// fallthrough
case vpiVectorVal:
vpi_get_value_vector_(vp, val);
break;

View File

@ -100,6 +100,7 @@ void vpip_bin_str_to_vec4(vvp_vector4_t&vec4, const char*buf)
pad = BIT4_1;
break;
}
// fallthrough
default: // Everything else gets '0' padded/
pad = BIT4_0;
break;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002-2013 Stephen Williams (steve@icarus.com)
* Copyright (c) 2002-2018 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
@ -126,6 +126,7 @@ void vpip_hex_str_to_vec4(vvp_vector4_t&val, const char*str)
pad = BIT4_1;
break;
}
// fallthrough
default: // Everything else gets '0' padded.
pad = BIT4_0;
break;

View File

@ -106,6 +106,7 @@ void vpip_oct_str_to_vec4(vvp_vector4_t&val, const char*str)
pad = BIT4_1;
break;
}
// fallthrough
default: // Everything else gets '0' padded.
pad = BIT4_0;
break;
@ -116,7 +117,6 @@ void vpip_oct_str_to_vec4(vvp_vector4_t&val, const char*str)
if (idx < tval.size()) val.set_bit(idx, tval.value(idx));
else val.set_bit(idx, pad);
}
}
void vpip_vec4_to_oct_str(const vvp_vector4_t&bits, char*buf, unsigned nbuf)