public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Drop __BEGIN_DECLS and __END_DECLS from elf.h
@ 2017-05-03 16:52 Ulf Hermann
  2017-05-05 13:16 ` Mark Wielaard
  0 siblings, 1 reply; 2+ messages in thread
From: Ulf Hermann @ 2017-05-03 16:52 UTC (permalink / raw)
  To: elfutils-devel

We don't use those anywhere else and they are not guaranteed to be
defined. Also, put the 'extern "C"' after the included headers.

Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
---
 libelf/ChangeLog |  4 ++++
 libelf/elf.h     | 10 +++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index e947e19..40a2876 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,3 +1,7 @@
+2017-05-03  Ulf Hermann  <ulf.hermann@qt.io>
+
+	* elf.h: Replace __BEGIN_DECLS and __END_DECLS with extern "C".
+
 2017-02-28  Ulf Hermann  <ulf.hermann@qt.io>
 
 	* Makefile.am: Use the predefined common library names rather than
diff --git a/libelf/elf.h b/libelf/elf.h
index b6112d9..ba385d3 100644
--- a/libelf/elf.h
+++ b/libelf/elf.h
@@ -21,12 +21,14 @@
 
 #include <features.h>
 
-__BEGIN_DECLS
-
 /* Standard ELF types.  */
 
 #include <stdint.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* Type for a 16-bit quantity.  */
 typedef uint16_t Elf32_Half;
 typedef uint16_t Elf64_Half;
@@ -3682,6 +3684,8 @@ enum
 #define R_BPF_NONE		0	/* No reloc */
 #define R_BPF_MAP_FD		1	/* Map fd to pointer */
 
-__END_DECLS
+#ifdef __cplusplus
+}
+#endif
 
 #endif	/* elf.h */
-- 
2.1.4

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Drop __BEGIN_DECLS and __END_DECLS from elf.h
  2017-05-03 16:52 [PATCH] Drop __BEGIN_DECLS and __END_DECLS from elf.h Ulf Hermann
@ 2017-05-05 13:16 ` Mark Wielaard
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Wielaard @ 2017-05-05 13:16 UTC (permalink / raw)
  To: Ulf Hermann; +Cc: elfutils-devel

On Wed, 2017-05-03 at 18:03 +0200, Ulf Hermann wrote:
> We don't use those anywhere else and they are not guaranteed to be
> defined. Also, put the 'extern "C"' after the included headers.

Note that elf.h is somewhat special. We import it as-is from glibc and
like to not have divergence if at all possible. So could you try
submitting to glibc upstream first? (libc-alpha@sourceware.org)
They might say they expect your features.h to provide these macros.
But they might also just take the change as is. If not we'll figure
something out for elfutils.

Thanks,

Mark

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-05-05 11:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-03 16:52 [PATCH] Drop __BEGIN_DECLS and __END_DECLS from elf.h Ulf Hermann
2017-05-05 13:16 ` Mark Wielaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).