Make sure to include config.h first of all project-local headers
This way later macros are properly conditionalized. For example, without this, we get the following error on macOS because we our the included implementation of strlcat instead of the macOS version: In file included from ../../ntpd/nts.c:15: In file included from ../../include/ntp.h:15: ../../include/ntp_stdlib.h:142:15: error: expected parameter declarator extern size_t strlcpy(char *dst, const char *src, size_t siz); ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_string.h:108:47: note: expanded from macro 'strlcpy' __builtin___strlcpy_chk (dest, __VA_ARGS__, __darwin_obsz (dest)) ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_common.h:39:62: note: expanded from macro '__darwin_obsz' ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_common.h:30:32: note: expanded from macro '_USE_FORTIFY_LEVEL' ^ In file included from ../../ntpd/nts.c:15: In file included from ../../include/ntp.h:15: ../../include/ntp_stdlib.h:142:15: error: expected ')' /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_string.h:108:47: note: expanded from macro 'strlcpy' __builtin___strlcpy_chk (dest, __VA_ARGS__, __darwin_obsz (dest)) ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_common.h:39:62: note: expanded from macro '__darwin_obsz' ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_common.h:30:32: note: expanded from macro '_USE_FORTIFY_LEVEL' ^ ../../include/ntp_stdlib.h:142:15: note: to match this '(' /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_string.h:108:47: note: expanded from macro 'strlcpy' __builtin___strlcpy_chk (dest, __VA_ARGS__, __darwin_obsz (dest)) ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_common.h:39:53: note: expanded from macro '__darwin_obsz' ^ In file included from ../../ntpd/nts.c:15: In file included from ../../include/ntp.h:15: ../../include/ntp_stdlib.h:142:15: warning: type specifier missing, defaults to 'int' [-Wimplicit-int] extern size_t strlcpy(char *dst, const char *src, size_t siz); ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_string.h:108:47: note: expanded from macro 'strlcpy' __builtin___strlcpy_chk (dest, __VA_ARGS__, __darwin_obsz (dest)) ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_common.h:39:31: note: expanded from macro '__darwin_obsz' ^ In file included from ../../ntpd/nts.c:15: In file included from ../../include/ntp.h:15: ../../include/ntp_stdlib.h:142:15: error: conflicting types for '__builtin___strlcpy_chk' /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_string.h:108:3: note: expanded from macro 'strlcpy' __builtin___strlcpy_chk (dest, __VA_ARGS__, __darwin_obsz (dest)) ^ ../../include/ntp_stdlib.h:142:15: note: '__builtin___strlcpy_chk' is a builtin with type 'unsigned long (char *, const char *, unsigned long, unsigned long)' /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_string.h:108:3: note: expanded from macro 'strlcpy' __builtin___strlcpy_chk (dest, __VA_ARGS__, __darwin_obsz (dest)) ^ In file included from ../../ntpd/nts.c:15: In file included from ../../include/ntp.h:15: ../../include/ntp_stdlib.h:152:15: error: expected parameter declarator extern size_t strlcat(char *dst, const char *src, size_t siz); ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_string.h:115:47: note: expanded from macro 'strlcat' __builtin___strlcat_chk (dest, __VA_ARGS__, __darwin_obsz (dest)) ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_common.h:39:62: note: expanded from macro '__darwin_obsz' ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_common.h:30:32: note: expanded from macro '_USE_FORTIFY_LEVEL' ^ In file included from ../../ntpd/nts.c:15: In file included from ../../include/ntp.h:15: ../../include/ntp_stdlib.h:152:15: error: expected ')' /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_string.h:115:47: note: expanded from macro 'strlcat' __builtin___strlcat_chk (dest, __VA_ARGS__, __darwin_obsz (dest)) ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_common.h:39:62: note: expanded from macro '__darwin_obsz' ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_common.h:30:32: note: expanded from macro '_USE_FORTIFY_LEVEL' ^ ../../include/ntp_stdlib.h:152:15: note: to match this '(' /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_string.h:115:47: note: expanded from macro 'strlcat' __builtin___strlcat_chk (dest, __VA_ARGS__, __darwin_obsz (dest)) ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_common.h:39:53: note: expanded from macro '__darwin_obsz' ^ In file included from ../../ntpd/nts.c:15: In file included from ../../include/ntp.h:15: ../../include/ntp_stdlib.h:152:15: warning: type specifier missing, defaults to 'int' [-Wimplicit-int] extern size_t strlcat(char *dst, const char *src, size_t siz); ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_string.h:115:47: note: expanded from macro 'strlcat' __builtin___strlcat_chk (dest, __VA_ARGS__, __darwin_obsz (dest)) ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_common.h:39:31: note: expanded from macro '__darwin_obsz' ^ In file included from ../../ntpd/nts.c:15: In file included from ../../include/ntp.h:15: ../../include/ntp_stdlib.h:152:15: error: conflicting types for '__builtin___strlcat_chk' /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_string.h:115:3: note: expanded from macro 'strlcat' __builtin___strlcat_chk (dest, __VA_ARGS__, __darwin_obsz (dest)) ^ ../../include/ntp_stdlib.h:152:15: note: '__builtin___strlcat_chk' is a builtin with type 'unsigned long (char *, const char *, unsigned long, unsigned long)' /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_string.h:115:3: note: expanded from macro 'strlcat' __builtin___strlcat_chk (dest, __VA_ARGS__, __darwin_obsz (dest)) ^ 2 warnings and 6 errors generated.
Loading
Please register or sign in to comment