This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch] ../../../src/libgfortran/io/write.c:713: error: conflicting types for 'itoa'

On Mon, Apr 13, 2009 at 8:36 PM, Janne Blomqvist
<> wrote:
>> Renaming ?itoa back to gfc_itoa and adjusting callers ?fixes.
> Ok. Please also add a note about this to the comment in write.c;
> Usually we use gfc_* names only for non-static symbols.
Is this comment OK?

Index: io/write.c
--- io/write.c	(revision 145949)
+++ io/write.c	(working copy)
@@ -707,10 +707,13 @@

-/* itoa()-- Integer to decimal conversion. */
+/* gfc_itoa()-- Integer to decimal conversion.
+   Even though this is a static function we need to take care not to
+   conflict with a prior non-static declaration (which is undefined
+   behaviour per ISO C99 6.2.2 p7).  Hence the 'gfc_' prefix.  */

 static const char *
-itoa (GFC_INTEGER_LARGEST n, char *buffer, size_t len)
+gfc_itoa (GFC_INTEGER_LARGEST n, char *buffer, size_t len)
   int negative;
   char *p;
@@ -747,7 +750,7 @@
 write_i (st_parameter_dt *dtp, const fnode *f, const char *p, int len)
-  write_decimal (dtp, f, p, len, (void *) itoa);
+  write_decimal (dtp, f, p, len, (void *) gfc_itoa);

@@ -862,7 +865,7 @@
   int width;
   char itoa_buf[GFC_ITOA_BUF_SIZE];

-  q = itoa (extract_int (source, length), itoa_buf, sizeof (itoa_buf));
+  q = gfc_itoa (extract_int (source, length), itoa_buf, sizeof (itoa_buf));

   switch (length)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]