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: patch for fortran-experiments branch


i think i've fixed all of the coding style issues you pointed out.  here 
are the updated diffs, with an entry in ChangeLog.isocbinding:

Index: gcc/fortran/symbol.c
===================================================================
--- gcc/fortran/symbol.c        (revision 120681)
+++ gcc/fortran/symbol.c        (working copy)
@@ -4140,6 +4140,22 @@ generate_isocbinding_symbol (const char 
 
         /* make it use associated (iso_c_binding module) */
         tmp_sym->attr.use_assoc = 1;
+
+       /* Need to decide whether to generate the symbols for c_null_ptr
+        * or c_null_funptr (i.e., whether c_ptr and c_funptr are 
defined).
+        */
+       if (s == ISOCBINDING_PTR)
+         {
+           /* c_ptr was created so create c_null_ptr */
+           const char *ptr_kinds[2] = {"c_ptr", NULL};
+           gen_special_c_interop_ptrs (ptr_kinds, mod_name);
+         }
+       else
+         {
+           /* c_funptr was created so create c_null_funptr */
+           const char *ptr_kinds[2] = {"c_funptr", NULL};
+           gen_special_c_interop_ptrs (ptr_kinds, mod_name);
+         }/* end if(c_funptr created) */
        break;
 
       case ISOCBINDING_F_POINTER:
Index: gcc/fortran/lang-specs.h
===================================================================
--- gcc/fortran/lang-specs.h    (revision 120681)
+++ gcc/fortran/lang-specs.h    (working copy)
@@ -18,6 +18,7 @@ This file is licensed under the GPL.  */
       -fpreprocessed %{!nostdinc:-fintrinsic-modules-path finclude%s} 
%{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
 {".F90", "@f95-cpp-input", 0, 0, 0},
 {".F95", "@f95-cpp-input", 0, 0, 0},
+{".F03", "@f95-cpp-input", 0, 0, 0},
 {"@f95-cpp-input",
   "cc1 -E -lang-fortran -traditional-cpp -D_LANGUAGE_FORTRAN 
%(cpp_options) \
       %{E|M|MM:%(cpp_debug_options)}\
@@ -26,6 +27,7 @@ This file is licensed under the GPL.  */
       -fpreprocessed %{!nostdinc:-fintrinsic-modules-path finclude%s} 
%{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
 {".f90", "@f95", 0, 0, 0},
 {".f95", "@f95", 0, 0, 0},
+{".f03", "@f95", 0, 0, 0},  
 {"@f95", "%{!E:f951 %i %(cc1_options) %{J*} %{I*}\
          %{!nostdinc:-fintrinsic-modules-path finclude%s} 
%{!fsyntax-only:%(invoke_as)}}", 0, 0, 0},
 {".f",   "@f77", 0, 0, 0},
Index: gcc/fortran/options.c
===================================================================
--- gcc/fortran/options.c       (revision 120681)
+++ gcc/fortran/options.c       (working copy)
@@ -137,6 +137,9 @@ form_from_filename (const char *filename
     ".f95", FORM_FREE}
     ,
     {
+    ".f03", FORM_FREE}
+    ,
+    {
     ".f", FORM_FIXED}
     ,
     {
Index: gcc/fortran/ChangeLog.isocbinding
===================================================================
--- gcc/fortran/ChangeLog.isocbinding   (revision 120681)
+++ gcc/fortran/ChangeLog.isocbinding   (working copy)
@@ -3,6 +3,15 @@ Welcome to the ISO_C_BINDING sandbox!
 Please comment here the changes you make to the code, dated with every
 commit to the branch, so that we don't get lost.
 
+2007-01-11  Christopher D. Rickett
+
+       * gcc/fortran/symbol.c: (generate_isocbinding_symbol): Added
+         function calls for generating c_null_ptr and c_null_funptr.
+       * gcc/fortran/lang-specs.h: Added options for .f03/.F03 file
+         extensions. 
+       * gcc/fortran/options.c: (form_from_filename): Added entry for
+         .f03/.F03 file extensions.
+
 2006-12-27  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        * Revert revision 120187, 120190, and 120209.


i'll try and submit some more tests too, since i realized there are no 
tests in the testsuite for c_null_ptr/c_null_funptr.  thanks for the quick 
feedback.  let me know if there are any more problems.

Thanks.
Chris

On Wed, 10 Jan 2007, Brooks Moses wrote:

> Also, a few style comments/nitpicks on the patch:
> 
> Christopher D. Rickett wrote:
> > Index: gcc/fortran/symbol.c
> > ===================================================================
> > --- gcc/fortran/symbol.c        (revision 120661)
> > +++ gcc/fortran/symbol.c        (working copy)
> > @@ -4140,6 +4140,22 @@ generate_isocbinding_symbol (const char           /*
> > make it use associated (iso_c_binding module) */
> >          tmp_sym->attr.use_assoc = 1;
> > +
> > +        /* need to decide whether to generate the symbols for c_null_ptr
> > +         * or c_null_funptr (i.e., whether c_ptr and c_funptr are defined).
> > +         */
> 
> This should be:
> 
>        /* Need to decide whether to generate the symbols for c_null_ptr
>           or c_null_funptr (i.e., whether c_ptr and c_funprt are
>           defined).  */
> 
> (That is, start the sentence with a capital letter, and don't put the closing
> */ on a line by itself.)
> 
> > +        if (s == ISOCBINDING_PTR)
> > +        {
> 
> The { should be indented two characters from the if, and then the enclosed
> text is indented an additional two characters.  (Also, note that indentations
> of eight characters should be a tab rather than eight spaces, and ten is a tab
> and two spaces, and so on.)
> 
> > +          const char *ptr_kinds[2] = {"c_ptr", NULL};
> > +          /* c_ptr was created so create c_null_ptr */
> > +          gen_special_c_interop_ptrs(ptr_kinds, mod_name);
> 
> Here, I think there should be a blank line between the comment and the
> previous line of code.  Alternately, since it looks like the comment is really
> explaining both lines, it should be before both of them.
> 
> > +        }/* end if(c_ptr created) */
> 
> I think that end if comments like this are not the usual for GCC code. Also, I
> find these more confusing than helpful, since they don't match the opening
> "if" clause, and this one isn't the end of the if statement because there's a
> following "else" clause.
> 
> > +        else
> > +        {
> > +          const char *ptr_kinds[2] = {"c_funptr", NULL};
> > +          /* c_funptr was created so create c_null_funptr */
> > +          gen_special_c_interop_ptrs(ptr_kinds, mod_name);
> 
> Again, blank line before the comment, or put the comment before both lines of
> code.
> 
> > +        }/* end if(c_funptr created) */
> >         break;
> >         case ISOCBINDING_F_POINTER:
> > @@ -4222,6 +4238,7 @@ generate_isocbinding_symbol (const char
> > default:
> >         gcc_unreachable ();
> >      }
> > +     }
> 
> I don't think this added blank line is GCC style.
> 
> Meanwhile, though, thanks muchly for working on this!  I hope my nitpicks
> don't come across as taking away from that.
> 
> - Brooks
> 
> 


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