> From: Stephen Hemminger [mailto:step...@networkplumber.org] > Sent: Saturday, 20 April 2024 02.08 > > The macro RTE_LOG_REGISTER_DEFAULT emits code for an initialization > function. If a driver (and most do) adds a semicolon after the macro. > > RTE_LOG_REGISTER_DEFAULT(logtype_foo, INFO); > > Is equivalent to: > > int logtype_foo; > static void __logtype_foo(void) { > logtype_foo = rte_log_register_type_and_pick_level(name, > RTE_LOG_INFO); > if (type < 0) > logtype_foo = RTE_LOGTYPE_EAL; > }; > The problem is that extra semi-colon after the function. > > If code is built with highest level of warnings (pedantic), > then it will generate a warning. > warning: ISO C does not allow extra ‘;’ outside of a function > > This is a treewide fix for this.
It seems weird omitting the semicolon when using this macro. How about using the same trick as RTE_INIT_PRIO(): #define RTE_INIT_PRIO(name, priority) \ static void name(void); \ static int __cdecl name ## _thunk(void) { name(); return 0; } \ __pragma(const_seg(CTOR_PRIORITY_TO_SECTION(priority))) \ __declspec(allocate(CTOR_PRIORITY_TO_SECTION(priority))) \ _PIFV name ## _pointer = &name ## _thunk; \ __pragma(const_seg()) \ static void name(void)