Skip to content

Add setting to suppress ASM related IntelliSense errors #7923

Description

@kmbgit

Bug type: Language Service

The system I'm working on runs on embedded MIPS processors with a kernel based on linux-4.5.3. One of our source files has a call to copy_from_user() which is defined in .../linux-4.5.3/arch/mips/include/asm/uaccess.h straight from the distribution, but VS Code erroneously warns "unknown register name '$4'" and similarly for $5 and $6.

I assume this is because the C/C++ extensions lacks a "linux-gcc-mips" IntelliSense mode that wold teach it about these registers, so it would be great if you could add one, helpful if you could let me know how to write one of my own, or at least useful if there was a way to turn off asm-snooping when the tool has no idea about the assembler in question.

  • OS and Version:
    Ubuntu 18.04 LTS with cross-compiler tools for MIPS.

  • VS Code Version:
    Version: 1.58.2
    Commit: c3f126316369cd610563c75b1b1725e0679adfb3
    Date: 2021-07-14T22:30:16.440Z
    Electron: 12.0.13
    Chrome: 89.0.4389.128
    Node.js: 14.16.0
    V8: 8.9.255.25-electron.0
    OS: Linux x64 4.15.0-122-generic

  • C/C++ Extension Version:
    1.5.1

Steps to reproduce

C code with a call to copy_from_user().

Expected behavior

The tool should not warn about calls to copy_from_user(), nor any other code that uses asm() to embed assembler in a language that the tool does not supports.

Code sample and logs

  • Code sample

  • Configurations in c_cpp_properties.json

c_cpp_properties.json snippet...

    {
        "name": "MIPS-Linux-Modules",
        "includePath": [
            "${workspaceFolder}/**",
            "${workspaceFolder}/../linux/kernel/linux-4.5.3/include",
            "${workspaceFolder}/../linux/kernel/linux-4.5.3/arch/mips/include",
            "${workspaceFolder}/../linux/kernel/linux-4.5.3/arch/mips/include/asm/mach-generic",
            "${workspaceFolder}/../linux/kernel/linux-4.5.3/arch/mips/include/generated",
            "${workspaceFolder}/../linux/kernel/linux-4.5.3/arch/mips/include/generated/uapi",
            "${workspaceFolder}/../linux/kernel/linux-4.5.3/arch/mips/include/uapi"
        ],
        "defines": [
            "ARCH=mips",
            "MIPS_LINUX",
            // stuff from .../DEV_ROOT/linux/kernel/linux-4.5.3/scripts/link-vmlinux.sh
            "CONFIG_MIPS=y",
            "CONFIG_RWSEM_GENERIC_SPINLOCK=y"
        ],
        "compilerPath": "/devtools/mips-mti-linux-gnu/bin/mips-mti-linux-gnu-gcc",
        "cStandard": "gnu11",
        "cppStandard": "gnu++14",
        "intelliSenseMode": "linux-gcc-arm64",
        "compilerArgs": [
            "-march=interaptiv"
        ],
        "browse": {
            "path": [
                "${workspaceFolder}/**"
            ],
            "limitSymbolsToIncludedHeaders": true
        }
    },

Screenshots

Additional context

Activity

  1. Colengms commented on Aug 5, 2021

    @Colengms
    Contributor

    Hi kmbgit . It looks like we currently have the following issue tracking support for MIPS: #5035

    How about we use this issue to track adding a setting to disable ASM related IntelliSense errors?

  2. changed the title [-]Unhelpful warnings about unknown registers when cross-compiling to MIPS[/-] [+]Add setting to suppress ASM related IntelliSense errors[/+] on Aug 5, 2021
  3. kmbgit commented on Aug 6, 2021

    @kmbgit
    Author

    Hi kmbgit . It looks like we currently have the following issue tracking support for MIPS: #5035

    How about we use this issue to track adding a setting to disable ASM related IntelliSense errors?

    Sounds sensible - my gripe is more about the tool using inappropriate rules to check an unknown assembly language rather than specifically that it doesn't support MIPS.

  4. added this to the Triage milestone on Aug 10, 2021
  5. github-actions commented on Oct 10, 2021

    @github-actions

    This feature request is being closed due to insufficient upvotes. When enough upvotes are received, this issue will be eligible for our backlog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions