Skip to content

[clang-tidy] Variable is non-const and globally accessible, consider making it const Β #73433

@MaJerle

Description

@MaJerle

I have a module based static variable, that clang reports as globally accessible

//...
static osMutexId_t app_sys_mutex;
//
[{
	"message": "variable 'app_sys_mutex' is non-const and globally accessible, consider making it const",
	"source": "C/C++",
}]

https://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines/avoid-non-const-global-variables.html
In the link above, there is no example if static keyword.

It is a module specific variable, that must be module global.
Why does it report it as globally accessible, if it is static?

Version: 17.0.5

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions