From a25cbc601fa86459ea7e8383137e84e05db4f325 Mon Sep 17 00:00:00 2001 From: Kip Warner Date: Thu, 17 Aug 2017 21:23:06 -0700 Subject: [PATCH 1/5] Fixed a compiler warning / error in the debug function generator when unused variables are treated as such... --- flexc++/generator/debugfunctions.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flexc++/generator/debugfunctions.cc b/flexc++/generator/debugfunctions.cc index e65e23b..7b88d6c 100644 --- a/flexc++/generator/debugfunctions.cc +++ b/flexc++/generator/debugfunctions.cc @@ -8,7 +8,7 @@ void Generator::debugFunctions(std::ostream &out) const { out << "void " << d_baseclassScope << "setDebug(bool onOff)\n" - "{}\n" + "{ (void)(onOff); }\n" "\n" "bool " << d_baseclassScope << "debug() const\n" "{\n" From 1a3a1b015f800201b49806f3bebd8cfa6b30c1dc Mon Sep 17 00:00:00 2001 From: Kip Warner Date: Thu, 24 Aug 2017 16:47:20 -0700 Subject: [PATCH 2/5] Fixed Generator::conflicts() choking on white space in user implementation header. --- flexc++/generator/conflicts.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flexc++/generator/conflicts.cc b/flexc++/generator/conflicts.cc index d162168..85471fe 100644 --- a/flexc++/generator/conflicts.cc +++ b/flexc++/generator/conflicts.cc @@ -12,16 +12,16 @@ bool Generator::conflicts() const if (Stat(classHeaderPath)) { ret = errExisting(classHeaderPath, "class-name", - "^class " + d_options.className() + "\\b") + "^\s*class\s*" + d_options.className() + "\\b") or ret; if (not d_options.nameSpace().empty()) ret = errExisting(classHeaderPath, "namespace", - "^namespace " + d_options.nameSpace() + "\\b") + "^\s*namespace\s*" + d_options.nameSpace() + "\\b") or ret; ret = errExisting(classHeaderPath, Options::baseclassHeaderSpec(), - "^#include \"" + d_options.baseclassHeaderName() + '"') + "^\s*#include\s*\"" + d_options.baseclassHeaderName() + '"') or ret; } @@ -29,7 +29,7 @@ bool Generator::conflicts() const if (Stat(implementationHeader)) ret = errExisting(implementationHeader, d_options.classHeaderSpec(), - "^#include \"" + d_options.classHeaderName() + '"') + "^\s*#include\s*\"" + d_options.classHeaderName() + '"') or ret; return ret; From 5bb810e49b9703c3a380570f631a9ec8b494b1dc Mon Sep 17 00:00:00 2001 From: Kip Warner Date: Thu, 24 Aug 2017 17:00:40 -0700 Subject: [PATCH 3/5] Fixed Generator choking on white space when checking for conflicts... --- flexc++/generator/conflicts.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flexc++/generator/conflicts.cc b/flexc++/generator/conflicts.cc index d162168..ca91c35 100644 --- a/flexc++/generator/conflicts.cc +++ b/flexc++/generator/conflicts.cc @@ -12,16 +12,16 @@ bool Generator::conflicts() const if (Stat(classHeaderPath)) { ret = errExisting(classHeaderPath, "class-name", - "^class " + d_options.className() + "\\b") + "^\\s*class\\s*" + d_options.className() + "\\b") or ret; if (not d_options.nameSpace().empty()) ret = errExisting(classHeaderPath, "namespace", - "^namespace " + d_options.nameSpace() + "\\b") + "^\\s*namespace\\s*" + d_options.nameSpace() + "\\b") or ret; ret = errExisting(classHeaderPath, Options::baseclassHeaderSpec(), - "^#include \"" + d_options.baseclassHeaderName() + '"') + "^\\s*#include\\s*\"" + d_options.baseclassHeaderName() + '"') or ret; } @@ -29,7 +29,7 @@ bool Generator::conflicts() const if (Stat(implementationHeader)) ret = errExisting(implementationHeader, d_options.classHeaderSpec(), - "^#include \"" + d_options.classHeaderName() + '"') + "^\\s*#include\\s*\"" + d_options.classHeaderName() + '"') or ret; return ret; From 9a4622f0d54df533e3dd163ca09f217f9921b0d4 Mon Sep 17 00:00:00 2001 From: Kip Warner Date: Thu, 24 Aug 2017 17:08:36 -0700 Subject: [PATCH 4/5] Minor fix to previous commit. Safer regexs for the Generator looking for conflicts... --- flexc++/generator/conflicts.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flexc++/generator/conflicts.cc b/flexc++/generator/conflicts.cc index ca91c35..9c572b7 100644 --- a/flexc++/generator/conflicts.cc +++ b/flexc++/generator/conflicts.cc @@ -12,16 +12,16 @@ bool Generator::conflicts() const if (Stat(classHeaderPath)) { ret = errExisting(classHeaderPath, "class-name", - "^\\s*class\\s*" + d_options.className() + "\\b") + "^\\s*class\\s+" + d_options.className() + "\\b") or ret; if (not d_options.nameSpace().empty()) ret = errExisting(classHeaderPath, "namespace", - "^\\s*namespace\\s*" + d_options.nameSpace() + "\\b") + "^\\s*namespace\\s+" + d_options.nameSpace() + "\\b") or ret; ret = errExisting(classHeaderPath, Options::baseclassHeaderSpec(), - "^\\s*#include\\s*\"" + d_options.baseclassHeaderName() + '"') + "^\\s*#include\\s+\"" + d_options.baseclassHeaderName() + '"') or ret; } @@ -29,7 +29,7 @@ bool Generator::conflicts() const if (Stat(implementationHeader)) ret = errExisting(implementationHeader, d_options.classHeaderSpec(), - "^\\s*#include\\s*\"" + d_options.classHeaderName() + '"') + "^\\s*#include\\s+\"" + d_options.classHeaderName() + '"') or ret; return ret; From 88cc93df44519cbf0d6481dd7f96bf46f8b82572 Mon Sep 17 00:00:00 2001 From: Kip Warner Date: Sat, 26 Aug 2017 20:22:33 -0700 Subject: [PATCH 5/5] Fixes Input::Input(std::istream *iStream, size_t lineNr) not detecting bad input stream. --- flexc++/generator/inputimplementation.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/flexc++/generator/inputimplementation.cc b/flexc++/generator/inputimplementation.cc index b05161f..7a81fb7 100644 --- a/flexc++/generator/inputimplementation.cc +++ b/flexc++/generator/inputimplementation.cc @@ -24,7 +24,10 @@ void Generator::inputImplementation(ostream &out) const : d_in(iStream), d_lineNr(lineNr) -{} +{ + if(not *iStream) + throw std::runtime_error("Cannot read from stream"); +} size_t )" << d_baseclassScope << R"(Input::get() {