Codacity cleanups. No functional change intended.

This commit is contained in:
Wilson Snyder 2020-04-20 21:43:05 -04:00
parent 83c6e9e821
commit 15f7685755
6 changed files with 33 additions and 33 deletions

View File

@ -145,8 +145,8 @@ void V3CCtors::cctorsAll() {
for (AstNodeModule* modp = v3Global.rootp()->modulesp(); modp;
modp = VN_CAST(modp->nextp(), NodeModule)) {
// Process each module in turn
AstCFunc* varResetFuncp;
{
AstCFunc* varResetFuncp;
V3CCtorsVisitor var_reset(
modp, "_ctor_var_reset",
(VN_IS(modp, Class) ? EmitCBaseVisitor::symClassVar() : ""),

View File

@ -512,7 +512,7 @@ private:
AstNode* beginp
= new AstComment(refp->fileline(), string("Function: ") + refp->name(), true);
AstNodeCCall* ccallp;
if (AstNew* mrefp = VN_CAST(refp, New)) {
if (VN_IS(refp, New)) {
AstCNew* cnewp = new AstCNew(refp->fileline(), cfuncp);
cnewp->dtypep(refp->dtypep());
ccallp = cnewp;

View File

@ -160,7 +160,7 @@ void i_chandle(void** x) {
static int n = 0;
printf("i_chandle %d\n", n);
if (*x != NULL) stop();
*x = n % 2 ? reinterpret_cast<void*>(&i_chandle) : 0;
*x = (n % 2) ? reinterpret_cast<void*>(&i_chandle) : 0;
n++;
}
@ -288,7 +288,7 @@ void i_chandle_t(void** x) {
static int n = 0;
printf("i_chandle_t %d\n", n);
if (*x != NULL) stop();
*x = n % 2 ? 0 : reinterpret_cast<void*>(&i_chandle_t);
*x = (n % 2) ? 0 : reinterpret_cast<void*>(&i_chandle_t);
n++;
}
@ -951,7 +951,7 @@ void check_exports() {
if (x_shortreal != 200.0f + 1.0f * n + 0.25f) stop();
#endif
if (n % 2 == 0) {
if ((n % 2) == 0) {
x_chandle = reinterpret_cast<void*>(&e_chandle);
x_string = "Good";
} else {
@ -960,7 +960,7 @@ void check_exports() {
}
e_chandle(&x_chandle);
e_string(&x_string);
if (n % 2 == 0) {
if ((n % 2) == 0) {
if (x_chandle != NULL) stop();
if (strcmp(x_string, "Hello") != 0) stop();
} else {
@ -1034,7 +1034,7 @@ void check_exports() {
if (x_shortreal_t != 222.0f + 1.0f * (2 * n) + 0.25f) stop();
#endif
if (n % 2 == 0) {
if ((n % 2) == 0) {
x_chandle_t = NULL;
x_string_t = "Bye";
} else {
@ -1043,7 +1043,7 @@ void check_exports() {
}
e_chandle_t(&x_chandle_t);
e_string_t(&x_string_t);
if (n % 2 == 0) {
if ((n % 2) == 0) {
if (x_chandle_t != NULL) stop();
if (strcmp(x_string_t, "World") != 0) stop();
} else {

View File

@ -618,8 +618,8 @@ void check_exports() {
#ifndef NO_SHORTREAL
e_shortreal(1.0f * n + 0.25f);
#endif
e_chandle(n % 2 ? reinterpret_cast<void*>(&e_chandle) : NULL);
e_string(n % 2 ? "World" : "Hello");
e_chandle((n % 2) ? reinterpret_cast<void*>(&e_chandle) : NULL);
e_string((n % 2) ? "World" : "Hello");
e_bit(n % 2);
e_logic(!(n % 2));
@ -645,8 +645,8 @@ void check_exports() {
#ifndef NO_SHORTREAL
e_shortreal_t(1.0f * (2 * n) + 0.25f);
#endif
e_chandle_t(n % 2 ? NULL : reinterpret_cast<void*>(&e_chandle_t));
e_string_t(n % 2 ? "Hello" : "World");
e_chandle_t((n % 2) ? NULL : reinterpret_cast<void*>(&e_chandle_t));
e_string_t((n % 2) ? "Hello" : "World");
e_bit_t(n % 2);
e_logic_t(!(n % 2));

View File

@ -710,14 +710,14 @@ void check_exports() {
if (x_chandle != NULL) stop();
e_string(&x_string);
if (n % 2 == 0) {
if ((n % 2) == 0) {
if (strcmp(x_string, "Hello") != 0) stop();
} else {
if (strcmp(x_string, "World") != 0) stop();
}
e_bit(&x_bit);
if (x_bit != n % 2) stop();
if (x_bit != (n % 2)) stop();
e_logic(&x_logic);
if (x_logic != !(n % 2)) stop();
@ -771,14 +771,14 @@ void check_exports() {
if (x_chandle_t != NULL) stop();
e_string_t(&x_string_t);
if (n % 2 == 0) {
if ((n % 2) == 0) {
if (strcmp(x_string_t, "Hello") != 0) stop();
} else {
if (strcmp(x_string_t, "World") != 0) stop();
}
e_bit_t(&x_bit_t);
if (x_bit_t != n % 2) stop();
if (x_bit_t != (n % 2)) stop();
e_logic_t(&x_logic_t);
if (x_logic_t != !(n % 2)) stop();
@ -787,7 +787,7 @@ void check_exports() {
// 2-state packed arrays
e_array_2_state_1(x_array_2_state_1);
if (x_array_2_state_1[0] != n % 2) stop();
if (x_array_2_state_1[0] != (n % 2)) stop();
e_array_2_state_32(x_array_2_state_32);
if (x_array_2_state_32[0] != 0xffffffff >> n) stop();
@ -813,7 +813,7 @@ void check_exports() {
// 2-state packed structures
e_struct_2_state_1(x_struct_2_state_1);
if (x_struct_2_state_1[0] != n % 2) stop();
if (x_struct_2_state_1[0] != (n % 2)) stop();
e_struct_2_state_32(x_struct_2_state_32);
if (x_struct_2_state_32[0] != 0xffffffff >> n) stop();
@ -839,7 +839,7 @@ void check_exports() {
// 2-state packed unions
e_union_2_state_1(x_union_2_state_1);
if (x_union_2_state_1[0] != n % 2) stop();
if (x_union_2_state_1[0] != (n % 2)) stop();
e_union_2_state_32(x_union_2_state_32);
if (x_union_2_state_32[0] != 0xffffffff >> n) stop();
@ -865,7 +865,7 @@ void check_exports() {
// 4-state packed arrays
e_array_4_state_1(x_array_4_state_1);
if (x_array_4_state_1[0].aval != n % 2) stop();
if (x_array_4_state_1[0].aval != (n % 2)) stop();
e_array_4_state_32(x_array_4_state_32);
if (x_array_4_state_32[0].aval != 0xffffffff >> n) stop();
@ -898,7 +898,7 @@ void check_exports() {
// 4-state packed structures
e_struct_4_state_1(x_struct_4_state_1);
if (x_struct_4_state_1[0].aval != n % 2) stop();
if (x_struct_4_state_1[0].aval != (n % 2)) stop();
e_struct_4_state_32(x_struct_4_state_32);
if (x_struct_4_state_32[0].aval != 0xffffffff >> n) stop();
@ -931,7 +931,7 @@ void check_exports() {
// 4-state packed unions
e_union_4_state_1(x_union_4_state_1);
if (x_union_4_state_1[0].aval != n % 2) stop();
if (x_union_4_state_1[0].aval != (n % 2)) stop();
e_union_4_state_32(x_union_4_state_32);
if (x_union_4_state_32[0].aval != 0xffffffff >> n) stop();

View File

@ -108,13 +108,13 @@ float i_shortreal() {
void* i_chandle() {
static int n = 0;
printf("i_chandle %d\n", n);
return n++ % 2 ? reinterpret_cast<void*>(&i_chandle) : NULL;
return (n++ % 2) ? reinterpret_cast<void*>(&i_chandle) : NULL;
}
const char* i_string() {
static int n = 0;
printf("i_string %d\n", n);
return n++ % 2 ? "Hello" : "World";
return (n++ % 2) ? "Hello" : "World";
}
svBit i_bit() {
@ -205,13 +205,13 @@ float i_shortreal_t() {
void* i_chandle_t() {
static int n = 0;
printf("i_chandle_t %d\n", n);
return n++ % 2 ? reinterpret_cast<void*>(&i_chandle) : NULL;
return (n++ % 2) ? reinterpret_cast<void*>(&i_chandle) : NULL;
}
const char* i_string_t() {
static int n = 0;
printf("i_string_t %d\n", n);
return n++ % 2 ? "Hello" : "World";
return (n++ % 2) ? "Hello" : "World";
}
svBit i_bit_t() {
@ -300,12 +300,12 @@ void check_exports() {
if (e_shortreal() != 1.0f * n + 0.25f) stop();
#endif
if (e_chandle() != NULL) stop();
if (n % 2 == 0) {
if ((n % 2) == 0) {
if (strcmp(e_string(), "Hello") != 0) stop();
} else {
if (strcmp(e_string(), "World") != 0) stop();
}
if (e_bit() != n % 2) stop();
if (e_bit() != (n % 2)) stop();
if (e_logic() != !(n % 2)) stop();
// Basic types via tyepdef
@ -324,27 +324,27 @@ void check_exports() {
if (e_shortreal_t() != 1.0f * (2 * n) + 0.25f) stop();
#endif
if (e_chandle_t() != NULL) stop();
if (n % 2 == 0) {
if ((n % 2) == 0) {
if (strcmp(e_string_t(), "Hello") != 0) stop();
} else {
if (strcmp(e_string_t(), "World") != 0) stop();
}
if (e_bit_t() != n % 2) stop();
if (e_bit_t() != (n % 2)) stop();
if (e_logic_t() != !(n % 2)) stop();
#ifndef NO_ARRAY
// 2-state packed arrays of width <= 32
if (e_array_2_state_1() != n % 2) stop();
if (e_array_2_state_1() != (n % 2)) stop();
if (e_array_2_state_32() != 0xffffffff >> n) stop();
#endif
#ifndef NO_STRUCT_OR_UNION
// 2-state packed structures of width <= 32
if (e_struct_2_state_1() != n % 2) stop();
if (e_struct_2_state_1() != (n % 2)) stop();
if (e_struct_2_state_32() != 0xffffffff >> n) stop();
// 2-state packed unions of width <= 32
if (e_union_2_state_1() != n % 2) stop();
if (e_union_2_state_1() != (n % 2)) stop();
if (e_union_2_state_32() != 0xffffffff >> n) stop();
#endif