better error reporting in scanobj and scangobj

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

better error reporting in scanobj and scangobj

Stefan Sauer-4
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;
     }
 

_______________________________________________
gtk-doc-list mailing list
[hidden email]
http://mail.gnome.org/mailman/listinfo/gtk-doc-list
Reply | Threaded
Open this post in threaded view
|

Re: better error reporting in scanobj and scangobj

Jochen Voss
Hello,

On Mon, Jul 04, 2005 at 08:34:17AM +0200, Stefan Kost wrote:
> +      g_warning ("Couldn't open output file: %s\\n%d : %s", ...);
Shouldn't it be \n insteal of \\n?

All the best,
Jochen
--
http://seehuhn.de/

_______________________________________________
gtk-doc-list mailing list
[hidden email]
http://mail.gnome.org/mailman/listinfo/gtk-doc-list

signature.asc (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: better error reporting in scanobj and scangobj

Stefan Sauer-4
Hi Jochen

> Hello,
>
> On Mon, Jul 04, 2005 at 08:34:17AM +0200, Stefan Kost wrote:
>
>>+      g_warning ("Couldn't open output file: %s\\n%d : %s", ...);
>
> Shouldn't it be \n insteal of \\n?
>
> All the best,
> Jochen

no, it shouldn't. The source is generated from perl and the double backslash is
needed to produce a single one in the output.

Stefan
_______________________________________________
gtk-doc-list mailing list
[hidden email]
http://mail.gnome.org/mailman/listinfo/gtk-doc-list