DALnet / bahamut

The Bahamut IRC Daemon
http://www.dal.net/?page=Bahamut
Other
59 stars 42 forks source link

Fix sys_errlist configure check in newer compilers #220

Closed ryandesign closed 1 year ago

ryandesign commented 1 year ago

Using exit requires #include <stdlib.h> first which this configure check doesn't do. Consequently, newer compilers that default to -Werror=implicit-function-declaration encounter an error like error: call to undeclared library function 'exit' with type 'void (int) __attribute__((noreturn))'; ISO C99 and later do not support implicit function declarations (llvm.org clang 16 and later) or error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' (Apple clang 12 and later) when running this configure check and thus always think sys_errlist is not available even if it is. Using return instead of exit is simpler than including the header.

Also declare the return type of main. Not doing this causes error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int in new compilers like llvm.org clang 16 that default to -Werror=implicit-int which, as above, can cause the feature detection to arrive at the wrong answer.