Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 334882 - C Preprocessing of String Literals Differs from gfortran
Summary: C Preprocessing of String Literals Differs from gfortran
Status: NEW
Alias: None
Product: PTP
Classification: Tools
Component: Photran.For Internal Use (show other bugs)
Version: 6.0   Edit
Hardware: All All
: P5 normal (vote)
Target Milestone: ---   Edit
Assignee: Photran Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-20 08:56 EST by Matthew Fotzler CLA
Modified: 2011-03-17 23:53 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Fotzler CLA 2011-01-20 08:56:34 EST
The following program:

#define GREAT(X) "X is the greatest!"

program test

	print *, GREAT(Photran)

end program

produces the following when preprocessed by Photran/GCC/NAG

program test

 print *, "X is the greatest!"

end program

but gfortran produces

program test

	print *, "Photran is the greatest!"

end program

Another strange thing is if I run `cpp`, the gnu c preprocessor, the output matches gfortran's, no matter which standard(c89, c99, c++98, etc.) I use with the -std option.  gcc and cpp both have the same version "i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5664)", so it's odd that gcc isn't using cpp.
Comment 1 Matthew Fotzler CLA 2011-01-20 09:59:32 EST
Seems to be an issue of traditional C vs. ANSI/ISO C.  With `gcc -E -Wtraditional`, there is the warning "pretest.c:1:18: warning: macro argument "X" would be stringified in traditional C"