This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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'


> Well, actually I was thinking of a note saying that "itoa" conflicts with
> something in mingw, hence the per-libgfortran-convention unusual name. But
> whatever, no big deal either way.
>

As committed:

2009-04-15 Danny Smith  <dannysmith@clear.net.nz>

       * io/write.c (itoa) : Rename back to gfc_itoa.
       (write_i): Adjust call to write_decimal.
       (write_integer):  Use gfc_itoa.

Index: io/write.c
===================================================================
--- io/write.c	(revision 146078)
+++ io/write.c	(working copy)
@@ -707,10 +707,15 @@
 }


-/* itoa()-- Integer to decimal conversion. */
+/* gfc_itoa()-- Integer to decimal conversion.
+   The itoa function is a widespread non-standard extension to standard
+   C, often declared in <stdlib.h>.  Even though the itoa defined here
+   is a static function we take care not to conflict with any prior
+   non-static declaration.  Hence the 'gfc_' prefix, which is normally
+   reserved for functions with external linkage.  */

 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 +752,7 @@
 void
 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 +867,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]