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]

[gfortran] Increase maximum identifier length


On Sunday 11 January 2004 11:03 am, Erik Schnetter wrote:
> Find enclosed a patch that increases the default identifier length
> and adds a switch to select that length.

I see no reason to restrict the option to specific values.  Applied as follows

Paul

2004-01-11  Erik Schnetter  <schnetter@uni-tuebingen.de>

	* gfortran.h (GFC_MAX_SYMBOL_LEN): Increase.
	(gfc_option_t): Add max_identifier_length.
	* lang.opt: Add fmax-identifier-length.
	* match.c (parse_name): Use limit.
	* options.c (gfc_init_options): Set max_identifier_length.
	(gfc_handle_option): Ditto.

Index: gfortran.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/Attic/gfortran.h,v
retrieving revision 1.1.2.9
diff -u -p -r1.1.2.9 gfortran.h
--- gfortran.h	4 Jan 2004 12:59:48 -0000	1.1.2.9
+++ gfortran.h	11 Jan 2004 15:17:55 -0000
@@ -59,7 +59,7 @@ char *alloca ();
 /* Major control parameters.  */
 
 #define GFC_VERSION "0.23"
-#define GFC_MAX_SYMBOL_LEN 31
+#define GFC_MAX_SYMBOL_LEN 63
 #define GFC_REAL_BITS 100	/* Number of bits in g95's floating point numbers.  
*/
 #define GFC_MAX_LINE 132	/* Characters beyond this are not seen.  */
 #define GFC_MAX_DIMENSIONS 7	/* Maximum dimensions in an array.  */
@@ -1212,6 +1212,7 @@ typedef struct
   char *module_dir;
   gfc_source_form source_form;
   int fixed_line_length;
+  int max_identifier_length;
   int verbose;
 
   int warn_aliasing;
Index: lang.opt
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/Attic/lang.opt,v
retrieving revision 1.1.2.6
diff -u -p -r1.1.2.6 lang.opt
--- lang.opt	4 Jan 2004 13:52:13 -0000	1.1.2.6
+++ lang.opt	11 Jan 2004 15:17:55 -0000
@@ -105,6 +105,10 @@ ffixed-line-length-132
 F95 RejectNegative
 Use 132 character line width in fixed mode
 
+fmax-identifier-length=
+F95 RejectNegative Joined UInteger
+-fmax-identifier-length=<n>	Maximum identifier length.
+
 fmax-stack-var-size=
 F95 RejectNegative Joined UInteger
 -fmax-stack-var-size=<n>	Size in bytes of the largest array that will be put 
on the stack
Index: match.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/Attic/match.c,v
retrieving revision 1.1.2.7
diff -u -p -r1.1.2.7 match.c
--- match.c	4 Jan 2004 12:59:48 -0000	1.1.2.7
+++ match.c	11 Jan 2004 15:17:56 -0000
@@ -394,7 +394,7 @@ gfc_match_name (char *buffer)
     {
       buffer[i++] = c;
 
-      if (i > GFC_MAX_SYMBOL_LEN)
+      if (i > gfc_option.max_identifier_length)
 	{
 	  gfc_error ("Name at %C is too long");
 	  return MATCH_ERROR;
Index: options.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/Attic/options.c,v
retrieving revision 1.1.2.9
diff -u -p -r1.1.2.9 options.c
--- options.c	4 Jan 2004 12:59:49 -0000	1.1.2.9
+++ options.c	11 Jan 2004 15:17:56 -0000
@@ -48,6 +48,7 @@ gfc_init_options (unsigned int argc ATTR
   gfc_option.module_dir = NULL;
   gfc_option.source_form = FORM_UNKNOWN;
   gfc_option.fixed_line_length = 72;
+  gfc_option.max_identifier_length = GFC_MAX_SYMBOL_LEN;
   gfc_option.verbose = 0;
 
   gfc_option.warn_aliasing = 0;
@@ -266,6 +267,13 @@ gfc_handle_option (size_t scode, const c
       gfc_option.fixed_line_length = 132;
       break;
 
+    case OPT_fmax_identifier_length_:
+      if (value > GFC_MAX_SYMBOL_LEN)
+	gfc_fatal_error ("Maximum supported idenitifier length is %d",
+			 GFC_MAX_SYMBOL_LEN);
+      gfc_option.max_identifier_length = value;
+      break;
+
     case OPT_qkind_:
       if (gfc_validate_kind (BT_REAL, value) < 0)
 	gfc_fatal_error ("Argument to -fqkind isn't a valid real kind");
@@ -296,12 +304,14 @@ gfc_handle_option (size_t scode, const c
       gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F2003_OBS
 	| GFC_STD_F2003_DEL;
       gfc_option.warn_std = GFC_STD_F95_OBS;
+      gfc_option.max_identifier_length = 31;
       break;
 
     case OPT_std_f2003:
       gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F2003_OBS
 	| GFC_STD_F2003;
       gfc_option.warn_std = GFC_STD_F95_OBS | GFC_STD_F2003_OBS;
+      gfc_option.max_identifier_length = 63;
       break;
 
     case OPT_std_gnu:


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