From: Ulya Trofimovich Date: Tue, 13 Nov 2018 23:38:02 +0000 (+0000) Subject: Suppress -Wnullable warning on <> condition (it has no regexp -- always empty). X-Git-Tag: 1.2~308 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5068fa4f18e7c8d78733bcf6154edf2e9d9a276a;p=re2c Suppress -Wnullable warning on <> condition (it has no regexp -- always empty). --- diff --git a/re2c/src/re/nullable.cc b/re2c/src/re/nullable.cc index f4e2d323..9f564c97 100644 --- a/re2c/src/re/nullable.cc +++ b/re2c/src/re/nullable.cc @@ -39,6 +39,9 @@ static bool nullable(const RESpec &spec, const RE *re, bool &trail) */ void warn_nullable(const RESpec &spec, const std::string &cond) { + // rule for <> is special -- it doesn't have a regexp + if (cond == "0") return; + const size_t nre = spec.res.size(); for (size_t i = 0; i < nre; ++i) { bool trail = false; diff --git a/re2c/test/condition_02.c.c b/re2c/test/condition_02.c.c index 0fb4afc9..9148f8b2 100644 --- a/re2c/test/condition_02.c.c +++ b/re2c/test/condition_02.c.c @@ -51,6 +51,5 @@ yy14: } #line 7 "condition_02.c.re" -re2c: warning: line 3: rule in condition '0' matches empty string [-Wmatch-empty-string] re2c: warning: line 7: control flow in condition 'r1' is undefined for strings that match '[\x0-\x60\x63-\xFF]', use default rule '*' [-Wundefined-control-flow] re2c: warning: line 7: control flow in condition 'r2' is undefined for strings that match '[\x0-\x61\x63-\xFF]', use default rule '*' [-Wundefined-control-flow] diff --git a/re2c/test/condition_02.cg.c b/re2c/test/condition_02.cg.c index 7a18c466..74944c92 100644 --- a/re2c/test/condition_02.cg.c +++ b/re2c/test/condition_02.cg.c @@ -46,7 +46,6 @@ yy14: } #line 7 "condition_02.cg.re" -re2c: warning: line 3: rule in condition '0' matches empty string [-Wmatch-empty-string] re2c: warning: line 7: control flow in condition 'r1' is undefined for strings that match '[\x0-\x60\x63-\xFF]', use default rule '*' [-Wundefined-control-flow] re2c: warning: line 7: control flow in condition 'r2' is undefined for strings that match '[\x0-\x61\x63-\xFF]', use default rule '*' [-Wundefined-control-flow] re2c: warning: line 7: looks like you use hardcoded numbers instead of autogenerated condition names: better add '/*!types:re2c*/' directive or '-t, --type-header' option and don't rely on fixed condition order. [-Wcondition-order] diff --git a/re2c/test/condition_03.cg.c b/re2c/test/condition_03.cg.c index 7f5c76e1..85968885 100644 --- a/re2c/test/condition_03.cg.c +++ b/re2c/test/condition_03.cg.c @@ -79,7 +79,6 @@ yy22: } #line 9 "condition_03.cg.re" -re2c: warning: line 3: rule in condition '0' matches empty string [-Wmatch-empty-string] re2c: warning: line 9: control flow in condition 'r1' is undefined for strings that match '[\x0-\x30\x33-\x60\x63-\xFF]', use default rule '*' [-Wundefined-control-flow] re2c: warning: line 9: control flow in condition 'r2' is undefined for strings that match '[\x0-\x30\x33-\x61\x63-\xFF]', use default rule '*' [-Wundefined-control-flow] re2c: warning: line 9: looks like you use hardcoded numbers instead of autogenerated condition names: better add '/*!types:re2c*/' directive or '-t, --type-header' option and don't rely on fixed condition order. [-Wcondition-order] diff --git a/re2c/test/condition_11.cg.c b/re2c/test/condition_11.cg.c index 7941d6d3..b67866fb 100644 --- a/re2c/test/condition_11.cg.c +++ b/re2c/test/condition_11.cg.c @@ -84,7 +84,6 @@ yy22: } #line 9 "condition_11.cg.re" -re2c: warning: line 3: rule in condition '0' matches empty string [-Wmatch-empty-string] re2c: warning: line 9: control flow in condition 'r1' is undefined for strings that match '[\x0-\x30\x33-\x60\x63-\xFF]', use default rule '*' [-Wundefined-control-flow] re2c: warning: line 9: control flow in condition 'r2' is undefined for strings that match '[\x0-\x30\x33-\x61\x63-\xFF]', use default rule '*' [-Wundefined-control-flow] re2c: warning: line 9: looks like you use hardcoded numbers instead of autogenerated condition names: better add '/*!types:re2c*/' directive or '-t, --type-header' option and don't rely on fixed condition order. [-Wcondition-order] diff --git a/re2c/test/condition_13.cg.c b/re2c/test/condition_13.cg.c index 084ff3a7..0a38febc 100644 --- a/re2c/test/condition_13.cg.c +++ b/re2c/test/condition_13.cg.c @@ -68,7 +68,6 @@ yy22: } #line 9 "condition_13.cg.re" -re2c: warning: line 3: rule in condition '0' matches empty string [-Wmatch-empty-string] re2c: warning: line 9: control flow in condition 'r1' is undefined for strings that match '[\x0-\x30\x33-\x60\x63-\xFF]', use default rule '*' [-Wundefined-control-flow] re2c: warning: line 9: control flow in condition 'r2' is undefined for strings that match '[\x0-\x30\x33-\x61\x63-\xFF]', use default rule '*' [-Wundefined-control-flow] re2c: warning: line 9: looks like you use hardcoded numbers instead of autogenerated condition names: better add '/*!types:re2c*/' directive or '-t, --type-header' option and don't rely on fixed condition order. [-Wcondition-order] diff --git a/re2c/test/condition_13a.cg.c b/re2c/test/condition_13a.cg.c index c8aa76fb..03abb3c0 100644 --- a/re2c/test/condition_13a.cg.c +++ b/re2c/test/condition_13a.cg.c @@ -68,7 +68,6 @@ yy22: } #line 9 "condition_13a.cg.re" -re2c: warning: line 7: rule in condition '0' matches empty string [-Wmatch-empty-string] re2c: warning: line 9: control flow in condition 'r1' is undefined for strings that match '[\x0-\x30\x33-\x60\x63-\xFF]', use default rule '*' [-Wundefined-control-flow] re2c: warning: line 9: control flow in condition 'r2' is undefined for strings that match '[\x0-\x30\x33-\x61\x63-\xFF]', use default rule '*' [-Wundefined-control-flow] re2c: warning: line 9: looks like you use hardcoded numbers instead of autogenerated condition names: better add '/*!types:re2c*/' directive or '-t, --type-header' option and don't rely on fixed condition order. [-Wcondition-order]