Skip to content

bug: Preprocessor definitions #713

@jphaupt

Description

@jphaupt

Is there an existing issue for this?

  • I have searched the existing issues

Description

Sorry if I missed this somewhere. For your convenience, I made a little repo for this issue (+ another issue): https://github.com/jphaupt/min_cmake_preproc/

Let's say I have a preprocessor definition NUMBER_PREPROCESSED=real. I then want to use in my code NUMBER_PREPROCESSED(dp). It looks like this is actually picked up correctly, as when you hover over the line it shows you #define NUMBER_PREPROCESSED real, but it still shows an error, and more importantly it deletes the .mod file (if there was one and if this is a module), which ruins indexing if the module is embedded in a bigger project. This is however valid code, as you can do target_compile_definitions(<target> PUBLIC NUMBER_PREPROCESSED=real) in cmake.

Screenshots

No response

Expected Behaviour

I expect it to notice the definition, as it does correctly, but to not show an error and not to delete the .mod file.

Version of Modern Fortran

v3.2.0

Version of Visual Studio Code

1.72.2

Platform and Architecture

Linux

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions