Patch for g77/fortran "format not a string literal" warnings
Kaveh R. Ghazi
ghazi@caip.rutgers.edu
Sun Nov 28 18:12:00 GMT 1999
> From: Jeffrey A Law <law@cygnus.com>
>
> > +
> > +extern int vasprintf (char **, const char *, va_list) ATTRIBUTE_PRINTF(2,0
> Err, shouldn't we get this from an include file? Like libiberty.h?!?
I though about that, but currently we don't guarantee a definition for
va_list everywhere libiberty.h is used. We do so in the gcc directory
which gets stdarg.h via system.h. But many/most of the files in the
libiberty directory itself don't include stdarg.h/varargs.h to get
va_list, and thus they fails to compile. Other packages which use
libiberty.h (binutils? gdb?) would have the same issue.
> Otherwise it looks good and does cleam up on ugly code in the
> g77 front end. Consider it approved once you clean up the include
> file stuff and the minor whitespace nits.
> jeff
Okay, here's what I did, regarding {v}asprintf in libiberty.h:
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/egcs/include/ChangeLog,v
retrieving revision 1.27
diff -u -p -r1.27 ChangeLog
--- ChangeLog 1999/11/10 17:57:20 1.27
+++ ChangeLog 1999/11/29 02:06:00
@@ -1,3 +1,8 @@
+1999-11-28 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * libiberty.h: Include stdarg.h when ANSI_PROTOTYPES is defined.
+ (asprintf, vasprintf): Provide declarations.
+
Wed Nov 10 12:43:21 1999 Philippe De Muyter <phdm@macqel.be>
Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
Index: libiberty.h
===================================================================
RCS file: /cvs/gcc/egcs/include/libiberty.h,v
retrieving revision 1.9
diff -u -p -r1.9 libiberty.h
--- libiberty.h 1999/09/25 13:11:12 1.9
+++ libiberty.h 1999/11/29 02:06:00
@@ -134,6 +134,8 @@ extern void xmalloc_set_program_name PAR
#ifdef ANSI_PROTOTYPES
/* Get a definition for size_t. */
#include <stddef.h>
+/* Get a definition for va_list. */
+#include <stdarg.h>
#endif
extern PTR xmalloc PARAMS ((size_t));
@@ -181,6 +183,17 @@ extern int pexecute PARAMS ((const char
/* Wait for pexecute to finish. */
extern int pwait PARAMS ((int, int *, int));
+
+/* Like sprintf but provides a pointer to malloc'd storage, which must
+ be freed by the caller. */
+
+extern int asprintf PARAMS ((char **, const char *, ...)) ATTRIBUTE_PRINTF_2;
+
+/* Like vsprintf but provides a pointer to malloc'd storage, which
+ must be freed by the caller. */
+
+extern int vasprintf PARAMS ((char **, const char *, va_list))
+ ATTRIBUTE_PRINTF(2,0);
#ifdef __cplusplus
}
More information about the Gcc-patches
mailing list