[beast: 33/43] SFI: define and use app_error() for sfidl



commit 43cf40a7f20d3dd5b9939da8284ddfcbe5ed7328
Author: Tim Janik <timj gnu org>
Date:   Sun Jun 25 22:22:24 2017 +0200

    SFI: define and use app_error() for sfidl
    
    Signed-off-by: Tim Janik <timj gnu org>

 sfi/sfidl-parser.cc    |    6 +++---
 sfi/sfidl.cc           |    2 ++
 sfi/tests/testsfidl.cc |    2 ++
 3 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/sfi/sfidl-parser.cc b/sfi/sfidl-parser.cc
index 1b426fd..3f7561d 100644
--- a/sfi/sfidl-parser.cc
+++ b/sfi/sfidl-parser.cc
@@ -220,7 +220,7 @@ Type Parser::typeOf (const String& type) const
   if (isSequence (type))      return SEQUENCE;
   if (isRecord (type))       return RECORD;
   if (isClass (type))        return OBJECT;
-  g_error ("%s", ("invalid type: " + type).c_str());
+  app_error ("%s", ("invalid type: " + type).c_str());
   return VOID;
 }
 
@@ -561,7 +561,7 @@ void Parser::preprocessContents (const String& input_filename)
               includeImpl = true;
             }
           if (*i != ';')
-            g_error ("expected ';' after include statement");
+            app_error ("expected ';' after include statement");
           i++; // eat semicolpon after include
          preprocess (location, includeImpl);
 
@@ -2092,7 +2092,7 @@ void Parser::leaveNamespace ()
 {
   currentNamespace = dynamic_cast<Namespace *>(currentNamespace->parent);
   if (!currentNamespace)
-    g_error ("fatal: leaveNamespace called without corresponding enterNamespace");
+    app_error ("fatal: leaveNamespace called without corresponding enterNamespace");
 }
 
 bool Parser::usingNamespace (const String& name)
diff --git a/sfi/sfidl.cc b/sfi/sfidl.cc
index 822c4d3..04bd5f4 100644
--- a/sfi/sfidl.cc
+++ b/sfi/sfidl.cc
@@ -3,6 +3,8 @@
 #include "sfidl-options.hh"
 #include "sfidl-parser.hh"
 
+#define app_error(...)  do { g_printerr ("%s: ", g_get_prgname()); g_printerr (__VA_ARGS__); exit (-1); } 
while (0)
+
 using namespace Sfidl;
 
 int main (int argc, char **argv)
diff --git a/sfi/tests/testsfidl.cc b/sfi/tests/testsfidl.cc
index 4e815db..7db8d8d 100644
--- a/sfi/tests/testsfidl.cc
+++ b/sfi/tests/testsfidl.cc
@@ -6,6 +6,8 @@
 #include "../sfidl-factory.hh"
 #include <stdio.h>
 
+#define app_error(...)  do { g_printerr ("%s: ", g_get_prgname()); g_printerr (__VA_ARGS__); exit (-1); } 
while (0)
+
 using namespace Sfidl;
 using namespace std;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]