[gfortran] Comment fixes.

Paul Brook paul@codesourcery.com
Fri Aug 13 17:30:00 GMT 2004


The patch below adds a few comments, and fixes typos in a few others.

Tobi did the hard work, I just pulled them out of a half-finished patch he 
sent me.

Tested on i686-linux.
Applied to mainline.

Paul

2004-08-13  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>

	* gfortran.h: Add comments.
	* parse.c (parse_contained): Fix comment typo.
	* resolve.c (was_declared): Ditto.
	* symbol.c: Ditto.

Index: gfortran.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/gfortran.h,v
retrieving revision 1.21
diff -u -p -r1.21 gfortran.h
--- gfortran.h	8 Aug 2004 12:28:25 -0000	1.21
+++ gfortran.h	12 Aug 2004 17:18:29 -0000
@@ -528,7 +529,9 @@ gfc_component;
 /* Formal argument lists are lists of symbols.  */
 typedef struct gfc_formal_arglist
 {
+  /* Symbol representing the argument at this position in the arglist.  */
   struct gfc_symbol *sym;
+  /* Points to the next formal argument.  */
   struct gfc_formal_arglist *next;
 }
 gfc_formal_arglist;
@@ -712,18 +734,39 @@ gfc_symtree;
 
 typedef struct gfc_namespace
 {
-  /* Roots of the red/black symbol trees */
-  gfc_symtree *sym_root, *uop_root, *common_root;	
+  /* Tree containing all the symbols in this namespace.  */
+  gfc_symtree *sym_root;
+  /* Tree containing all the user-defined operators in the namespace.  */
+  gfc_symtree *uop_root;
+  /* Tree containing all the common blocks.  */
+  gfc_symtree *common_root;	
 
+  /* If set_flag[letter] is set, an implicit type has been set for letter.  
*/
   int set_flag[GFC_LETTERS];
-  gfc_typespec default_type[GFC_LETTERS];	/* IMPLICIT typespecs */
+  /* Keeps track of the implicit types associated with the letters.  */
+  gfc_typespec default_type[GFC_LETTERS];
 
+  /* If this is a namespace of a procedure, this points to the procedure.  */
   struct gfc_symbol *proc_name;
-  gfc_interface *operator[GFC_INTRINSIC_OPS];
-  struct gfc_namespace *parent, *contained, *sibling;
+  /* If this is the namespace of a unit which contains executable
+     code, this points to it.  */
   struct gfc_code *code;
-  gfc_common_head blank_common;
+
+  /* Points to the equivalences set up in this namespace.  */
   struct gfc_equiv *equiv;
+  gfc_interface *operator[GFC_INTRINSIC_OPS];
+
+  /* Points to the parent namespace, i.e. the namespace of a module or
+     procedure in which the procedure belonging to this namespace is
+     contained. The parent namespace points to this namespace either
+     directly via CONTAINED, or indirectly via the chain built by
+     SIBLING.  */
+  struct gfc_namespace *parent;
+  /* CONTAINED points to the first contained namespace. Sibling
+     namespaces are chained via SIBLING.  */
+  struct gfc_namespace  *contained, *sibling;
+
+  gfc_common_head blank_common;
   gfc_access default_access, operator_access[GFC_INTRINSIC_OPS];
 
   gfc_st_label *st_labels;
@@ -850,6 +893,13 @@ typedef struct gfc_intrinsic_arg
 gfc_intrinsic_arg;
 
 
+/* Specifies the various kinds of check functions used to verify the
+   argument lists of intrinsic functions. fX with X an integer refer
+   to check functions of intrinsics with X arguments. f1m is used for
+   the MAX and MIN intrinsics which can have an arbitrary number of
+   arguments, f3ml is used for the MINLOC and MAXLOC intrinsics as
+   these have special semantics.  */
+
 typedef union
 {
   try (*f1)(struct gfc_expr *);
@@ -864,6 +914,9 @@ typedef union
 }
 gfc_check_f;
 
+/* Like gfc_check_f, these specify the type of the simplification
+   function associated with an intrinsic. The fX are just like in
+   gfc_check_f. cc is used for type conversion functions.  */
 
 typedef union
 {
@@ -880,6 +933,10 @@ typedef union
 }
 gfc_simplify_f;
 
+/* Again like gfc_check_f, these specify the type of the resolution
+   function associated with an intrinsic. The fX are juse like in
+   gfc_check_f. f1m is used for MIN and MAX, s1 is used for abort().
+   */
 
 typedef union
 {
Index: parse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/parse.c,v
retrieving revision 1.15
diff -u -p -r1.15 parse.c
--- parse.c	16 Jul 2004 00:57:41 -0000	1.15
+++ parse.c	12 Aug 2004 17:18:38 -0000
@@ -2201,7 +2202,7 @@ parse_contained (int module)
 		      gfc_new_block);
 
 	  /* For internal procedures, create/update the symbol in the
-	   * parent namespace */
+	     parent namespace.  */
 
 	  if (!module)
 	    {
Index: resolve.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/resolve.c,v
retrieving revision 1.10
diff -u -p -r1.10 resolve.c
--- resolve.c	9 Jul 2004 21:20:50 -0000	1.10
+++ resolve.c	12 Aug 2004 17:18:38 -0000
@@ -371,7 +371,7 @@ resolve_structure_cons (gfc_expr * expr)
 /****************** Expression name resolution ******************/
 
 /* Returns 0 if a symbol was not declared with a type or
-   or attribute declaration statement, nonzero otherwise.  */
+   attribute declaration statement, nonzero otherwise.  */
 
 static int
 was_declared (gfc_symbol * sym)
Index: symbol.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/symbol.c,v
retrieving revision 1.10
diff -u -p -r1.10 symbol.c
--- symbol.c	10 Jul 2004 22:37:16 -0000	1.10
+++ symbol.c	12 Aug 2004 17:18:40 -0000
@@ -1560,7 +1562,7 @@ done:
    symbols are kept in a singly linked list so that we can commit or
    undo the changes at a later time.
 
-   A symtree may point to a symbol node outside of it's namespace.  In
+   A symtree may point to a symbol node outside of its namespace.  In
    this case, that symbol has been used as a host associated variable
    at some previous time.  */
 



More information about the Gcc-patches mailing list