Update to compile with older GCC versions

This commit is contained in:
Cary R 2023-05-31 20:00:22 -07:00
parent deeac2edfe
commit 7ac6182d4c
1 changed files with 5 additions and 5 deletions

View File

@ -24,9 +24,9 @@
# include <stdlib.h> # include <stdlib.h>
# include <stdbool.h> # include <stdbool.h>
const unsigned LABEL_NONE = UINT_MAX; #define BRK_CONT_LABEL_NONE UINT_MAX
static unsigned break_label = LABEL_NONE; static unsigned break_label = BRK_CONT_LABEL_NONE;
static unsigned continue_label = LABEL_NONE; static unsigned continue_label = BRK_CONT_LABEL_NONE;
#define PUSH_JUMPS(bl, cl) do { \ #define PUSH_JUMPS(bl, cl) do { \
save_break_label = break_label; \ save_break_label = break_label; \
@ -44,7 +44,7 @@ static unsigned continue_label = LABEL_NONE;
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"
int show_stmt_break(ivl_statement_t net, ivl_scope_t sscope) int show_stmt_break(ivl_statement_t net, ivl_scope_t sscope)
{ {
if (break_label == LABEL_NONE) { if (break_label == BRK_CONT_LABEL_NONE) {
fprintf(stderr, "vvp.tgt: error: 'break' not in a loop?!\n"); fprintf(stderr, "vvp.tgt: error: 'break' not in a loop?!\n");
return 1; return 1;
} }
@ -55,7 +55,7 @@ int show_stmt_break(ivl_statement_t net, ivl_scope_t sscope)
int show_stmt_continue(ivl_statement_t net, ivl_scope_t sscope) int show_stmt_continue(ivl_statement_t net, ivl_scope_t sscope)
{ {
if (continue_label == LABEL_NONE) { if (continue_label == BRK_CONT_LABEL_NONE) {
fprintf(stderr, "vvp.tgt: error: 'continue' not in a loop?!\n"); fprintf(stderr, "vvp.tgt: error: 'continue' not in a loop?!\n");
return 1; return 1;
} }