bug-global
[Top][All Lists]
Advanced

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

[PATCH] fix error message


From: Hideki IWAMOTO
Subject: [PATCH] fix error message
Date: Thu, 12 Jun 2003 00:41:02 +0900

* gtags/gtags.c: Deleted excessive '\n'.
* libutil/conf.c: Fixed mismatch of format string and argument (%d and pointer).
* libutil/die.h: Added function attribute for checking type of argument.

Index: gtags/gtags.c
===================================================================
RCS file: /cvsroot/global/global/gtags/gtags.c,v
retrieving revision 1.78
diff -u -r1.78 gtags.c
--- gtags/gtags.c       11 Jun 2003 11:27:00 -0000      1.78
+++ gtags/gtags.c       11 Jun 2003 15:32:14 -0000
@@ -451,7 +451,7 @@
                                if (!isabspath(path))
                                        die("realpath(3) is not compatible with 
BSD version.");
                                if (strncmp(path, root, strlen(root)))
-                                       die("'%s' is out of source tree.\n", 
path);
+                                       die("'%s' is out of source tree.", 
path);
                        }
                        ip = fopen(argv[0], "r");
                        if (ip == NULL)
Index: libutil/conf.c
===================================================================
RCS file: /cvsroot/global/global/libutil/conf.c,v
retrieving revision 1.29
diff -u -r1.29 conf.c
--- libutil/conf.c      23 Feb 2003 13:02:02 -0000      1.29
+++ libutil/conf.c      11 Jun 2003 15:32:14 -0000
@@ -141,7 +141,7 @@
                                die("invalid config file format (line %d).", 
count);
                        if (!strcmp(label, candidate)) {
                                if (!(p = locatestring(p, ":", MATCH_FIRST)))
-                                       die("invalid config file format (line 
%d).", strbuf_value(ib));
+                                       die("invalid config file format (line 
%d).", count);
                                p = strdup(p);
                                if (!p)
                                        die("short of memory.");
Index: libutil/die.h
===================================================================
RCS file: /cvsroot/global/global/libutil/die.h,v
retrieving revision 1.7
diff -u -r1.7 die.h
--- libutil/die.h       15 May 2003 11:09:09 -0000      1.7
+++ libutil/die.h       11 Jun 2003 15:32:15 -0000
@@ -32,27 +32,44 @@
 #include <varargs.h>
 #endif
 
+#ifndef __attribute__
+/* This feature is available in gcc versions 2.5 and later.  */
+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
+#  define __attribute__(x)
+# endif
+/* The __-protected variants of `format' and `printf' attributes
+   are accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
+#  define __format__ format
+#  define __printf__ printf
+# endif
+#endif
+
 extern const char *progname;
 
 void setquiet();
 void setverbose();
 #ifdef HAVE_STDARG_H
-void die(const char *s, ...);
+void die(const char *s, ...)
+       __attribute__ ((__format__ (__printf__, 1, 2)));
 #else
 void die();
 #endif
 #ifdef HAVE_STDARG_H
-void die_with_code(int n, const char *s, ...);
+void die_with_code(int n, const char *s, ...)
+       __attribute__ ((__format__ (__printf__, 2, 3)));
 #else
 void die_with_code();
 #endif
 #ifdef HAVE_STDARG_H
-void message(const char *s, ...);
+void message(const char *s, ...)
+       __attribute__ ((__format__ (__printf__, 1, 2)));
 #else
 void message();
 #endif
 #ifdef HAVE_STDARG_H
-void warning(const char *s, ...);
+void warning(const char *s, ...)
+       __attribute__ ((__format__ (__printf__, 1, 2)));
 #else
 void warning();
 #endif

----
Hideki IWAMOTO  address@hidden





reply via email to

[Prev in Thread] Current Thread [Next in Thread]