Skip to content

Commit c653078

Browse files
committed
Fix -Wswitch and -Wparentheses in gpre/sql
+ Misc other fixes
1 parent 8d2413d commit c653078

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/gpre/sql.cpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,11 @@ act* SQL_action(const TEXT* base_directory)
325325
case KW_WHENEVER:
326326
action = act_whenever();
327327
break;
328+
329+
default:
330+
// error was raised in previous switch
331+
fb_assert(false);
332+
break;
328333
}
329334

330335
MSC_match(KW_END_EXEC);
@@ -1481,7 +1486,7 @@ static act* act_connect()
14811486
act* action = MSC_action(0, ACT_ready);
14821487
action->act_whenever = gen_whenever();
14831488
bool need_handle = false;
1484-
const USHORT default_buffers = 0; // useless?
1489+
constexpr USHORT default_buffers = 0; // useless?
14851490

14861491
MSC_match(KW_TO);
14871492

@@ -2250,7 +2255,6 @@ static act* act_declare()
22502255
{
22512256
case KW_FILTER:
22522257
return (act_declare_filter());
2253-
break;
22542258

22552259
case KW_EXTERNAL:
22562260
PAR_get_token();
@@ -2259,6 +2263,9 @@ static act* act_declare()
22592263

22602264
CPR_s_error("FUNCTION");
22612265
break;
2266+
2267+
default:
2268+
break;
22622269
}
22632270

22642271
bool delimited = false;
@@ -5590,6 +5597,9 @@ static void pair( gpre_nod* expr, gpre_nod* field_expr)
55905597
case nod_field:
55915598
case nod_literal:
55925599
return;
5600+
5601+
default:
5602+
break;
55935603
}
55945604

55955605
gpre_nod** ptr = expr->nod_arg;
@@ -5794,7 +5804,7 @@ static dyn* par_dynamic_cursor()
57945804
else
57955805
gpreGlob.token_global.tok_keyword = KW_none;
57965806
}
5797-
if (symbol = MSC_find_symbol(gpreGlob.token_global.tok_symbol, SYM_dyn_cursor))
5807+
if ((symbol = MSC_find_symbol(gpreGlob.token_global.tok_symbol, SYM_dyn_cursor)))
57985808
{
57995809
PAR_get_token();
58005810
return (dyn*) symbol->sym_object;
@@ -6779,6 +6789,7 @@ static void to_upcase(const TEXT* p, TEXT* q, int target_size)
67796789
void SQL_resolve_identifier( const TEXT* err_mesg, TEXT* str_in, int in_size)
67806790
{
67816791
static TEXT internal_buffer[MAX_CURSOR_SIZE];
6792+
internal_buffer[0] = 0;
67826793
TEXT* str;
67836794
int len;
67846795
if (str_in)
@@ -6803,7 +6814,7 @@ void SQL_resolve_identifier( const TEXT* err_mesg, TEXT* str_in, int in_size)
68036814
case 2:
68046815
if (gpreGlob.token_global.tok_type == tok_dblquoted)
68056816
PAR_error("Ambiguous use of double quotes in dialect 2");
6806-
// fall into
6817+
[[fallthrough]];
68076818
case 1:
68086819
if (gpreGlob.token_global.tok_type != tok_ident)
68096820
CPR_s_error(err_mesg);

0 commit comments

Comments
 (0)