libseccomp icon indicating copy to clipboard operation
libseccomp copied to clipboard

BUG: fix ISO C compliance

Open CismonX opened this issue 1 year ago • 1 comments

When macro _SCMP_VA_NUM_ARGS is invoked with one argument, it expands to _SCMP_VA_NUM_ARGS_IMPL with only 3 arguments specified.

Compilers like gcc and clang support empty variadic macro argument as a language extension, however, in ISO C, at least one argument should be specified for the ... argument of a function-like macro (See ISO/IEC 9899:1999 6.10.3(4)).

This patch should make the code more standard-compliant, and silences certain compiler warnings (e.g. clang -Wgnu-zero-variadic-macro-arguments)

Note: there are other non-standard code (e.g. void pointer arithmetic), but not addressed in this patch. It's okay for projects to use language extensions, but less so in public headers.

CismonX avatar Jun 07 '24 11:06 CismonX

Coverage Status

coverage: 89.454%. remained the same when pulling 5b340a519b39bd2c1d1e89ca529b3a5f531f668d on CismonX:main into 9da5d174e3ef219baab020a79c789f2075ace45c on seccomp:main.

coveralls avatar Jun 11 '24 19:06 coveralls

Merged via 5eb0b07eb0a41a4d886fb921ee97a470a19dda3a, thanks!

pcmoore avatar Sep 05 '24 18:09 pcmoore