Closed
Description
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
}