Skip to content
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

BUG: fix ISO C compliance #431

Closed
wants to merge 1 commit into from
Closed

BUG: fix ISO C compliance #431

wants to merge 1 commit into from

Conversation

CismonX
Copy link
Contributor

@CismonX CismonX commented Jun 7, 2024

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.

In ISO C, at least one argument should be specified for
the "..." argument of a function-like macro.

Signed-off-by: Cheng Qiao <admin@cismon.net>
@pcmoore pcmoore added the bug label Jun 11, 2024
@coveralls
Copy link

Coverage Status

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

@pcmoore pcmoore added this to the v2.6.0 milestone Jun 11, 2024
Copy link
Member

@drakenclimber drakenclimber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Acked-by: Tom Hromatka <tom.hromatka@oracle.com>

@pcmoore
Copy link
Member

pcmoore commented Sep 5, 2024

Merged via 5eb0b07, thanks!

@pcmoore pcmoore closed this Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants