better error reporting in scanobj and scangobj



hi,

the attached patch adds better error reporting for the scanners. May I
commit?

Stefan
Index: gtkdoc-scangobj.in
===================================================================
RCS file: /cvs/gnome/gtk-doc/gtkdoc-scangobj.in,v
retrieving revision 1.42
diff -u -u -r1.42 gtkdoc-scangobj.in
--- gtkdoc-scangobj.in	14 Oct 2004 15:50:50 -0000	1.42
+++ gtkdoc-scangobj.in	29 Jun 2005 15:16:28 -0000
@@ -119,6 +119,7 @@
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
+#include <errno.h>
 
 $includes
 #ifdef GTK_IS_WIDGET_CLASS
@@ -217,7 +218,7 @@
   fp = fopen (signals_filename, "w");
   if (fp == NULL)
     {
-      g_warning ("Couldn't open output file: %s", signals_filename);
+      g_warning ("Couldn't open output file: %s\\n%d : %s", signals_filename, errno, strerror(errno));
       return;
     }
 
@@ -744,7 +745,7 @@
   fp = fopen (hierarchy_filename, "w");
   if (fp == NULL)
     {
-      g_warning ("Couldn't open output file: %s", hierarchy_filename);
+      g_warning ("Couldn't open output file: %s\\n%d : %s", hierarchy_filename, errno, strerror(errno));
       return;
     }
   output_hierarchy (fp, G_TYPE_OBJECT, 0);
@@ -785,7 +786,7 @@
   fp = fopen (interfaces_filename, "w");
   if (fp == NULL)
     {
-      g_warning ("Couldn't open output file: %s", interfaces_filename);
+      g_warning ("Couldn't open output file: %s\\n%d : %s", interfaces_filename, errno, strerror(errno));
       return;
     }
   output_interfaces (fp, G_TYPE_OBJECT);
@@ -829,7 +830,7 @@
   fp = fopen (prerequisites_filename, "w");
   if (fp == NULL)
     {
-      g_warning ("Couldn't open output file: %s", prerequisites_filename);
+      g_warning ("Couldn't open output file: %s\\n%d : %s", prerequisites_filename, errno, strerror(errno));
       return;
     }
   output_prerequisites (fp, G_TYPE_INTERFACE);
@@ -877,7 +878,7 @@
   fp = fopen (args_filename, "w");
   if (fp == NULL)
     {
-      g_warning ("Couldn't open output file: %s", args_filename);
+      g_warning ("Couldn't open output file: %s\\n%d : %s", args_filename, errno, strerror(errno));
       return;
     }
 
Index: gtkdoc-scanobj.in
===================================================================
RCS file: /cvs/gnome/gtk-doc/gtkdoc-scanobj.in,v
retrieving revision 1.21
diff -u -u -r1.21 gtkdoc-scanobj.in
--- gtkdoc-scanobj.in	14 Oct 2004 15:50:50 -0000	1.21
+++ gtkdoc-scanobj.in	29 Jun 2005 15:16:28 -0000
@@ -89,7 +89,9 @@
 
 print OUTPUT <<EOT;
 #include <string.h>
+#include <stdlib.h>
 #include <stdio.h>
+#include <errno.h>
 
 $includes
 GtkType object_types[$ntypes];
@@ -177,7 +179,7 @@
   fp = fopen (signals_filename, "w");
   if (fp == NULL)
     {
-      g_warning ("Couldn't open output file: %s", signals_filename);
+      g_warning ("Couldn't open output file: %s\\n%d : %s", signals_filename, errno, strerror(errno));
       return;
     }
 
@@ -694,7 +696,7 @@
   fp = fopen (hierarchy_filename, "w");
   if (fp == NULL)
     {
-      g_warning ("Couldn't open output file: %s", hierarchy_filename);
+      g_warning ("Couldn't open output file: %s\\n%d : %s", hierarchy_filename, errno, strerror(errno));
       return;
     }
   output_hierarchy (fp, GTK_TYPE_OBJECT, 0);
@@ -739,7 +741,7 @@
   fp = fopen (args_filename, "w");
   if (fp == NULL)
     {
-      g_warning ("Couldn't open output file: %s", args_filename);
+      g_warning ("Couldn't open output file: %s\\n%d : %s", args_filename, errno, strerror(errno));
       return;
     }
 


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