[PATCH] Don't use __BEGIN_DECLS macros from glibc.

Érico Nogueira ericonr@disroot.org
Mon Oct 26 20:44:24 GMT 2020


From: Érico Rolim <erico.erc@gmail.com>

These macros are mostly internal to glibc and require the inclusion of
<sys/cdefs.h> (here included indirectly via <features.h>), which isn't a
standard header.

Since they are only required once, replacing them with their definition
is simple.

Signed-off-by: Érico Rolim <erico.erc@gmail.com>
---
 libelf/elf.h | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/libelf/elf.h b/libelf/elf.h
index ff9f1dad..38391392 100644
--- a/libelf/elf.h
+++ b/libelf/elf.h
@@ -19,9 +19,9 @@
 #ifndef _ELF_H
 #define	_ELF_H 1
 
-#include <features.h>
-
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /* Standard ELF types.  */
 
@@ -4105,6 +4105,8 @@ enum
 #define R_ARC_TLS_LE_S9		0x4a
 #define R_ARC_TLS_LE_32		0x4b
 
-__END_DECLS
+#ifdef __cplusplus
+}
+#endif
 
 #endif	/* elf.h */
-- 
2.29.0



More information about the Elfutils-devel mailing list