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: Increase maximum identifier length


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Find enclosed a patch that increases the default identifier length and 
adds a switch to select that length.

* gfortran.h: Increase default maximum identifier length.
* gfortran.h: Add option to choose allowed identifer length at run time.
* options.c: Initialise and set it.
* lang.opt: Explain it.
* match.c: Use it.
* module.c: Ditto.
* primary.c: Ditto.
* symbol.c: Ditto.

- -erik

- -- 
Erik Schnetter <schnetter@aei.mpg.de>   http://www.aei.mpg.de/~eschnett/

My email is as private as my paper mail.  I therefore support encrypting
and signing email messages.  Get my PGP key from www.keyserver.net.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAASzWm3uiSwno3f0RAg2QAJ9/oukHARF/x8orAtOSg//2QqMoGACggBnJ
JT63A8IpAr6LXCDXfvlWlcE=
=I250
-----END PGP SIGNATURE-----
Index: gfortran.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/Attic/gfortran.h,v
retrieving revision 1.1.2.9
diff -u -r1.1.2.9 gfortran.h
--- gfortran.h	4 Jan 2004 12:59:48 -0000	1.1.2.9
+++ gfortran.h	11 Jan 2004 10:55:20 -0000
@@ -59,7 +59,7 @@
 /* Major control parameters.  */
 
 #define GFC_VERSION "0.23"
-#define GFC_MAX_SYMBOL_LEN 31
+#define GFC_MAX_SYMBOL_LEN 127
 #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.  */
@@ -67,7 +67,7 @@
 #define MAX_ERROR_MESSAGE 1000	/* Maximum length of an error message.  */
 
 #define free(x) Use_gfc_free_instead_of_free()
-#define gfc_is_whitespace(c) ((c==' ') || (c=='\t'))
+#define gfc_is_whitespace(c) (((c)==' ') || ((c)=='\t'))
 
 #ifndef NULL
 #define NULL ((void *) 0)
@@ -1212,6 +1212,7 @@
   char *module_dir;
   gfc_source_form source_form;
   int fixed_line_length;
+  int max_identifier_length;
   int verbose;
 
   int warn_aliasing;
Index: lang-specs.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/Attic/lang-specs.h,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 lang-specs.h
--- lang-specs.h	26 Jul 2003 16:27:46 -0000	1.1.2.1
+++ lang-specs.h	11 Jan 2004 10:55:20 -0000
@@ -7,8 +7,11 @@
 /* This is the contribution to the `default_compilers' array in gcc.c
    for the f95 language.  */
 
+{".f", "@f77", 0},
+{".f77", "@f77", 0},
 {".f90", "@f95", 0},
 {".f95", "@f95", 0},
+{"@f77", "%{!E:f951 %i %<ffixed-format %(cc1_options) %{J*} %{I*}\
+         %{!fsyntax-only:%(invoke_as)}}", 0},
 {"@f95", "%{!E:f951 %i %<ffixed-format %(cc1_options) %{J*} %{I*}\
-         %{!fsyntax-only:%(invoke_as)}}", 0}
-,
+         %{!fsyntax-only:%(invoke_as)}}", 0},
Index: lang.opt
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/Attic/lang.opt,v
retrieving revision 1.1.2.6
diff -u -r1.1.2.6 lang.opt
--- lang.opt	4 Jan 2004 13:52:13 -0000	1.1.2.6
+++ lang.opt	11 Jan 2004 10:55:20 -0000
@@ -105,6 +105,18 @@
 F95 RejectNegative
 Use 132 character line width in fixed mode
 
+fmax-identifier-length-31
+F95 RejectNegative
+Allow at most 31 characters in identifiers (which is the Fortran 90 standard)
+
+fmax-identifier-length-63
+F95 RejectNegative
+Allow at most 63 characters in identifiers (which is the Fortran 2k3 standard)
+
+fmax-identifier-length-127
+F95 RejectNegative
+Allow at most 127 characters in identifiers
+
 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 -r1.1.2.7 match.c
--- match.c	4 Jan 2004 12:59:48 -0000	1.1.2.7
+++ match.c	11 Jan 2004 10:55:23 -0000
@@ -394,7 +394,7 @@
     {
       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: module.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/Attic/module.c,v
retrieving revision 1.1.2.3
diff -u -r1.1.2.3 module.c
--- module.c	10 Aug 2003 00:33:50 -0000	1.1.2.3
+++ module.c	11 Jan 2004 10:55:27 -0000
@@ -960,7 +960,7 @@
 	break;
 
       *p++ = c;
-      if (++len > GFC_MAX_SYMBOL_LEN)
+      if (++len > gfc_option.max_identifier_length)
 	bad_module ("Name too long");
     }
 
Index: options.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/Attic/options.c,v
retrieving revision 1.1.2.9
diff -u -r1.1.2.9 options.c
--- options.c	4 Jan 2004 12:59:49 -0000	1.1.2.9
+++ options.c	11 Jan 2004 10:55:27 -0000
@@ -48,6 +48,7 @@
   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;
@@ -264,6 +265,18 @@
 
     case OPT_ffixed_line_length_132:
       gfc_option.fixed_line_length = 132;
+      break;
+
+    case OPT_fmax_identifier_length_31:
+      gfc_option.max_identifier_length = 31;
+      break;
+
+    case OPT_fmax_identifier_length_63:
+      gfc_option.max_identifier_length = 63;
+      break;
+
+    case OPT_fmax_identifier_length_127:
+      gfc_option.max_identifier_length = 127;
       break;
 
     case OPT_qkind_:
Index: primary.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/Attic/primary.c,v
retrieving revision 1.1.2.4
diff -u -r1.1.2.4 primary.c
--- primary.c	12 Dec 2003 12:47:08 -0000	1.1.2.4
+++ primary.c	11 Jan 2004 10:55:29 -0000
@@ -702,7 +702,7 @@
 	break;
 
       *name++ = c;
-      if (++len > GFC_MAX_SYMBOL_LEN)
+      if (++len > gfc_option.max_identifier_length)
 	break;
     }
 
Index: symbol.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/Attic/symbol.c,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 symbol.c
--- symbol.c	2 Aug 2003 00:26:48 -0000	1.1.2.2
+++ symbol.c	11 Jan 2004 10:55:32 -0000
@@ -1809,7 +1809,7 @@
 
   p->declared_at = *gfc_current_locus ();
 
-  if (strlen (name) > GFC_MAX_SYMBOL_LEN)
+  if (strlen (name) > gfc_option.max_identifier_length)
     gfc_internal_error ("new_symbol(): Symbol name too long");
 
   strcpy (p->name, name);

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