Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
firewave opened this issue Aug 14, 2020 · 1 comment
Closed

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

firewave opened this issue Aug 14, 2020 · 1 comment
Labels
bugzilla Issues migrated from bugzilla clang-tidy worksforme Resolved as "works for me"

Comments

@firewave
Copy link

firewave commented Aug 14, 2020

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
}
@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
@PiotrZSL PiotrZSL added the worksforme Resolved as "works for me" label Apr 4, 2023
@PiotrZSL
Copy link
Member

PiotrZSL commented Apr 4, 2023

Looks to be fixed, issue no longer reproduces, NOLINTNEXTLINE inside macro works for this example.

@PiotrZSL PiotrZSL closed this as completed Apr 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang-tidy worksforme Resolved as "works for me"
Projects
None yet
Development

No branches or pull requests

2 participants