Skip to content

cannot suppress modernize-avoid-c-arrays in macros #46511

Closed
@firewave

Description

@firewave
Bugzilla Link 47167
Version unspecified
OS Windows NT

Extended Description

It seems it is not possible to suppress modernize-avoid-c-arrays in a macro.

I am not sure if this is a problem in general or just related to this check. I tried a few other checks and it seems they will not be report anything when the problem occurs in a macro.

Example:

#define MAKE_ARGV( argv, ...) \
    /* NOLINTNEXTLINE(modernize-avoid-c-arrays) */ \
	const char* argv[] = {__VA_ARGS__, nullptr};

static void f(int argc, const char * const argv[]) {
}

static void func()
{
	MAKE_ARGV(argv, "option") // warning is shown
}

static void func2()
{
	/* NOLINTNEXTLINE(modernize-avoid-c-arrays) */
	const char* argv[] = {"option", nullptr}; // no warning
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions