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]

Re: g77 and cpp. Single quote in comment line.


Perhaps the g77 manual should be explicit about this gotcha?  The
additional index entries might help people like me who didn't know
about this /* as Fortran comments lark (even if they ought to have
read it at some stage, obviousy).

1998-09-23  Dave Love  <d.love@dl.ac.uk>

	* g77.texi: Additions about `/*', trailing comments and cpp.

Index: g77.texi
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/f/g77.texi,v
retrieving revision 1.19
diff -u -p -c -r1.19 g77.texi
diff: conflicting specifications of output style
*** g77.texi	1998/09/18 15:44:51	1.19
--- g77.texi	1998/09/23 19:01:57
*************** line being effectively commented out---u
*** 1539,1545 ****
  line is a non-comment line of important code!
  
  @emph{Note:} The @samp{-traditional} and @samp{-undef} flags are supplied
! to @code{cpp} by default, to avoid unpleasant surprises.
  @xref{Preprocessor Options,,Options Controlling the Preprocessor,
  gcc,Using and Porting GNU CC}.
  This means that ANSI C preprocessor features (such as the @samp{#}
--- 1539,1545 ----
  line is a non-comment line of important code!
  
  @emph{Note:} The @samp{-traditional} and @samp{-undef} flags are supplied
! to @code{cpp} by default, to help avoid unpleasant surprises.
  @xref{Preprocessor Options,,Options Controlling the Preprocessor,
  gcc,Using and Porting GNU CC}.
  This means that ANSI C preprocessor features (such as the @samp{#}
*************** Thus, if you want to do system-specific
*** 1550,1555 ****
--- 1550,1564 ----
  tests, use, for example, @samp{#ifdef __linux__} rather than @samp{#ifdef linux}.
  Use the @samp{-v} option to see exactly how the preprocessor is invoked.
  
+ @cindex /*
+ Unfortunately, the @samp{-traditional} flag will not avoid an error from
+ anything that @code{cpp} sees as an unterminated C comment, such as:
+ @smallexample
+ C Some Fortran compilers accept /* as starting
+ C an inline comment.
+ @end smallexample
+ @xref{Trailing Comment}.
+ 
  The following options that affect overall processing are recognized
  by the @code{g77} and @code{gcc} commands in a GNU Fortran installation:
  
*************** continuation line, imitating the behavio
*** 6868,6873 ****
--- 6877,6885 ----
  @node Trailing Comment
  @section Trailing Comment
  
+ @cindex trailing comment
+ @cindex comment, trailing
+ @cindex /*
  @code{g77} supports use of @samp{/*} to start a trailing
  comment.
  In the GNU Fortran language, @samp{!} is used for this purpose.
*************** error (though it would likely behave inc
*** 6887,6892 ****
--- 6899,6905 ----
  @node Debug Line
  @section Debug Line
  @cindex debug line
+ @cindex comment line, debug
  
  Use of @samp{D} or @samp{d} as the first character (column 1) of
  a source line denotes a debug line.


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