seccomp / libseccomp

The main libseccomp repository
GNU Lesser General Public License v2.1
791 stars 170 forks source link

BUG: fix ISO C compliance #431

Closed CismonX closed 22 hours ago

CismonX commented 3 months ago

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.

coveralls commented 2 months ago

Coverage Status

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

pcmoore commented 22 hours ago

Merged via 5eb0b07eb0a41a4d886fb921ee97a470a19dda3a, thanks!