# preprocess g95 #pragma GCC set_debug_pwd



## spb (Jul 6, 2005)

When trying to compile code written in FORTRAN95 with g95 I encounter the error shown below.  

It is apparent that make is preprocessing the file structures.F with cpp, but cpp then writes a line that starts with "#pragma GCC set_debug_pwd" at the top of the structure.tmp.f file which causes g95 to choke.  

Some of the discussions I've read on via google suggest that this is a bug in Panther.  I really don't know what it is, but I have no idea how to work around it.  

Any suggestions?  
Thanks,
SB

===================================
everything is working fine up to here...

/usr/bin/cpp -P -traditional  structures.F > structures.tmp.f
/usr/bin/g95 -c -O3 structures.tmp.f
In file structures.tmp.f:1

#pragma GCC set_debug_pwd "/Users/scott/Software/parsec/src"
1
Error: Non-numeric character in statement label at (1)
In file structures.tmp.f:1

#pragma GCC set_debug_pwd "/Users/scott/Software/parsec/src"
1
Error: Unclassifiable statement at (1)
make[1]: *** [structures.o] Error 1
make: *** [module] Error 2
==========================


----------



## Viro (Jul 7, 2005)

G95 doesn't come with OS X. Where did you get your copy of G95 from?


----------



## spb (Jul 7, 2005)

From http://g95.sourceforge.net/

The problem isn't g95, but cpp.  

When I run cpp in GNU/Linux I don't get the "#pragma GCC set_debug_pwd" line.

Before last night I've never even seen the word pragma.


----------



## spb (Aug 28, 2005)

I still haven't found a real solution.  My work around is to edit the Makefile such that:

.F.o:
        $(CPP) $(CPPOPT) $< | sed '/^#pragma/d' > $*.tmp.f
        $(FC) -c $(FOPTS) $*.tmp.f
        mv $*.tmp.o $*.o

Is there a real solution to this problem or does everyone use this hack?

Does anyone know what this pragma line is supposed to do?  

--
sb


----------



## lurk (Aug 29, 2005)

I  think this is the bit o' magic that you need

CPP='/usr/bin/cpp -traditional -P -xassembler-with-cpp'

mix into your make files to taste.


----------



## spb (Aug 30, 2005)

That is it exactly!

I can see from the man page how we know to use -P

"       -P  Inhibit generation of linemarkers in the output from the preproces-
           sor.  This might be useful when running the preprocessor on some-
           thing that is not C code, and will be sent to a program which might
           be confused by the linemarkers."

I don't see how you knew to use -xassembler-with-cpp

"       -x c
       -x c++
       -x objective-c
       -x objective-c++
        -x assembler-with-cpp
           Specify the source language: C, C++, Objective-C, Objective-C++, or
           assembly.  This has nothing to do with standards conformance or
           extensions; it merely selects which base syntax to expect.  If you
           give none of these options, cpp will deduce the language from the
           extension of the source file: .c, .cc, .m, .mm, or .S.  Some other
           common extensions for C++ and assembly are also recognized.  If cpp
           does not recognize the extension, it will treat the file as C; this
           is the most generic mode."


----------



## lurk (Aug 30, 2005)

I used google, it lets you fake intelligence about almost any topic.

To be fair I had a good idea of what I was looking for and where to find it ;-)


----------



## spb (Sep 1, 2005)

I googled back in July when I made this post, but I could find nothing helpful.  Really, I did.  :7) 

Even now when I google I find no reference to the -P -xassembler-with-cpp flags.

I hope that this thread get's picked up by the search engines...

flag to disable #pragma GCC set_debug_pwd in  macintosh cpp pre-process header confuses compiler 

...just for good measure :7)

Thanks again,
sb


----------

