From 8176ae67c853e1174801d11d263c6729aa8fc457 Mon Sep 17 00:00:00 2001 From: Travis Geiselbrecht Date: Tue, 27 Feb 2024 00:46:56 -0800 Subject: [PATCH] [libc][cdefs] add a few additional features in cdefs This seems to only be needed for older gccs (found with 7.5.0). --- lib/libc/include/sys/cdefs.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/libc/include/sys/cdefs.h b/lib/libc/include/sys/cdefs.h index e30c1ff72..5f7946181 100644 --- a/lib/libc/include/sys/cdefs.h +++ b/lib/libc/include/sys/cdefs.h @@ -56,6 +56,25 @@ #define __BEGIN_DECLS __BEGIN_CDECLS #define __END_DECLS __END_CDECLS +/* + * Testing against Clang-specific extensions. + */ +#ifndef __has_attribute +#define __has_attribute(x) 0 +#endif +#ifndef __has_extension +#define __has_extension __has_feature +#endif +#ifndef __has_feature +#define __has_feature(x) 0 +#endif +#ifndef __has_include +#define __has_include(x) 0 +#endif +#ifndef __has_builtin +#define __has_builtin(x) 0 +#endif + /*- * Deal with _ANSI_SOURCE: * If it is defined, and no other compilation environment is explicitly