openpgm
openpgm copied to clipboard
Mark pgm_family_string as 'inline'
Functions defined in headers need to be 'static inline', otherwise the compiler will generate an unused-function warning for every program that includes the header but doesn't use the function.
In file included from /usr/include/pgm-5.3/pgm/skbuff.h:39, from /usr/include/pgm-5.3/pgm/msgv.h:33, from /usr/include/pgm-5.3/pgm/pgm.h:44, from src/ip.cpp:53: /usr/include/pgm-5.3/pgm/socket.h:207:1: error: 'const char* pgm_family_string(int)' defined but not used [-Werror=unused-function] 207 | pgm_family_string ( | ^~~~~~~~~~~~~~~~~
I think some compilers are overly bad and you end up with linker errors after this, there were problems with both options. Only solution I think is to move the definition out of the header and let the compiler automatically optimize with LTO.
Wouldn't that be an ABI break?