[Bug fortran/32860] Support %ld (for "long") for gfc_warning

2007-08-12 Thread fxcoudert at gcc dot gnu dot org


--- Comment #4 from fxcoudert at gcc dot gnu dot org  2007-08-12 20:42 
---
Fixed.


-- 

fxcoudert at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32860



[Bug fortran/32860] Support %ld (for "long") for gfc_warning

2007-08-12 Thread fxcoudert at gcc dot gnu dot org


--- Comment #3 from fxcoudert at gcc dot gnu dot org  2007-08-12 20:39 
---
Subject: Bug 32860

Author: fxcoudert
Date: Sun Aug 12 20:39:18 2007
New Revision: 127382

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=127382
Log:
PR fortran/32860

* error.c (error_uinteger): New function.
(error_integer): Call error_uinteger.
(error_print): Handle %u, %lu, %li and %ld format specifiers.
* interface.c (compare_actual_formal): Use the new %lu specifier.

* c-format.c (gcc_gfc_length_specs): New array.
(gcc_gfc_char_table): Add unsigned specifier, and references to
the l length modifier.
(format_types_orig): Use the new gcc_gfc_length_specs.

* gcc.dg/format/gcc_gfc-1.c: Updated with new formats.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/c-format.c
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/error.c
trunk/gcc/fortran/interface.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.dg/format/gcc_gfc-1.c


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32860



[Bug fortran/32860] Support %ld (for "long") for gfc_warning

2007-08-09 Thread fxcoudert at gcc dot gnu dot org


--- Comment #2 from fxcoudert at gcc dot gnu dot org  2007-08-09 21:58 
---
The patch in the previous comment wasn't even building, here is a one that
regtests and that I submitted to review.


-- 

fxcoudert at gcc dot gnu dot org changed:

   What|Removed |Added

URL||http://gcc.gnu.org/ml/gcc-
   ||patches/2007-
   ||08/msg00605.html
   Keywords||patch


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32860



[Bug fortran/32860] Support %ld (for "long") for gfc_warning

2007-08-09 Thread fxcoudert at gcc dot gnu dot org


-- 

fxcoudert at gcc dot gnu dot org changed:

   What|Removed |Added

 AssignedTo|unassigned at gcc dot gnu   |fxcoudert at gcc dot gnu dot
   |dot org |org
 Status|NEW |ASSIGNED
   Last reconfirmed|2007-08-06 23:46:07 |2007-08-09 19:22:36
   date||


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32860



[Bug fortran/32860] Support %ld (for "long") for gfc_warning

2007-08-06 Thread fxcoudert at gcc dot gnu dot org


--- Comment #1 from fxcoudert at gcc dot gnu dot org  2007-08-06 23:46 
---
Hi Tobias, what do you think about this patch? I think it would add %u for
unsigned int, %lu for unsigned long int, %li and %ld for long int. I have no
time to test, but I think it should work ok (I wrote the current version of
these functions...) 


Index: error.c
===
--- error.c (revision 127224)
+++ error.c (working copy)
@@ -113,19 +113,13 @@ error_string (const char *p)

 /* Print a formatted integer to the error buffer or output.  */

-#define IBUF_LEN 30
+#define IBUF_LEN 60

 static void
-error_integer (int i)
+error_uinteger (unsigned long int i)
 {
   char *p, int_buf[IBUF_LEN];

-  if (i < 0)
-{
-  i = -i;
-  error_char ('-');
-}
-
   p = int_buf + IBUF_LEN - 1;
   *p-- = '\0';

@@ -141,6 +135,22 @@ error_integer (int i)
   error_string (p + 1);
 }

+static void
+error_integer (long int i)
+{
+  unsigned long int u;
+
+  if (i < 0)
+{
+  u = (unsigned long int) -i;
+  error_char ('-');
+}
+  else
+u = i;
+
+  error_uinteger (u);
+}
+

 /* Show the file, where it was included, and the source line, give a
locus.  Calls error_printf() recursively, but the recursion is at
@@ -368,7 +378,8 @@ show_loci (locus *l1, locus *l2)
 static void ATTRIBUTE_GCC_GFC(2,0)
 error_print (const char *type, const char *format0, va_list argp)
 {
-  enum { TYPE_CURRENTLOC, TYPE_LOCUS, TYPE_INTEGER, TYPE_CHAR, TYPE_STRING,
+  enum { TYPE_CURRENTLOC, TYPE_LOCUS, TYPE_INTEGER, TYPE_UINTEGER,
+ TYPE_LONGINT, TYPE_ULONGINT, TYPE_CHAR, TYPE_STRING,
 NOTYPE };
   struct
   {
@@ -377,6 +388,9 @@ error_print (const char *type, const cha
 union
 {
   int intval;
+  unsigned int uintval;
+  long int longintval;
+  unsigned long int ulongintval;
   char charval;
   const char * stringval;
 } u;
@@ -453,6 +467,18 @@ error_print (const char *type, const cha
arg[pos].type = TYPE_INTEGER;
break;

+ case 'u':
+   arg[pos].type = TYPE_UINTEGER;
+
+ case 'l':
+   c = *format++;
+   if (c == 'u')
+ arg[pos].type = TYPE_ULONGINT;
+   else if (c == 'i' || c == 'd')
+ arg[pos].type = TYPE_LONGINT;
+   else
+ gcc_unreachable ();
+
  case 'c':
arg[pos].type = TYPE_CHAR;
break;
@@ -499,6 +525,18 @@ error_print (const char *type, const cha
arg[pos].u.intval = va_arg (argp, int);
break;

+ case TYPE_UINTEGER:
+   arg[pos].u.uintval = va_arg (argp, unsigned int);
+   break;
+
+ case TYPE_LONGINT:
+   arg[pos].u.longintval = va_arg (argp, long int);
+   break;
+
+ case TYPE_ULONGINT:
+   arg[pos].u.ulongintval = va_arg (argp, unsigned long int);
+   break;
+
  case TYPE_CHAR:
arg[pos].u.charval = (char) va_arg (argp, int);
break;
@@ -568,6 +606,19 @@ error_print (const char *type, const cha
case 'i':
  error_integer (spec[n++].u.intval);
  break;
+
+   case 'u':
+ error_uinteger (spec[n++].u.uintval);
+ break;
+
+   case 'l':
+ format++;
+ if (*format == 'u')
+   error_uinteger (spec[n++].u.ulongintval);
+ else
+   error_integer (spec[n++].u.longintval);
+ break;
+
}
 }



-- 

fxcoudert at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||fxcoudert at gcc dot gnu dot
   ||org
 Status|UNCONFIRMED |NEW
 Ever Confirmed|0   |1
   Last reconfirmed|-00-00 00:00:00 |2007-08-06 23:46:07
   date||


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32860



[Bug fortran/32860] Support %ld (for "long") for gfc_warning

2007-07-23 Thread burnus at gcc dot gnu dot org


-- 

burnus at gcc dot gnu dot org changed:

   What|Removed |Added

   Severity|normal  |minor
   Keywords|diagnostic  |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32860