properly mask #message, #warning, #error by ftepp->output_on

This commit is contained in:
Wolfgang Bumiller 2013-02-03 23:23:50 +01:00
parent 0d1b40c9c1
commit 530dbd85b2

14
ftepp.c
View file

@ -1285,11 +1285,17 @@ static bool ftepp_directive_warning(ftepp_t *ftepp) {
ftepp_next(ftepp); ftepp_next(ftepp);
} }
vec_push(message, '\0'); vec_push(message, '\0');
if (ftepp->output_on)
store = ftepp_warn(ftepp, WARN_CPP, message); store = ftepp_warn(ftepp, WARN_CPP, message);
else
store = false;
vec_free(message); vec_free(message);
return store; return store;
} }
if (!ftepp->output_on)
return false;
unescape (ftepp_tokval(ftepp), ftepp_tokval(ftepp)); unescape (ftepp_tokval(ftepp), ftepp_tokval(ftepp));
return ftepp_warn(ftepp, WARN_CPP, "#warning %s", ftepp_tokval(ftepp)); return ftepp_warn(ftepp, WARN_CPP, "#warning %s", ftepp_tokval(ftepp));
} }
@ -1309,11 +1315,15 @@ static void ftepp_directive_error(ftepp_t *ftepp) {
ftepp_next(ftepp); ftepp_next(ftepp);
} }
vec_push(message, '\0'); vec_push(message, '\0');
if (ftepp->output_on)
ftepp_error(ftepp, message); ftepp_error(ftepp, message);
vec_free(message); vec_free(message);
return; return;
} }
if (!ftepp->output_on)
return;
unescape (ftepp_tokval(ftepp), ftepp_tokval(ftepp)); unescape (ftepp_tokval(ftepp), ftepp_tokval(ftepp));
ftepp_error(ftepp, "#error %s", ftepp_tokval(ftepp)); ftepp_error(ftepp, "#error %s", ftepp_tokval(ftepp));
} }
@ -1333,11 +1343,15 @@ static void ftepp_directive_message(ftepp_t *ftepp) {
ftepp_next(ftepp); ftepp_next(ftepp);
} }
vec_push(message, '\0'); vec_push(message, '\0');
if (ftepp->output_on)
con_cprintmsg(&ftepp->lex->tok.ctx, LVL_MSG, "message", message); con_cprintmsg(&ftepp->lex->tok.ctx, LVL_MSG, "message", message);
vec_free(message); vec_free(message);
return; return;
} }
if (!ftepp->output_on)
return;
unescape (ftepp_tokval(ftepp), ftepp_tokval(ftepp)); unescape (ftepp_tokval(ftepp), ftepp_tokval(ftepp));
con_cprintmsg(&ftepp->lex->tok.ctx, LVL_MSG, "message", ftepp_tokval(ftepp)); con_cprintmsg(&ftepp->lex->tok.ctx, LVL_MSG, "message", ftepp_tokval(ftepp));
} }