Fix -Wgnu-zero-variadic-macro-arguments Clang warning in plugin_interface.hpp (#560)#635
Closed
ROKUMATE wants to merge 2 commits intometacall:developfrom
Closed
Fix -Wgnu-zero-variadic-macro-arguments Clang warning in plugin_interface.hpp (#560)#635ROKUMATE wants to merge 2 commits intometacall:developfrom
-Wgnu-zero-variadic-macro-arguments Clang warning in plugin_interface.hpp (#560)#635ROKUMATE wants to merge 2 commits intometacall:developfrom
Conversation
Member
|
This is not the correct way of solving it. I have mentioned a way of doing it in the issue: #include <stdio.h>
// Internal helper macros
#define _LOG_GET_MACRO(_1,_2,NAME,...) NAME
#define LOG1(fmt) printf(fmt)
#define LOG2(fmt, ...) printf(fmt, __VA_ARGS__)
// Public macro
#define LOG(...) _LOG_GET_MACRO(__VA_ARGS__, LOG2, LOG1)(__VA_ARGS__) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #560 — Clang emits
-Wgnu-zero-variadic-macro-argumentswarnings whenEXTENSION_FUNCTIONandEXTENSION_FUNCTION_CHECKare called with zero extraarguments (e.g.
EXTENSION_FUNCTION_CHECK(INSPECT_ERROR)).Root Cause
Both macros use
PREPROCESSOR_ARGS_EMPTY(__VA_ARGS__)to branch between a voidand a parameterised path. This is intentional and correct, but Clang flags the
zero-argument
__VA_ARGS__expansion as a GNU extension.Fix
Added a
#pragma clang diagnostic ignoredguard at the top ofplugin_interface.hpp, scoped to#if defined(__clang__), suppressing thediagnostic only for this file where the pattern is intentional.
No logic changes — purely a diagnostic suppression with an explanatory comment.
Files Changed
source/plugin/include/plugin/plugin_interface.hpp— added pragma guard