Question & Answer
Question
How can you remove C comments from my code during preprocessing with XL Fortran ?
Cause
-------- start foo.h ---------
/* C comment */
! Fortran comment
-------- end foo.h ---------
--------- start test.F --------
#include <foo.h>
program line
write (*,*) "Hello from FORTRAN"
end
--------- end test.F --------
$ xlf90 test.F -I. -qsource
1 1 |/* C comment */
.a..............
a - "./foo.h", line 1.1: 1515-019 (S) Syntax is incorrect.
"test.F", 1515-002 (S) END card is missing. One is assumed.
** _main === End of Compilation 1 ===
** line === End of Compilation 2 ===
1501-511 Compilation failed for file test.F.
Answer
The -C! option in XL Fortran Enterprise Edition V11.1 and above removes C comments. It can be used as follows:
xlf90 test.F -I. -WF,-C!
For previous XL Fortran compiler versions, the configuration file located at /etc/xlf.cfg.<OS_level> will have to be modified to remove the '-C' option.
Was this topic helpful?
Document Information
More support for:
XL Fortran Advanced Edition for Linux
Software version:
11.1, 12.1
Document number:
366697
Modified date:
24 February 2022
UID
swg21328646