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]

[Patch, Fortran, committed] PR36518 - Enable -Werror for libgfortran and fix a warning


When building "libgfortran", I got the error:
warning: format '%d' expects type 'int', but argument 2 has type 'index_type'
which I fixed by a cast.


In order to ensure this won't happen again, I now build libgfortran with "-Werror". I hope the latter will not break too many platforms - on my system (x86-64-gnu-linux) libgfortran builds without any error/warning, but I'm not positive that this also the case for other platforms. Hopefully, the fallout (if any) is easily fixable.

Committed as Rev. 136761.

Tobias
2008-06-13  Tobias Burnus  <burnus@net-b.de>

	PR libgfortran/36518
	* configure.ac (AM_CFLAGS): Add -Werror.
	* configure: Regenerate.
	* m4/ifunction_logical.m4: Cast "n" to "(int)".
	* generated/any_l16.c: Regenerate.
	* generated/any_l2.c: Regenerate.
	* generated/all_l1.c: Regenerate.
	* generated/all_l2.c: Regenerate.
	* generated/all_l16.c: Regenerate.
	* generated/any_l4.c: Regenerate.
	* generated/count_4_l.c: Regenerate.
	* generated/count_8_l.c: Regenerate.
	* generated/all_l4.c: Regenerate.
	* generated/count_1_l.c: Regenerate.
	* generated/count_16_l.c: Regenerate.
	* generated/any_l8.c: Regenerate.
	* generated/count_2_l.c: Regenerate.
	* generated/any_l1.c: Regenerate.
	* generated/all_l8.c: Regenerate.

Index: configure.ac
===================================================================
--- configure.ac	(Revision 136740)
+++ configure.ac	(Arbeitskopie)
@@ -126,7 +126,7 @@ if test "x$GCC" = "xyes"; then
   AM_FCFLAGS="-I . -Wall -Werror -fimplicit-none -fno-repack-arrays -fno-underscoring"
   ## We like to use C99 routines when available.  This makes sure that
   ## __STDC_VERSION__ is set such that libc includes make them available.
-  AM_CFLAGS="-std=gnu99 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings"
+  AM_CFLAGS="-std=gnu99 -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings"
   ## Compile the following tests with the same system header contents
   ## that we'll encounter when compiling our own source files.
   CFLAGS="-std=gnu99 $CFLAGS"
Index: m4/ifunction_logical.m4
===================================================================
--- m4/ifunction_logical.m4	(Revision 136740)
+++ m4/ifunction_logical.m4	(Arbeitskopie)
@@ -121,7 +121,7 @@ name`'rtype_qual`_'atype_code (rtype * c
 	      if (extent[n] != ret_extent)
 		runtime_error ("Incorrect extent in return value of"
 			       " u_name intrinsic in dimension %d:"
-			       " is %ld, should be %ld", n + 1,
+			       " is %ld, should be %ld", (int) n + 1,
 			       (long int) ret_extent, (long int) extent[n]);
 	    }
 	}
Index: configure
===================================================================
--- configure	(Revision 136740)
+++ configure	(Arbeitskopie)
@@ -3399,7 +3399,7 @@ if test "x$GCC" = "xyes"; then
   AM_FCFLAGS="-I . -Wall -Werror -fimplicit-none -fno-repack-arrays -fno-underscoring"
   ## We like to use C99 routines when available.  This makes sure that
   ## __STDC_VERSION__ is set such that libc includes make them available.
-  AM_CFLAGS="-std=gnu99 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings"
+  AM_CFLAGS="-std=gnu99 -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings"
   ## Compile the following tests with the same system header contents
   ## that we'll encounter when compiling our own source files.
   CFLAGS="-std=gnu99 $CFLAGS"
Index: generated/any_l16.c
===================================================================
--- generated/any_l16.c	(Revision 136740)
+++ generated/any_l16.c	(Arbeitskopie)
@@ -138,7 +138,7 @@ any_l16 (gfc_array_l16 * const restrict
 	      if (extent[n] != ret_extent)
 		runtime_error ("Incorrect extent in return value of"
 			       " ANY intrinsic in dimension %d:"
-			       " is %ld, should be %ld", n + 1,
+			       " is %ld, should be %ld", (int) n + 1,
 			       (long int) ret_extent, (long int) extent[n]);
 	    }
 	}
Index: generated/any_l2.c
===================================================================
--- generated/any_l2.c	(Revision 136740)
+++ generated/any_l2.c	(Arbeitskopie)
@@ -138,7 +138,7 @@ any_l2 (gfc_array_l2 * const restrict re
 	      if (extent[n] != ret_extent)
 		runtime_error ("Incorrect extent in return value of"
 			       " ANY intrinsic in dimension %d:"
-			       " is %ld, should be %ld", n + 1,
+			       " is %ld, should be %ld", (int) n + 1,
 			       (long int) ret_extent, (long int) extent[n]);
 	    }
 	}
Index: generated/all_l1.c
===================================================================
--- generated/all_l1.c	(Revision 136740)
+++ generated/all_l1.c	(Arbeitskopie)
@@ -138,7 +138,7 @@ all_l1 (gfc_array_l1 * const restrict re
 	      if (extent[n] != ret_extent)
 		runtime_error ("Incorrect extent in return value of"
 			       " ALL intrinsic in dimension %d:"
-			       " is %ld, should be %ld", n + 1,
+			       " is %ld, should be %ld", (int) n + 1,
 			       (long int) ret_extent, (long int) extent[n]);
 	    }
 	}
Index: generated/all_l2.c
===================================================================
--- generated/all_l2.c	(Revision 136740)
+++ generated/all_l2.c	(Arbeitskopie)
@@ -138,7 +138,7 @@ all_l2 (gfc_array_l2 * const restrict re
 	      if (extent[n] != ret_extent)
 		runtime_error ("Incorrect extent in return value of"
 			       " ALL intrinsic in dimension %d:"
-			       " is %ld, should be %ld", n + 1,
+			       " is %ld, should be %ld", (int) n + 1,
 			       (long int) ret_extent, (long int) extent[n]);
 	    }
 	}
Index: generated/all_l16.c
===================================================================
--- generated/all_l16.c	(Revision 136740)
+++ generated/all_l16.c	(Arbeitskopie)
@@ -138,7 +138,7 @@ all_l16 (gfc_array_l16 * const restrict
 	      if (extent[n] != ret_extent)
 		runtime_error ("Incorrect extent in return value of"
 			       " ALL intrinsic in dimension %d:"
-			       " is %ld, should be %ld", n + 1,
+			       " is %ld, should be %ld", (int) n + 1,
 			       (long int) ret_extent, (long int) extent[n]);
 	    }
 	}
Index: generated/any_l4.c
===================================================================
--- generated/any_l4.c	(Revision 136740)
+++ generated/any_l4.c	(Arbeitskopie)
@@ -138,7 +138,7 @@ any_l4 (gfc_array_l4 * const restrict re
 	      if (extent[n] != ret_extent)
 		runtime_error ("Incorrect extent in return value of"
 			       " ANY intrinsic in dimension %d:"
-			       " is %ld, should be %ld", n + 1,
+			       " is %ld, should be %ld", (int) n + 1,
 			       (long int) ret_extent, (long int) extent[n]);
 	    }
 	}
Index: generated/count_4_l.c
===================================================================
--- generated/count_4_l.c	(Revision 136740)
+++ generated/count_4_l.c	(Arbeitskopie)
@@ -138,7 +138,7 @@ count_4_l (gfc_array_i4 * const restrict
 	      if (extent[n] != ret_extent)
 		runtime_error ("Incorrect extent in return value of"
 			       " COUNT intrinsic in dimension %d:"
-			       " is %ld, should be %ld", n + 1,
+			       " is %ld, should be %ld", (int) n + 1,
 			       (long int) ret_extent, (long int) extent[n]);
 	    }
 	}
Index: generated/count_8_l.c
===================================================================
--- generated/count_8_l.c	(Revision 136740)
+++ generated/count_8_l.c	(Arbeitskopie)
@@ -138,7 +138,7 @@ count_8_l (gfc_array_i8 * const restrict
 	      if (extent[n] != ret_extent)
 		runtime_error ("Incorrect extent in return value of"
 			       " COUNT intrinsic in dimension %d:"
-			       " is %ld, should be %ld", n + 1,
+			       " is %ld, should be %ld", (int) n + 1,
 			       (long int) ret_extent, (long int) extent[n]);
 	    }
 	}
Index: generated/all_l4.c
===================================================================
--- generated/all_l4.c	(Revision 136740)
+++ generated/all_l4.c	(Arbeitskopie)
@@ -138,7 +138,7 @@ all_l4 (gfc_array_l4 * const restrict re
 	      if (extent[n] != ret_extent)
 		runtime_error ("Incorrect extent in return value of"
 			       " ALL intrinsic in dimension %d:"
-			       " is %ld, should be %ld", n + 1,
+			       " is %ld, should be %ld", (int) n + 1,
 			       (long int) ret_extent, (long int) extent[n]);
 	    }
 	}
Index: generated/count_1_l.c
===================================================================
--- generated/count_1_l.c	(Revision 136740)
+++ generated/count_1_l.c	(Arbeitskopie)
@@ -138,7 +138,7 @@ count_1_l (gfc_array_i1 * const restrict
 	      if (extent[n] != ret_extent)
 		runtime_error ("Incorrect extent in return value of"
 			       " COUNT intrinsic in dimension %d:"
-			       " is %ld, should be %ld", n + 1,
+			       " is %ld, should be %ld", (int) n + 1,
 			       (long int) ret_extent, (long int) extent[n]);
 	    }
 	}
Index: generated/count_16_l.c
===================================================================
--- generated/count_16_l.c	(Revision 136740)
+++ generated/count_16_l.c	(Arbeitskopie)
@@ -138,7 +138,7 @@ count_16_l (gfc_array_i16 * const restri
 	      if (extent[n] != ret_extent)
 		runtime_error ("Incorrect extent in return value of"
 			       " COUNT intrinsic in dimension %d:"
-			       " is %ld, should be %ld", n + 1,
+			       " is %ld, should be %ld", (int) n + 1,
 			       (long int) ret_extent, (long int) extent[n]);
 	    }
 	}
Index: generated/any_l8.c
===================================================================
--- generated/any_l8.c	(Revision 136740)
+++ generated/any_l8.c	(Arbeitskopie)
@@ -138,7 +138,7 @@ any_l8 (gfc_array_l8 * const restrict re
 	      if (extent[n] != ret_extent)
 		runtime_error ("Incorrect extent in return value of"
 			       " ANY intrinsic in dimension %d:"
-			       " is %ld, should be %ld", n + 1,
+			       " is %ld, should be %ld", (int) n + 1,
 			       (long int) ret_extent, (long int) extent[n]);
 	    }
 	}
Index: generated/count_2_l.c
===================================================================
--- generated/count_2_l.c	(Revision 136740)
+++ generated/count_2_l.c	(Arbeitskopie)
@@ -138,7 +138,7 @@ count_2_l (gfc_array_i2 * const restrict
 	      if (extent[n] != ret_extent)
 		runtime_error ("Incorrect extent in return value of"
 			       " COUNT intrinsic in dimension %d:"
-			       " is %ld, should be %ld", n + 1,
+			       " is %ld, should be %ld", (int) n + 1,
 			       (long int) ret_extent, (long int) extent[n]);
 	    }
 	}
Index: generated/any_l1.c
===================================================================
--- generated/any_l1.c	(Revision 136740)
+++ generated/any_l1.c	(Arbeitskopie)
@@ -138,7 +138,7 @@ any_l1 (gfc_array_l1 * const restrict re
 	      if (extent[n] != ret_extent)
 		runtime_error ("Incorrect extent in return value of"
 			       " ANY intrinsic in dimension %d:"
-			       " is %ld, should be %ld", n + 1,
+			       " is %ld, should be %ld", (int) n + 1,
 			       (long int) ret_extent, (long int) extent[n]);
 	    }
 	}
Index: generated/all_l8.c
===================================================================
--- generated/all_l8.c	(Revision 136740)
+++ generated/all_l8.c	(Arbeitskopie)
@@ -138,7 +138,7 @@ all_l8 (gfc_array_l8 * const restrict re
 	      if (extent[n] != ret_extent)
 		runtime_error ("Incorrect extent in return value of"
 			       " ALL intrinsic in dimension %d:"
-			       " is %ld, should be %ld", n + 1,
+			       " is %ld, should be %ld", (int) n + 1,
 			       (long int) ret_extent, (long int) extent[n]);
 	    }
 	}

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