diff --git a/include/rbs/defines.h b/include/rbs/defines.h index 56a05b7719..00af7cde19 100644 --- a/include/rbs/defines.h +++ b/include/rbs/defines.h @@ -87,8 +87,13 @@ * Nullability annotations for pointer types. * Clang supports _Nullable and _Nonnull to indicate whether a pointer may be NULL. * On other compilers, these expand to nothing. + * + * They are Clang extensions, so a strict ISO C compilation rejects them with + * `-Wnullability-extension`, which is an error under `-pedantic-errors`. Expand + * them to nothing in that case, so that embedders compiling these headers with a + * conforming dialect (`-std=c99` and friends define `__STRICT_ANSI__`) still build. */ -#ifdef __clang__ +#if defined(__clang__) && !defined(__STRICT_ANSI__) #define RBS_NULLABLE _Nullable #define RBS_NONNULL _Nonnull #else