steve-o / openpgm

Automatically exported from code.google.com/p/openpgm
57 stars 44 forks source link

Mark pgm_family_string as 'inline' #74

Open bluca opened 1 year ago

bluca commented 1 year ago

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 ( | ^~~~~

steve-o commented 1 year ago

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.

bluca commented 1 year ago

Wouldn't that be an ABI break?