This is the mail archive of the gcc-patches@gcc.gnu.org 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]

[PATCH]: fix some fortran warnings


This patch fixes warnings from the fortran directory which appear when
my patch to add "strict" warnings flags is added.  The following
warnings are fixed:

 > gfortran.h:244: warning: comma at end of enumerator list
 > gfortran.h:434: warning: type of bit-field 'access' is a GCC extension
 > gfortran.h:435: warning: type of bit-field 'intent' is a GCC extension
 > gfortran.h:436: warning: type of bit-field 'flavor' is a GCC extension
 > gfortran.h:437: warning: type of bit-field 'if_source' is a GCC extension
 > gfortran.h:439: warning: type of bit-field 'proc' is a GCC extension
	[repeats...]

 > decl.c:189:7: warning: C++ style comments are not allowed in ISO C90
 > decl.c:189:7: warning: (this will be reported only once per input file)
 > trans.c:440:39: warning: C++ style comments are not allowed in ISO C90
 > trans.c:440:39: warning: (this will be reported only once per input file)

Four other warnings remain which stem from a GMP inline function, I'm
not sure how to fix that one, so I'll defer it.

Note: I had to name the enums in the patch because the ENUM_BITFIELD
macro references them by enum name, not the typedef name.


Bootstrapped on x86_64-unknown-linux-gnu, no regressions.

Ok for mainline?

		Thanks,
		--Kaveh


2005-03-10  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* decl.c, trans.c: Don't use C++ style comments.
	* gfortran.h (sym_flavor, procedure_type, sym_intent, gfc_access,
	ifsrc): Give names to enums and use ENUM_BITFIELD.
	(gfc_access): Remove trailing comma.
	
diff -rup orig/egcc-CVS20050223/gcc/fortran/decl.c egcc-CVS20050223/gcc/fortran/decl.c
--- orig/egcc-CVS20050223/gcc/fortran/decl.c	2005-02-07 22:19:53.000000000 -0500
+++ egcc-CVS20050223/gcc/fortran/decl.c	2005-02-24 18:26:42.021939792 -0500
@@ -186,7 +186,7 @@ var_element (gfc_data_variable * new)
       return MATCH_ERROR;
     }
 
-#if 0 // TODO: Find out where to move this message
+#if 0 /* TODO: Find out where to move this message */
   if (sym->attr.in_common)
     /* See if sym is in the blank common block.  */
     for (t = &sym->ns->blank_common; t; t = t->common_next)
diff -rup orig/egcc-CVS20050223/gcc/fortran/gfortran.h egcc-CVS20050223/gcc/fortran/gfortran.h
--- orig/egcc-CVS20050223/gcc/fortran/gfortran.h	2005-02-23 19:30:06.000000000 -0500
+++ egcc-CVS20050223/gcc/fortran/gfortran.h	2005-02-24 18:25:56.974788000 -0500
@@ -218,7 +218,7 @@ interface_type;
 
 /* Symbol flavors: these are all mutually exclusive.
    10 elements = 4 bits.  */
-typedef enum
+typedef enum sym_flavor
 {
   FL_UNKNOWN = 0, FL_PROGRAM, FL_BLOCK_DATA, FL_MODULE, FL_VARIABLE,
   FL_PARAMETER, FL_LABEL, FL_PROCEDURE, FL_DERIVED, FL_NAMELIST
@@ -226,27 +226,27 @@ typedef enum
 sym_flavor;
 
 /* Procedure types.  7 elements = 3 bits.  */
-typedef enum
+typedef enum procedure_type
 { PROC_UNKNOWN, PROC_MODULE, PROC_INTERNAL, PROC_DUMMY,
   PROC_INTRINSIC, PROC_ST_FUNCTION, PROC_EXTERNAL
 }
 procedure_type;
 
 /* Intent types.  */
-typedef enum
+typedef enum sym_intent
 { INTENT_UNKNOWN = 0, INTENT_IN, INTENT_OUT, INTENT_INOUT
 }
 sym_intent;
 
 /* Access types.  */
-typedef enum
-{ ACCESS_UNKNOWN = 0, ACCESS_PUBLIC, ACCESS_PRIVATE, 
+typedef enum gfc_access
+{ ACCESS_UNKNOWN = 0, ACCESS_PUBLIC, ACCESS_PRIVATE
 }
 gfc_access;
 
 /* Flags to keep track of where an interface came from.
    4 elements = 2 bits.  */
-typedef enum
+typedef enum ifsrc
 { IFSRC_UNKNOWN = 0, IFSRC_DECL, IFSRC_IFBODY, IFSRC_USAGE
 }
 ifsrc;
@@ -431,12 +431,12 @@ typedef struct
   unsigned referenced:1;
 
   /* Mutually exclusive multibit attributes.  */
-  gfc_access access:2;
-  sym_intent intent:2;
-  sym_flavor flavor:4;
-  ifsrc if_source:2;
+  ENUM_BITFIELD (gfc_access) access:2;
+  ENUM_BITFIELD (sym_intent) intent:2;
+  ENUM_BITFIELD (sym_flavor) flavor:4;
+  ENUM_BITFIELD (ifsrc) if_source:2;
 
-  procedure_type proc:3;
+  ENUM_BITFIELD (procedure_type) proc:3;
 
 }
 symbol_attribute;
diff -rup orig/egcc-CVS20050223/gcc/fortran/trans.c egcc-CVS20050223/gcc/fortran/trans.c
--- orig/egcc-CVS20050223/gcc/fortran/trans.c	2005-01-18 19:50:33.000000000 -0500
+++ egcc-CVS20050223/gcc/fortran/trans.c	2005-02-24 18:47:04.798049568 -0500
@@ -437,7 +437,7 @@ gfc_get_backend_locus (locus * loc)
 {
   loc->lb = gfc_getmem (sizeof (gfc_linebuf));    
 #ifdef USE_MAPPED_LOCATION
-  loc->lb->location = input_location; // FIXME adjust??
+  loc->lb->location = input_location; /* FIXME adjust?? */
 #else
   loc->lb->linenum = input_line - 1;
 #endif



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