The NTP reference implementation uses Unity for unit testing. On FreeBSD (at least 11.2 and later) stdnoreturn.h has:
#define noreturn _Noreturn
That works fine for function declaration/definition, but it breaks __attribute__((noreturn)) as used by unity_internals.h. Changing that file to use __attribute__((__noreturn__)) resolves the problem.
Example warning from clang 6.0.0 (which is cc on FreeBSD 11.2):
../../../sntp/unity/unity_internals.h:480:65: warning: unknown attribute '_Noreturn' ignored [-Wunknown-attributes]
void UnityFail(const char* message, const UNITY_LINE_TYPE line) UNITY_NORETURN_ATTRIBUTE;
^
../../../sntp/unity/unity_internals.h:311:60: note: expanded from macro 'UNITY_NORETURN_ATTRIBUTE'
# define UNITY_NORETURN_ATTRIBUTE __attribute__((noreturn))
^
/usr/include/stdnoreturn.h:36:19: note: expanded from macro 'noreturn'
#define noreturn _Noreturn
That's using an older version of Unity but I see the same issue in the current source.
The NTP reference implementation uses Unity for unit testing. On FreeBSD (at least 11.2 and later) stdnoreturn.h has:
#define noreturn _NoreturnThat works fine for function declaration/definition, but it breaks
__attribute__((noreturn))as used by unity_internals.h. Changing that file to use__attribute__((__noreturn__))resolves the problem.Example warning from clang 6.0.0 (which is cc on FreeBSD 11.2):
That's using an older version of Unity but I see the same issue in the current source.