public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: g77 and cpp. Single quote in comment line.
@ 1998-09-19  6:06 Kate Hedstrom
  1998-09-19 17:40 ` David W. Banks
  0 siblings, 1 reply; 9+ messages in thread
From: Kate Hedstrom @ 1998-09-19  6:06 UTC (permalink / raw)
  To: burley, dbanks; +Cc: egcs

> >I've had a long term problem with code that uses cpp with g77 
> >and has single quotes in comment lines.
> 
> In the long run, it'd be great to offer a Fortran-specific preprocessor
> with g77.  There are apparently some Fortran preprocessors available
> on the 'net, but I haven't investigated these.

Meanwhile, "cpp -traditional" should do the job.  This is how cpp gets
called if you ask g77 to do it for you (g77 foo.F).

Kate

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: g77 and cpp. Single quote in comment line.
  1998-09-19  6:06 g77 and cpp. Single quote in comment line Kate Hedstrom
@ 1998-09-19 17:40 ` David W. Banks
  1998-09-19 18:47   ` Richard Henderson
  1998-09-21 10:17   ` Craig Burley
  0 siblings, 2 replies; 9+ messages in thread
From: David W. Banks @ 1998-09-19 17:40 UTC (permalink / raw)
  To: egcs, Kate Hedstrom

Kate Hedstrom wrote:
> 
> Meanwhile, "cpp -traditional" should do the job.  This is how cpp gets
> called if you ask g77 to do it for you (g77 foo.F).
> 

Maybe this could be mentioned in the man page for cpp? When cpp failed
that's where I went to look for a solution, Some mention of -traditional
being needed for .F files (or that g77 makes the call on it's own and that
there is no need for an explicit call) would have kept me from loading up 
your mail server with this RTFM type of question.

Thanks for all the help,
-Dave

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: g77 and cpp. Single quote in comment line.
  1998-09-19 17:40 ` David W. Banks
@ 1998-09-19 18:47   ` Richard Henderson
  1998-09-21 10:17   ` Craig Burley
  1 sibling, 0 replies; 9+ messages in thread
From: Richard Henderson @ 1998-09-19 18:47 UTC (permalink / raw)
  To: dbanks, egcs, Kate Hedstrom

On Sat, Sep 19, 1998 at 05:50:29PM +0000, David W. Banks wrote:
> Maybe this could be mentioned in the man page for cpp?

It _is_ mentioned in the info files for cpp.


r~

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: g77 and cpp. Single quote in comment line.
  1998-09-19 17:40 ` David W. Banks
  1998-09-19 18:47   ` Richard Henderson
@ 1998-09-21 10:17   ` Craig Burley
  1998-09-22  2:50     ` Dave Love
  1 sibling, 1 reply; 9+ messages in thread
From: Craig Burley @ 1998-09-21 10:17 UTC (permalink / raw)
  To: dbanks; +Cc: burley

[Sorry to have gotten to this so late.]

>Kate Hedstrom wrote:
>> 
>> Meanwhile, "cpp -traditional" should do the job.  This is how cpp gets
>> called if you ask g77 to do it for you (g77 foo.F).
>
>Maybe this could be mentioned in the man page for cpp? When cpp failed
>that's where I went to look for a solution, Some mention of -traditional
>being needed for .F files (or that g77 makes the call on it's own and that
>there is no need for an explicit call) would have kept me from loading up 
>your mail server with this RTFM type of question.

Could you do me a favor?  Using a simple example (like the one I think
you sent earlier), compile with the `-v' (`--verbose') option, such
that the symptom (unterminated-constant diagnostic generated by cpp)
is evident.

Send the output of all the above, plus the sample file (e.g. `cat' it
into the output or whatever), to egcs-bugs.

I'd like to see it myself, and others should see it.  What I'm
looking for right now is whether `-traditional' gets passed by the
g77/gcc driver to cpp when compiling Fortran.  It's *supposed* to.
And, maybe it is, but a subsequent option (or some such thing)
disables the behavior, or maybe the wrong version of cpp gets
invoked, or something.

(I assume you're aware that the docs already explain that files ending
in .F and .FPP automatically are preprocessed.  This mechanism *should*
include passing `-traditional' to cpp.)

        tq vm, (burley)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: g77 and cpp. Single quote in comment line.
  1998-09-21 10:17   ` Craig Burley
@ 1998-09-22  2:50     ` Dave Love
  0 siblings, 0 replies; 9+ messages in thread
From: Dave Love @ 1998-09-22  2:50 UTC (permalink / raw)
  To: egcs

>>>>> "Craig" == Craig Burley <burley@gnu.org> writes:

 Craig> What I'm looking for right now is whether `-traditional' gets
 Craig> passed by the g77/gcc driver to cpp when compiling Fortran.
 Craig> It's *supposed* to.

There's a testcase which would fail if it didn't, but it doesn't
(fail).

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: g77 and cpp. Single quote in comment line.
  1998-09-19  1:36 ` Craig Burley
@ 1998-09-19 12:03   ` Dave Love
  0 siblings, 0 replies; 9+ messages in thread
From: Dave Love @ 1998-09-19 12:03 UTC (permalink / raw)
  To: egcs

I doubt messing with cpp is likely to help compatibility; I don't know
any other systems which provide a `Fortran-aware' version of cpp, but
perhaps I'm out of touch.  FWIW, SGI do (or did) ship some vintage of
GNU cpp for use (at least) by f77 on .F files.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: g77 and cpp. Single quote in comment line.
  1998-09-17 11:14 David W. Banks
  1998-09-18  2:21 ` Dave Love
@ 1998-09-19  1:36 ` Craig Burley
  1998-09-19 12:03   ` Dave Love
  1 sibling, 1 reply; 9+ messages in thread
From: Craig Burley @ 1998-09-19  1:36 UTC (permalink / raw)
  To: dbanks; +Cc: burley

>I've had a long term problem with code that uses cpp with g77 
>and has single quotes in comment lines. What seems to be happenning
>is that when someone puts a contracted word in a comment line the 
>preprocessor chokes. Several external codes that I've long used
>on the HP, SGI, and Cray systems never had a problem with this but
>since I've been using Linux this comes up all the time for me.
>Is there something that can be done about it at the EGCS level?

The problem is generally that g77 offers only cpp-style preprocessing
at this time, which means that the preprocessing language is pretty
much C-like, rather than Fortran-like.

And, C-like preprocessing means that a comment line beginning with
the letter `C' in column one doesn't look like a comment line to
the preprocessor.  Since the preprocessor also has to know about
C-style character constants (which look somewhat like Fortran-style
character constants), it therefore complains about unterminated
apostrophes, as well as double quotes, `/*', and so on.

A stopgap fix might be to teach the gcc cpp preprocessor (cccp.c)
about Fortran comment styles and enable these styles via command-line
options which, in turn, g77 can automatically provide when it invokes
the preprocessor.

In the long run, it'd be great to offer a Fortran-specific preprocessor
with g77.  There are apparently some Fortran preprocessors available
on the 'net, but I haven't investigated these.

        tq vm, (burley)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: g77 and cpp. Single quote in comment line.
  1998-09-17 11:14 David W. Banks
@ 1998-09-18  2:21 ` Dave Love
  1998-09-19  1:36 ` Craig Burley
  1 sibling, 0 replies; 9+ messages in thread
From: Dave Love @ 1998-09-18  2:21 UTC (permalink / raw)
  To: egcs

Please look up `cpp' in the index of the g77 manual.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* g77 and cpp. Single quote in comment line.
@ 1998-09-17 11:14 David W. Banks
  1998-09-18  2:21 ` Dave Love
  1998-09-19  1:36 ` Craig Burley
  0 siblings, 2 replies; 9+ messages in thread
From: David W. Banks @ 1998-09-17 11:14 UTC (permalink / raw)
  To: egcs

Hello,

I've had a long term problem with code that uses cpp with g77 
and has single quotes in comment lines. What seems to be happenning
is that when someone puts a contracted word in a comment line the 
preprocessor chokes. Several external codes that I've long used
on the HP, SGI, and Cray systems never had a problem with this but
since I've been using Linux this comes up all the time for me.
Is there something that can be done about it at the EGCS level?

Thanks,
-Dave Banks


%> cpp -P -C george.F > george.f
cbcget.F:3: unterminated character constant
%> cat george.F
      Program George
C
C All it takes is a careless contraction in one's code.
C
      print*, "Hello world"
      stop
      end

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~1998-09-22  2:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-09-19  6:06 g77 and cpp. Single quote in comment line Kate Hedstrom
1998-09-19 17:40 ` David W. Banks
1998-09-19 18:47   ` Richard Henderson
1998-09-21 10:17   ` Craig Burley
1998-09-22  2:50     ` Dave Love
  -- strict thread matches above, loose matches on Subject: below --
1998-09-17 11:14 David W. Banks
1998-09-18  2:21 ` Dave Love
1998-09-19  1:36 ` Craig Burley
1998-09-19 12:03   ` Dave Love

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).