microsoft / vscode-makefile-tools

MAKE integration in Visual Studio Code
Other
194 stars 58 forks source link

The "#define" information in the Makefile will be recognized as unrecognized token #526

Open Ivanbeethoven opened 10 months ago

Ivanbeethoven commented 10 months ago

This example comes from AFL: https://github.com/google/AFL

This "#define" does not exist in the C code, but is passed in through the compiler command in the Makefile file. An error is still reported after being recognized by the makefile. It seems that define was indeed recognized and expanded, but an error occurred

image

Here is my .vscode/c_cpp_properties.json:

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [],
            "compilerPath": "/usr/bin/gcc",
            "cStandard": "c11",
            "intelliSenseMode": "linux-gcc-x64",
            "configurationProvider": "ms-vscode.makefile-tools"
        }
    ],
    "version": 4
}

I have temporarily made the following modifications to alleviate this error:

{
      "configurations": [
        {
          "name": "Linux",
          "includePath": [
            "${workspaceFolder}/**"
          ],
          "defines": [],
          "compilerPath": "/usr/bin/gcc",
          "cStandard": "c99",
          "intelliSenseMode": "linux-gcc-x64",
          "compilerArgs": [
              "-O3",
              "-funroll-loops",
              "-Wall",
              "-D_FORTIFY_SOURCE=2",
              "-g",
              "-Wno-pointer-sign",
              "-DAFL_PATH=\"$(HELPER_PATH)\"",
              "-DDOC_PATH=\"$(DOC_PATH)\"",
              "-DBIN_PATH=\"$(BIN_PATH)\""
            ]
          }
      ],
      "version": 4
}
gcampbell-msft commented 10 months ago

@Ivanbeethoven Thank you for bringing this to our attention and pointing us to the project that it's happening in!

Since there is a reasonable workaround, this might not get fixed immediately (in the next release), but we will definitely put it on the backlog to investigate a fix for an upcoming release. Thanks!