diff --git a/src/V3CCtors.cpp b/src/V3CCtors.cpp index c4c1cc713..962b382f9 100644 --- a/src/V3CCtors.cpp +++ b/src/V3CCtors.cpp @@ -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() : ""), diff --git a/src/V3Task.cpp b/src/V3Task.cpp index 8fcd656ff..bdb75e68d 100644 --- a/src/V3Task.cpp +++ b/src/V3Task.cpp @@ -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; diff --git a/test_regress/t/t_dpi_arg_inout_type.cpp b/test_regress/t/t_dpi_arg_inout_type.cpp index 5cec53ba8..04b8165de 100644 --- a/test_regress/t/t_dpi_arg_inout_type.cpp +++ b/test_regress/t/t_dpi_arg_inout_type.cpp @@ -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(&i_chandle) : 0; + *x = (n % 2) ? reinterpret_cast(&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(&i_chandle_t); + *x = (n % 2) ? 0 : reinterpret_cast(&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(&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 { diff --git a/test_regress/t/t_dpi_arg_input_type.cpp b/test_regress/t/t_dpi_arg_input_type.cpp index 730740cb3..e794bd745 100644 --- a/test_regress/t/t_dpi_arg_input_type.cpp +++ b/test_regress/t/t_dpi_arg_input_type.cpp @@ -618,8 +618,8 @@ void check_exports() { #ifndef NO_SHORTREAL e_shortreal(1.0f * n + 0.25f); #endif - e_chandle(n % 2 ? reinterpret_cast(&e_chandle) : NULL); - e_string(n % 2 ? "World" : "Hello"); + e_chandle((n % 2) ? reinterpret_cast(&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(&e_chandle_t)); - e_string_t(n % 2 ? "Hello" : "World"); + e_chandle_t((n % 2) ? NULL : reinterpret_cast(&e_chandle_t)); + e_string_t((n % 2) ? "Hello" : "World"); e_bit_t(n % 2); e_logic_t(!(n % 2)); diff --git a/test_regress/t/t_dpi_arg_output_type.cpp b/test_regress/t/t_dpi_arg_output_type.cpp index e23375e6c..931f3775a 100644 --- a/test_regress/t/t_dpi_arg_output_type.cpp +++ b/test_regress/t/t_dpi_arg_output_type.cpp @@ -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(); diff --git a/test_regress/t/t_dpi_result_type.cpp b/test_regress/t/t_dpi_result_type.cpp index 27bffe8c5..2f5bbe7f5 100644 --- a/test_regress/t/t_dpi_result_type.cpp +++ b/test_regress/t/t_dpi_result_type.cpp @@ -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(&i_chandle) : NULL; + return (n++ % 2) ? reinterpret_cast(&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(&i_chandle) : NULL; + return (n++ % 2) ? reinterpret_cast(&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