Skip to content

Preprocessor warnings with Clang #560

@viferga

Description

@viferga

🐛 Bug Report

One way of solving 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__)

Error:

/Users/runner/work/core/core/source/cli/plugins/cli_core_plugin/source/cli_core_plugin.cpp:220:40: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
        EXTENSION_FUNCTION_CHECK(INSPECT_ERROR);
[ 91%] Built target ts_loader
                                              ^
/Users/runner/work/core/core/source/plugin/include/plugin/plugin_interface.hpp:81:9: note: macro 'EXTENSION_FUNCTION_CHECK' defined here
#define EXTENSION_FUNCTION_CHECK(error, ...) \
[ 91%] Building C object source/reflect/CMakeFiles/reflect.dir/source/reflect_future.c.o
        ^
[ 91%] Building C object source/detour/CMakeFiles/detour.dir/source/detour.c.o
/Users/runner/work/core/core/source/cli/plugins/cli_core_plugin/source/cli_core_plugin.cpp:220:2: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
        EXTENSION_FUNCTION_CHECK(INSPECT_ERROR);
        ^
/Users/runner/work/core/core/source/plugin/include/plugin/plugin_interface.hpp:97:3: note: expanded from macro 'EXTENSION_FUNCTION_CHECK'
[ 91%] Building C object source/reflect/CMakeFiles/reflect.dir/source/reflect_exception.c.o
                PREPROCESSOR_FOR(EXTENSION_FUNCTION_CHECK_ITERATOR, error, __VA_ARGS__) \
                ^
[ 91%] Linking CXX shared library ../../libdetour.dylib
/Users/runner/work/core/core/source/preprocessor/include/preprocessor/preprocessor_for.h:237:58: note: expanded from macro 'PREPROCESSOR_FOR'
                        PREPROCESSOR_FOR_IMPL_0)(expr, context, 0, __VA_ARGS__))
                                                                              ^
/Users/runner/work/core/core/source/preprocessor/include/preprocessor/preprocessor_for.h:153:9: note: macro 'PREPROCESSOR_FOR_IMPL_1' defined here
#define PREPROCESSOR_FOR_IMPL_1(expr, context, iterator, element, ...) expr(context, iterator, element)
        ^
/Users/runner/work/core/core/source/cli/plugins/cli_core_plugin/source/cli_core_plugin.cpp:330:2: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
        EXTENSION_FUNCTION_CHECK(CALL_ERROR, METACALL_STRING);
        ^
/Users/runner/work/core/core/source/plugin/include/plugin/plugin_interface.hpp:97:3: note: expanded from macro 'EXTENSION_FUNCTION_CHECK'
                PREPROCESSOR_FOR(EXTENSION_FUNCTION_CHECK_ITERATOR, error, __VA_ARGS__) \
[ 91%] Built target detour
                ^
[ 91%] Building C object source/reflect/CMakeFiles/reflect.dir/source/reflect_throwable.c.o
/Users/runner/work/core/core/source/preprocessor/include/preprocessor/preprocessor_for.h:237:58: note: expanded from macro 'PREPROCESSOR_FOR'
                        PREPROCESSOR_FOR_IMPL_0)(expr, context, 0, __VA_ARGS__))
                                                                              ^
/Users/runner/work/core/core/source/preprocessor/include/preprocessor/preprocessor_for.h:153:9: note: macro 'PREPROCESSOR_FOR_IMPL_1' defined here
#define PREPROCESSOR_FOR_IMPL_1(expr, context, iterator, element, ...) expr(context, iterator, element)
Installing node_port
        ^
/Users/runner/work/core/core/source/cli/plugins/cli_core_plugin/source/cli_core_plugin.cpp:355:2: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
        EXTENSION_FUNCTION_CHECK(CALL_ERROR, METACALL_STRING);
[ 91%] Building C object source/reflect/CMakeFiles/reflect.dir/source/reflect_scope.c.o
        ^
/Users/runner/work/core/core/source/plugin/include/plugin/plugin_interface.hpp:97:3: note: expanded from macro 'EXTENSION_FUNCTION_CHECK'
                PREPROCESSOR_FOR(EXTENSION_FUNCTION_CHECK_ITERATOR, error, __VA_ARGS__) \
                ^
/Users/runner/work/core/core/source/preprocessor/include/preprocessor/preprocessor_for.h:237:58: note: expanded from macro 'PREPROCESSOR_FOR'
                        PREPROCESSOR_FOR_IMPL_0)(expr, context, 0, __VA_ARGS__))
                                                                              ^
/Users/runner/work/core/core/source/preprocessor/include/preprocessor/preprocessor_for.h:153:9: note: macro 'PREPROCESSOR_FOR_IMPL_1' defined here
#define PREPROCESSOR_FOR_IMPL_1(expr, context, iterator, element, ...) expr(context, iterator, element)
        ^
/Users/runner/work/core/core/source/cli/plugins/cli_core_plugin/source/cli_core_plugin.cpp:444:42: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
        EXTENSION_FUNCTION_CHECK(COPYRIGHT_ERROR);
                                                ^
/Users/runner/work/core/core/source/plugin/include/plugin/plugin_interface.hpp:81:9: note: macro 'EXTENSION_FUNCTION_CHECK' defined here
#define EXTENSION_FUNCTION_CHECK(error, ...) \
        ^
/Users/runner/work/core/core/source/cli/plugins/cli_core_plugin/source/cli_core_plugin.cpp:444:2: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
        EXTENSION_FUNCTION_CHECK(COPYRIGHT_ERROR);
        ^
/Users/runner/work/core/core/source/plugin/include/plugin/plugin_interface.hpp:97:3: note: expanded from macro 'EXTENSION_FUNCTION_CHECK'
                PREPROCESSOR_FOR(EXTENSION_FUNCTION_CHECK_ITERATOR, error, __VA_ARGS__) \
                ^
/Users/runner/work/core/core/source/preprocessor/include/preprocessor/preprocessor_for.h:237:58: note: expanded from macro 'PREPROCESSOR_FOR'
                        PREPROCESSOR_FOR_IMPL_0)(expr, context, 0, __VA_ARGS__))
                                                                              ^
/Users/runner/work/core/core/source/preprocessor/include/preprocessor/preprocessor_for.h:153:9: note: macro 'PREPROCESSOR_FOR_IMPL_1' defined here
#define PREPROCESSOR_FOR_IMPL_1(expr, context, iterator, element, ...) expr(context, iterator, element)
        ^
/Users/runner/work/core/core/source/cli/plugins/cli_core_plugin/source/cli_core_plugin.cpp:454:37: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
[ 91%] Building C object source/reflect/CMakeFiles/reflect.dir/source/reflect_context.c.o
        EXTENSION_FUNCTION_CHECK(HELP_ERROR);
                                           ^
/Users/runner/work/core/core/source/plugin/include/plugin/plugin_interface.hpp:81:9: note: macro 'EXTENSION_FUNCTION_CHECK' defined here
#define EXTENSION_FUNCTION_CHECK(error, ...) \
        ^
/Users/runner/work/core/core/source/cli/plugins/cli_core_plugin/source/cli_core_plugin.cpp:454:2: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
[ 92%] Building C object source/reflect/CMakeFiles/reflect.dir/source/reflect_value.c.o
        EXTENSION_FUNCTION_CHECK(HELP_ERROR);
        ^
/Users/runner/work/core/core/source/plugin/include/plugin/plugin_interface.hpp:97:3: note: expanded from macro 'EXTENSION_FUNCTION_CHECK'
                PREPROCESSOR_FOR(EXTENSION_FUNCTION_CHECK_ITERATOR, error, __VA_ARGS__) \
                ^
/Users/runner/work/core/core/source/preprocessor/include/preprocessor/preprocessor_for.h:237:58: note: expanded from macro 'PREPROCESSOR_FOR'
                        PREPROCESSOR_FOR_IMPL_0)(expr, context, 0, __VA_ARGS__))
                                                                              ^
/Users/runner/work/core/core/source/preprocessor/include/preprocessor/preprocessor_for.h:153:9: note: macro 'PREPROCESSOR_FOR_IMPL_1' defined here
#define PREPROCESSOR_FOR_IMPL_1(expr, context, iterator, element, ...) expr(context, iterator, element)
        ^
/Users/runner/work/core/core/source/cli/plugins/cli_core_plugin/source/cli_core_plugin.cpp:645:2: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
[ 92%] Building C object source/reflect/CMakeFiles/reflect.dir/source/reflect_value_type.c.o
        EXTENSION_FUNCTION_CHECK(DEBUG_ERROR, METACALL_ARRAY);
        ^
/Users/runner/work/core/core/source/plugin/include/plugin/plugin_interface.hpp:97:3: note: expanded from macro 'EXTENSION_FUNCTION_CHECK'
                PREPROCESSOR_FOR(EXTENSION_FUNCTION_CHECK_ITERATOR, error, __VA_ARGS__) \
                ^
/Users/runner/work/core/core/source/preprocessor/include/preprocessor/preprocessor_for.h:237:58: note: expanded from macro 'PREPROCESSOR_FOR'
                        PREPROCESSOR_FOR_IMPL_0)(expr, context, 0, __VA_ARGS__))
                                                                              ^
/Users/runner/work/core/core/source/preprocessor/include/preprocessor/preprocessor_for.h:153:9: note: macro 'PREPROCESSOR_FOR_IMPL_1' defined here
#define PREPROCESSOR_FOR_IMPL_1(expr, context, iterator, element, ...) expr(context, iterator, element)
        ^
/Users/runner/work/core/core/source/cli/plugins/cli_core_plugin/source/cli_core_plugin.cpp:676:42: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
        EXTENSION_FUNCTION(METACALL_INT, inspect);
                                                ^
/Users/runner/work/core/core/source/plugin/include/plugin/plugin_interface.hpp:59:9: note: macro 'EXTENSION_FUNCTION' defined here
#define EXTENSION_FUNCTION(ret, name, ...) \
        ^
/Users/runner/work/core/core/source/cli/plugins/cli_core_plugin/source/cli_core_plugin.cpp:681:44: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
        EXTENSION_FUNCTION(METACALL_INT, copyright);
                                                  ^
/Users/runner/work/core/core/source/plugin/include/plugin/plugin_interface.hpp:59:9: note: macro 'EXTENSION_FUNCTION' defined here
#define EXTENSION_FUNCTION(ret, name, ...) \
        ^
/Users/runner/work/core/core/source/cli/plugins/cli_core_plugin/source/cli_core_plugin.cpp:682:39: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
        EXTENSION_FUNCTION(METACALL_INT, help);
                                             ^
/Users/runner/work/core/core/source/plugin/include/plugin/plugin_interface.hpp:59:9: note: macro 'EXTENSION_FUNCTION' defined here
#define EXTENSION_FUNCTION(ret, name, ...) \

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions