Internals: Remove empty statements. No functional change intended.

Remove stray semicolons, mostly by capturing them in macros accurately.
This removes a ton on lint warnings from CLion.
This commit is contained in:
Geza Lore 2020-05-30 18:46:12 +01:00
parent 2e32387e5c
commit 9712ceedd7
11 changed files with 45 additions and 45 deletions

View File

@ -718,15 +718,15 @@ extern const char* vl_mc_scan_plusargs(const char* prefixp); // PLIish
/// Create two 32-bit words from quadword
/// WData is always at least 2 words; does not clean upper bits
#define VL_SET_WQ(owp, data) \
{ \
do { \
(owp)[0] = static_cast<IData>(data); \
(owp)[1] = static_cast<IData>((data) >> VL_EDATASIZE); \
}
} while (false)
#define VL_SET_WI(owp, data) \
{ \
do { \
(owp)[0] = static_cast<IData>(data); \
(owp)[1] = 0; \
}
} while (false)
#define VL_SET_QW(lwp) \
((static_cast<QData>((lwp)[0])) \
| (static_cast<QData>((lwp)[1]) << (static_cast<QData>(VL_EDATASIZE))))

View File

@ -47,7 +47,7 @@
// Function requires a "context" in the import declaration
#define _VL_SVDPI_CONTEXT_WARN() \
_VL_SVDPI_WARN("%%Warning: DPI C Function called by Verilog DPI import with missing " \
"'context' keyword.\n");
"'context' keyword.\n")
//======================================================================
//======================================================================

View File

@ -50,7 +50,7 @@
// Not supported yet
#define _VL_VPI_UNIMP() \
_VL_VPI_ERROR(__FILE__, __LINE__, Verilated::catName("Unsupported VPI function: ", VL_FUNC));
(_VL_VPI_ERROR(__FILE__, __LINE__, Verilated::catName("Unsupported VPI function: ", VL_FUNC)))
//======================================================================
// Implementation
@ -1026,7 +1026,7 @@ vpiHandle vpi_register_cb(p_cb_data cb_data_p) {
_VL_VPI_WARNING(__FILE__, __LINE__, "%s: Unsupported callback type %s", VL_FUNC,
VerilatedVpiError::strFromVpiCallbackReason(cb_data_p->reason));
return NULL;
};
}
}
PLI_INT32 vpi_remove_cb(vpiHandle object) {

View File

@ -257,7 +257,7 @@ public:
case ET_HIGHEDGE: return ET_LOWEDGE;
case ET_LOWEDGE: return ET_HIGHEDGE;
default: UASSERT_STATIC(0, "Inverting bad edgeType()");
};
}
return VEdgeType::ET_ILLEGAL;
}
const char* ascii() const {
@ -1347,12 +1347,12 @@ public:
// Prefetch a node.
// The if() makes it faster, even though prefetch won't fault on null pointers
#define ASTNODE_PREFETCH(nodep) \
{ \
do { \
if (nodep) { \
VL_PREFETCH_RD(&((nodep)->m_nextp)); \
VL_PREFETCH_RD(&((nodep)->m_iterpp)); \
} \
}
} while (false)
class AstNode {
// v ASTNODE_PREFETCH depends on below ordering of members

View File

@ -1884,12 +1884,12 @@ void EmitCStmts::emitOpName(AstNode* nodep, const string& format, AstNode* lhsp,
string nextComma;
bool needComma = false;
#define COMMA \
{ \
do { \
if (!nextComma.empty()) { \
puts(nextComma); \
nextComma = ""; \
} \
}
} while (false)
putbs("");
for (string::const_iterator pos = format.begin(); pos != format.end(); ++pos) {

View File

@ -306,11 +306,10 @@ inline void v3errorEndFatal(std::ostringstream& sstr) {
// Note the commas are the comma operator, not separating arguments. These are needed to ensure
// evaluation order as otherwise we couldn't ensure v3errorPrep is called first.
#define v3warnCode(code, msg) \
v3errorEnd( \
(V3Error::v3errorPrep(code), (V3Error::v3errorStr() << msg), V3Error::v3errorStr()));
v3errorEnd((V3Error::v3errorPrep(code), (V3Error::v3errorStr() << msg), V3Error::v3errorStr()))
#define v3warnCodeFatal(code, msg) \
v3errorEndFatal( \
(V3Error::v3errorPrep(code), (V3Error::v3errorStr() << msg), V3Error::v3errorStr()));
(V3Error::v3errorPrep(code), (V3Error::v3errorStr() << msg), V3Error::v3errorStr()))
#define v3warn(code, msg) v3warnCode(V3ErrorCode::code, msg)
#define v3info(msg) v3warnCode(V3ErrorCode::EC_INFO, msg)
#define v3error(msg) v3warnCode(V3ErrorCode::EC_ERROR, msg)
@ -323,28 +322,28 @@ inline void v3errorEndFatal(std::ostringstream& sstr) {
__FILE__ << ":" << std::dec << __LINE__ << ": " << msg)
// Use this when normal v3fatal is called in static method that overrides fileline.
#define v3fatalStatic(msg) \
::v3errorEndFatal((V3Error::v3errorPrep(V3ErrorCode::EC_FATAL), \
(V3Error::v3errorStr() << msg), V3Error::v3errorStr()));
(::v3errorEndFatal((V3Error::v3errorPrep(V3ErrorCode::EC_FATAL), \
(V3Error::v3errorStr() << msg), V3Error::v3errorStr())))
#define UINFO(level, stmsg) \
{ \
do { \
if (VL_UNCOVERABLE(debug() >= (level))) { \
cout << "- " << V3Error::lineStr(__FILE__, __LINE__) << stmsg; \
} \
}
} while (false)
#define UINFONL(level, stmsg) \
{ \
do { \
if (VL_UNCOVERABLE(debug() >= (level))) { cout << stmsg; } \
}
} while (false)
#ifdef VL_DEBUG
#define UDEBUGONLY(stmts) \
{ stmts }
do { stmts } while (false)
#else
#define UDEBUGONLY(stmts) \
{ \
do { \
if (false) { stmts } \
}
} while (false)
#endif
// Assertion without object, generally UOBJASSERT preferred

View File

@ -31,44 +31,44 @@
// Number operations build output in-place so can't call e.g. foo.opX(foo)
#define NUM_ASSERT_OP_ARGS1(arg1) \
UASSERT((this != &(arg1)), "Number operation called with same source and dest");
UASSERT((this != &(arg1)), "Number operation called with same source and dest")
#define NUM_ASSERT_OP_ARGS2(arg1, arg2) \
UASSERT((this != &(arg1) && this != &(arg2)), \
"Number operation called with same source and dest");
"Number operation called with same source and dest")
#define NUM_ASSERT_OP_ARGS3(arg1, arg2, arg3) \
UASSERT((this != &(arg1) && this != &(arg2) && this != &(arg3)), \
"Number operation called with same source and dest");
"Number operation called with same source and dest")
#define NUM_ASSERT_OP_ARGS4(arg1, arg2, arg3, arg4) \
UASSERT((this != &(arg1) && this != &(arg2) && this != &(arg3) && this != &(arg4)), \
"Number operation called with same source and dest");
"Number operation called with same source and dest")
#define NUM_ASSERT_LOGIC_ARGS1(arg1) \
UASSERT((!(arg1).isDouble() && !(arg1).isString()), \
"Number operation called with non-logic (double or string) argument: '" << (arg1) \
<< '"');
<< '"')
#define NUM_ASSERT_LOGIC_ARGS2(arg1, arg2) \
NUM_ASSERT_LOGIC_ARGS1(arg1); \
NUM_ASSERT_LOGIC_ARGS1(arg2);
NUM_ASSERT_LOGIC_ARGS1(arg2)
#define NUM_ASSERT_LOGIC_ARGS4(arg1, arg2, arg3, arg4) \
NUM_ASSERT_LOGIC_ARGS1(arg1); \
NUM_ASSERT_LOGIC_ARGS1(arg2); \
NUM_ASSERT_LOGIC_ARGS1(arg3); \
NUM_ASSERT_LOGIC_ARGS1(arg4);
NUM_ASSERT_LOGIC_ARGS1(arg4)
#define NUM_ASSERT_STRING_ARGS1(arg1) \
UASSERT((arg1).isString(), \
"Number operation called with non-string argument: '" << (arg1) << '"');
"Number operation called with non-string argument: '" << (arg1) << '"')
#define NUM_ASSERT_STRING_ARGS2(arg1, arg2) \
NUM_ASSERT_STRING_ARGS1(arg1); \
NUM_ASSERT_STRING_ARGS1(arg2);
NUM_ASSERT_STRING_ARGS1(arg2)
#define NUM_ASSERT_DOUBLE_ARGS1(arg1) \
UASSERT((arg1).isDouble(), \
"Number operation called with non-double argument: '" << (arg1) << '"');
"Number operation called with non-double argument: '" << (arg1) << '"')
#define NUM_ASSERT_DOUBLE_ARGS2(arg1, arg2) \
NUM_ASSERT_DOUBLE_ARGS1(arg1); \
NUM_ASSERT_DOUBLE_ARGS1(arg2);
NUM_ASSERT_DOUBLE_ARGS1(arg2)
//======================================================================
// Errors
@ -1242,7 +1242,7 @@ V3Number& V3Number::opOr(const V3Number& lhs, const V3Number& rhs) {
if (lhs.bitIs1(bit) || rhs.bitIs1(bit)) {
setBit(bit, 1);
} else if (lhs.bitIs0(bit) && rhs.bitIs0(bit)) {
; // 0
// 0
} else {
setBit(bit, 'x');
}

View File

@ -778,7 +778,7 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc, char
addArg(argv[i]); // -f's really should be inserted in the middle, but this is for debug
}
#define shift \
{ ++i; }
do { ++i; } while (false)
for (int i = 0; i < argc;) {
UINFO(9, " Option: " << argv[i] << endl);
// + options

View File

@ -32,7 +32,7 @@ V3PreLex* V3PreLex::s_currentLexp = NULL; // Current lexing point
#define LEXP V3PreLex::s_currentLexp
#define YY_INPUT(buf,result,max_size) \
result = LEXP->inputToLex(buf, max_size);
do { result = LEXP->inputToLex(buf, max_size); } while (false)
// Accessors, because flex keeps changing the type of yyleng
char* yyourtext() { return yytext; }
@ -41,9 +41,9 @@ void yyourtext(const char* textp, size_t size) { yytext=(char*)textp; yyleng=siz
// FL_FWD only tracks columns; preproc uses linenoInc() to track lines, so
// insertion of a \n does not mess up line count
#define FL_FWDC { LEXP->curFilelinep()->forwardToken(yytext, yyleng, false); }
#define FL_FWDC (LEXP->curFilelinep()->forwardToken(yytext, yyleng, false))
// Use this to break between tokens whereever not return'ing a token (e.g. skipping inside lexer)
#define FL_BRK { LEXP->curFilelinep()->startToken(); }
#define FL_BRK (LEXP->curFilelinep()->startToken())
// Prevent conflicts from perl version
static void linenoInc() {LEXP->linenoInc();}

View File

@ -71,7 +71,7 @@ void VlcOptions::parseOptsList(int argc, char** argv) {
// Note argc and argv DO NOT INCLUDE the filename in [0]!!!
// May be called recursively when there are -f files.
#define shift \
{ ++i; }
do { ++i; } while (false)
for (int i = 0; i < argc;) {
UINFO(9, " Option: " << argv[i] << endl);
if (argv[i][0] == '-') {

View File

@ -32,17 +32,18 @@ extern void yyerrorf(const char* format, ...);
#define PARSEP V3ParseImp::parsep()
#define SYMP PARSEP->symp()
#define YY_INPUT(buf, result, max_size) result = PARSEP->flexPpInputToLex(buf, max_size);
#define YY_INPUT(buf, result, max_size) \
do { result = PARSEP->flexPpInputToLex(buf, max_size); } while (false)
//======================================================================
#define FL_FWD { PARSEP->fileline()->forwardToken(yytext, yyleng, true); }
#define FL_FWD (PARSEP->fileline()->forwardToken(yytext, yyleng, true))
// Use this to break between tokens whereever not return'ing a token (e.g. skipping inside lexer)
#define FL_BRK { PARSEP->fileline()->startToken(); }
#define FL_BRK (PARSEP->fileline()->startToken())
#define CRELINE() (PARSEP->copyOrSameFileLine())
#define FL { FL_FWD; yylval.fl = CRELINE(); }
#define FL do { FL_FWD; yylval.fl = CRELINE(); } while (false)
#define ERROR_RSVD_WORD(language) \
do { FL_FWD; \