mirror of https://github.com/YosysHQ/yosys.git
Merge pull request #2022 from Xiretza/fallthroughs
Avoid switch fall-through warnings
This commit is contained in:
commit
ebfdf61eb9
|
@ -1943,13 +1943,13 @@ struct CxxrtlWorker {
|
||||||
case RTLIL::STa:
|
case RTLIL::STa:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case RTLIL::STg:
|
||||||
|
log_cmd_error("Global clock is not supported.\n");
|
||||||
|
|
||||||
// Handling of init-type sync rules is delegated to the `proc_init` pass, so we can use the wire
|
// Handling of init-type sync rules is delegated to the `proc_init` pass, so we can use the wire
|
||||||
// attribute regardless of input.
|
// attribute regardless of input.
|
||||||
case RTLIL::STi:
|
case RTLIL::STi:
|
||||||
log_assert(false);
|
log_assert(false);
|
||||||
|
|
||||||
case RTLIL::STg:
|
|
||||||
log_cmd_error("Global clock is not supported.\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2346,16 +2346,22 @@ struct CxxrtlBackend : public Backend {
|
||||||
case 6:
|
case 6:
|
||||||
worker.max_opt_level = true;
|
worker.max_opt_level = true;
|
||||||
worker.run_proc_flatten = true;
|
worker.run_proc_flatten = true;
|
||||||
|
YS_FALLTHROUGH
|
||||||
case 5:
|
case 5:
|
||||||
worker.run_opt_clean_purge = true;
|
worker.run_opt_clean_purge = true;
|
||||||
|
YS_FALLTHROUGH
|
||||||
case 4:
|
case 4:
|
||||||
worker.localize_public = true;
|
worker.localize_public = true;
|
||||||
|
YS_FALLTHROUGH
|
||||||
case 3:
|
case 3:
|
||||||
worker.elide_public = true;
|
worker.elide_public = true;
|
||||||
|
YS_FALLTHROUGH
|
||||||
case 2:
|
case 2:
|
||||||
worker.localize_internal = true;
|
worker.localize_internal = true;
|
||||||
|
YS_FALLTHROUGH
|
||||||
case 1:
|
case 1:
|
||||||
worker.elide_internal = true;
|
worker.elide_internal = true;
|
||||||
|
YS_FALLTHROUGH
|
||||||
case 0:
|
case 0:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -343,7 +343,7 @@ struct FirrtlWorker
|
||||||
switch (dir) {
|
switch (dir) {
|
||||||
case FD_INOUT:
|
case FD_INOUT:
|
||||||
log_warning("Instance port connection %s.%s is INOUT; treating as OUT\n", cell_type.c_str(), log_signal(it->second));
|
log_warning("Instance port connection %s.%s is INOUT; treating as OUT\n", cell_type.c_str(), log_signal(it->second));
|
||||||
/* FALLTHRU */
|
YS_FALLTHROUGH
|
||||||
case FD_OUT:
|
case FD_OUT:
|
||||||
sourceExpr = firstName;
|
sourceExpr = firstName;
|
||||||
sinkExpr = secondExpr;
|
sinkExpr = secondExpr;
|
||||||
|
@ -351,7 +351,7 @@ struct FirrtlWorker
|
||||||
break;
|
break;
|
||||||
case FD_NODIRECTION:
|
case FD_NODIRECTION:
|
||||||
log_warning("Instance port connection %s.%s is NODIRECTION; treating as IN\n", cell_type.c_str(), log_signal(it->second));
|
log_warning("Instance port connection %s.%s is NODIRECTION; treating as IN\n", cell_type.c_str(), log_signal(it->second));
|
||||||
/* FALLTHRU */
|
YS_FALLTHROUGH
|
||||||
case FD_IN:
|
case FD_IN:
|
||||||
sourceExpr = secondExpr;
|
sourceExpr = secondExpr;
|
||||||
sinkExpr = firstName;
|
sinkExpr = firstName;
|
||||||
|
|
|
@ -930,7 +930,7 @@ void AstNode::detectSignWidthWorker(int &width_hint, bool &sign_hint, bool *foun
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* fall through */
|
YS_FALLTHROUGH
|
||||||
|
|
||||||
// everything should have been handled above -> print error if not.
|
// everything should have been handled above -> print error if not.
|
||||||
default:
|
default:
|
||||||
|
@ -1026,7 +1026,7 @@ RTLIL::SigSpec AstNode::genRTLIL(int width_hint, bool sign_hint)
|
||||||
if (GetSize(children) >= 1 && children[0]->type == AST_CONSTANT) {
|
if (GetSize(children) >= 1 && children[0]->type == AST_CONSTANT) {
|
||||||
current_module->parameter_default_values[str] = children[0]->asParaConst();
|
current_module->parameter_default_values[str] = children[0]->asParaConst();
|
||||||
}
|
}
|
||||||
/* fall through */
|
YS_FALLTHROUGH
|
||||||
case AST_LOCALPARAM:
|
case AST_LOCALPARAM:
|
||||||
if (flag_pwires)
|
if (flag_pwires)
|
||||||
{
|
{
|
||||||
|
@ -1822,7 +1822,8 @@ RTLIL::SigSpec AstNode::genRTLIL(int width_hint, bool sign_hint)
|
||||||
is_signed = sign_hint;
|
is_signed = sign_hint;
|
||||||
return SigSpec(wire);
|
return SigSpec(wire);
|
||||||
}
|
}
|
||||||
} /* fall through */
|
}
|
||||||
|
YS_FALLTHROUGH
|
||||||
|
|
||||||
// everything should have been handled above -> print error if not.
|
// everything should have been handled above -> print error if not.
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -91,7 +91,7 @@ std::string AstNode::process_format_str(const std::string &sformat, int next_arg
|
||||||
case 'D':
|
case 'D':
|
||||||
if (got_len)
|
if (got_len)
|
||||||
goto unsupported_format;
|
goto unsupported_format;
|
||||||
/* fall through */
|
YS_FALLTHROUGH
|
||||||
case 'x':
|
case 'x':
|
||||||
case 'X':
|
case 'X':
|
||||||
if (next_arg >= GetSize(children))
|
if (next_arg >= GetSize(children))
|
||||||
|
|
|
@ -155,6 +155,16 @@ extern Tcl_Obj *Tcl_ObjSetVar2(Tcl_Interp *interp, Tcl_Obj *part1Ptr, Tcl_Obj *p
|
||||||
# define YS_NORETURN
|
# define YS_NORETURN
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if __cplusplus >= 201703L
|
||||||
|
# define YS_FALLTHROUGH [[fallthrough]];
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
# define YS_FALLTHROUGH [[gnu::fallthrough]];
|
||||||
|
#elif defined(__clang__)
|
||||||
|
# define YS_FALLTHROUGH [[clang::fallthrough]];
|
||||||
|
#else
|
||||||
|
# define YS_FALLTHROUGH
|
||||||
|
#endif
|
||||||
|
|
||||||
YOSYS_NAMESPACE_BEGIN
|
YOSYS_NAMESPACE_BEGIN
|
||||||
|
|
||||||
// Note: All headers included in hashlib.h must be included
|
// Note: All headers included in hashlib.h must be included
|
||||||
|
|
Loading…
Reference in New Issue