From 2bfe75d57c71c7102dd6e7b4e5f7139411c7c080 Mon Sep 17 00:00:00 2001 From: Ulya Trofimovich Date: Wed, 11 May 2016 13:17:20 +0100 Subject: [PATCH] Restore user warnings after temporarily enforcing a warning. This is a temporary (and quite inconvenient) hack; in fact, warnings should be handled in the same way as options (via user config / real config that are synced on each read access just in case user config has been changed). --- re2c/src/conf/msg.cc | 2 +- re2c/src/conf/opt.cc | 3 --- re2c/src/conf/warn.cc | 10 +++++++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/re2c/src/conf/msg.cc b/re2c/src/conf/msg.cc index ec13c0ac..c9cbd4e5 100644 --- a/re2c/src/conf/msg.cc +++ b/re2c/src/conf/msg.cc @@ -31,7 +31,7 @@ void error_arg (const char * option) void warning_start (uint32_t line, bool error) { - static const char * msg = error ? "error" : "warning"; + const char * msg = error ? "error" : "warning"; fprintf (stderr, "re2c: %s: line %u: ", msg, line); } diff --git a/re2c/src/conf/opt.cc b/re2c/src/conf/opt.cc index ed8e6246..42596ea1 100644 --- a/re2c/src/conf/opt.cc +++ b/re2c/src/conf/opt.cc @@ -226,9 +226,6 @@ void opt_t::fix () default: break; } - if (tags) { - warn.set(Warn::NONDETERMINISTIC_TAGS, Warn::WERROR); - } if (bFlag) { sFlag = true; diff --git a/re2c/src/conf/warn.cc b/re2c/src/conf/warn.cc index 484a3850..0599d167 100644 --- a/re2c/src/conf/warn.cc +++ b/re2c/src/conf/warn.cc @@ -7,6 +7,7 @@ #include "src/conf/warn.h" #include "src/ir/skeleton/path.h" #include "src/ir/skeleton/skeleton.h" +#include "src/globals.h" namespace re2c { @@ -125,7 +126,14 @@ void Warn::nondeterministic_tags( { if (mask[NONDETERMINISTIC_TAGS] & WARNING) { - const bool e = mask[NONDETERMINISTIC_TAGS] & ERROR; + bool e = mask[NONDETERMINISTIC_TAGS] & ERROR; + + // a very bad hack to temporarily turn on -Werror + // TODO: userwarn/realwarn (like useropt/realopt) + if (opts->tags) { + e = true; + } + error_accuml |= e; if (tagname == NULL) { -- 2.40.0