From: Wolfgang Bumiller Date: Thu, 20 Dec 2012 15:29:32 +0000 (+0100) Subject: Turn -fallow-unreachable-code into a -Wunreachable-code X-Git-Tag: 0.1.9~6 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=eb8dc60981c669a2b6c077e638a63656d5d02625;p=xonotic%2Fgmqcc.git Turn -fallow-unreachable-code into a -Wunreachable-code --- diff --git a/ast.c b/ast.c index 5cb8651..cbcfb09 100644 --- a/ast.c +++ b/ast.c @@ -1570,10 +1570,9 @@ bool ast_block_codegen(ast_block *self, ast_function *func, bool lvalue, ir_valu { ast_expression_codegen *gen; if (func->curblock->final && !ast_istype(self->exprs[i], ast_label)) { - if (OPTS_FLAG(ALLOW_UNREACHABLE_CODE)) - continue; - compile_error(ast_ctx(self->exprs[i]), "unreachable statement"); - return false; + if (compile_warning(ast_ctx(self->exprs[i]), WARN_UNREACHABLE_CODE, "unreachable statement")) + return false; + continue; } gen = self->exprs[i]->expression.codegen; if (!(*gen)(self->exprs[i], func, false, out)) diff --git a/opts.c b/opts.c index f1aa937..cc647ba 100644 --- a/opts.c +++ b/opts.c @@ -50,11 +50,11 @@ static void opts_setdefault() { opts_set(opts.warn, WARN_CONST_VAR, true); opts_set(opts.warn, WARN_MULTIBYTE_CHARACTER, true); opts_set(opts.warn, WARN_UNKNOWN_PRAGMAS, true); + opts_set(opts.warn, WARN_UNREACHABLE_CODE, true); /* flags */ opts_set(opts.flags, ADJUST_VECTOR_FIELDS, true); opts_set(opts.flags, FTEPP, false); opts_set(opts.flags, CORRECT_TERNARY, true); - opts_set(opts.flags, ALLOW_UNREACHABLE_CODE, true); } void opts_init(const char *output, int standard, size_t arraysize) { diff --git a/opts.def b/opts.def index e08b576..5f74e1c 100644 --- a/opts.def +++ b/opts.def @@ -40,7 +40,6 @@ GMQCC_DEFINE_FLAG(LNO) GMQCC_DEFINE_FLAG(CORRECT_TERNARY) GMQCC_DEFINE_FLAG(SINGLE_VECTOR_DEFS) - GMQCC_DEFINE_FLAG(ALLOW_UNREACHABLE_CODE) #endif /* warning flags */ @@ -69,6 +68,7 @@ GMQCC_DEFINE_FLAG(MULTIBYTE_CHARACTER) GMQCC_DEFINE_FLAG(TERNARY_PRECEDENCE) GMQCC_DEFINE_FLAG(UNKNOWN_PRAGMAS) + GMQCC_DEFINE_FLAG(UNREACHABLE_CODE) #endif #ifdef GMQCC_TYPE_OPTIMIZATIONS