Skip to content

flang-new requires -cpp flag for preprocessing, unlike other compilers #1155

Open
@gha3mi

Description

@gha3mi

Description

When using fpm with flang-new, the -cpp flag must be passed manually for preprocessing to work. This is not required with other compilers.

Test case:

program check
#if defined(TEST)
   print *, "This is a test"
#endif
end program

Running:

fpm test --compiler flang-new --flag "-DTEST"

results in:

./test/check.f90:2:12: error: excess characters after expression
  #if defined(TEST)
             ^^^^^^
<ERROR> Compilation failed for object " test_check.f90.o "
<ERROR> stopping due to failed compilation
STOP 1

However, this works as expected:

fpm test --compiler flang-new --flag "-cpp -DTEST"

Expected Behaviour

As suggested here by @perazz, including -cpp by default for flang-new should resolve this issue.

fpm test --compiler flang-new --flag "-DTEST"

Version of fpm

0.12.0, alpha

Platform and Architecture

Tested on Linux

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions