* [PATCH] Don't use __BEGIN_DECLS macros from glibc.
@ 2020-10-26 20:44 Érico Nogueira
2020-10-26 20:58 ` Dmitry V. Levin
0 siblings, 1 reply; 5+ messages in thread
From: Érico Nogueira @ 2020-10-26 20:44 UTC (permalink / raw)
To: elfutils-devel; +Cc: Érico Rolim
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Don't use __BEGIN_DECLS macros from glibc.
2020-10-26 20:44 [PATCH] Don't use __BEGIN_DECLS macros from glibc Érico Nogueira
@ 2020-10-26 20:58 ` Dmitry V. Levin
2020-10-26 21:34 ` Érico Nogueira
0 siblings, 1 reply; 5+ messages in thread
From: Dmitry V. Levin @ 2020-10-26 20:58 UTC (permalink / raw)
To: Érico Nogueira; +Cc: elfutils-devel, Érico Rolim
On Mon, Oct 26, 2020 at 05:44:24PM -0300, Érico Nogueira via Elfutils-devel wrote:
> 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(-)
This file is a verbatim copy of glibc's elf/elf.h, see
git log -- libelf/elf.h
--
ldv
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Don't use __BEGIN_DECLS macros from glibc.
2020-10-26 20:58 ` Dmitry V. Levin
@ 2020-10-26 21:34 ` Érico Nogueira
2020-10-26 22:24 ` Mark Wielaard
0 siblings, 1 reply; 5+ messages in thread
From: Érico Nogueira @ 2020-10-26 21:34 UTC (permalink / raw)
To: Dmitry V. Levin; +Cc: elfutils-devel, Érico Rolim
On Mon Oct 26, 2020 at 8:58 PM -03, Dmitry V. Levin wrote:
> On Mon, Oct 26, 2020 at 05:44:24PM -0300, Érico Nogueira via
> Elfutils-devel wrote:
> > 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(-)
>
> This file is a verbatim copy of glibc's elf/elf.h, see
> git log -- libelf/elf.h
>
>
> --
> ldv
Hm, I see. This change would only make it necessary to restore the top
and bottom of the file after any update; do you think that would be too
much trouble? I could also add a comment to make it clear why the
explicit `extern "C"` is necessary.
Thanks,
Érico
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Don't use __BEGIN_DECLS macros from glibc.
2020-10-26 21:34 ` Érico Nogueira
@ 2020-10-26 22:24 ` Mark Wielaard
2020-10-28 11:46 ` Mark Wielaard
0 siblings, 1 reply; 5+ messages in thread
From: Mark Wielaard @ 2020-10-26 22:24 UTC (permalink / raw)
To: Érico Nogueira, Dmitry V. Levin; +Cc: Érico Rolim, elfutils-devel
Hi,
On Mon, 2020-10-26 at 18:34 -0300, Érico Nogueira via Elfutils-devel
wrote:
> On Mon Oct 26, 2020 at 8:58 PM -03, Dmitry V. Levin wrote:
> > On Mon, Oct 26, 2020 at 05:44:24PM -0300, Érico Nogueira via
> > Elfutils-devel wrote:
> > > ---
> > > libelf/elf.h | 10 ++++++----
> > > 1 file changed, 6 insertions(+), 4 deletions(-)
> >
> > This file is a verbatim copy of glibc's elf/elf.h, see
> > git log -- libelf/elf.h
> >
>
> Hm, I see. This change would only make it necessary to restore the top
> and bottom of the file after any update; do you think that would be too
> much trouble? I could also add a comment to make it clear why the
> explicit `extern "C"` is necessary.
Please just suggest a patch upstream to libc-alpha@sourceware.org.
We'll pick it up when they decide to accept it. Note that it is also a
public glibc header installed as /usr/include/elf.h.
Thanks,
Mark
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Don't use __BEGIN_DECLS macros from glibc.
2020-10-26 22:24 ` Mark Wielaard
@ 2020-10-28 11:46 ` Mark Wielaard
0 siblings, 0 replies; 5+ messages in thread
From: Mark Wielaard @ 2020-10-28 11:46 UTC (permalink / raw)
To: Érico Nogueira, Dmitry V. Levin; +Cc: Érico Rolim, elfutils-devel
[-- Attachment #1: Type: text/plain, Size: 374 bytes --]
Hi Érico,
On Mon, 2020-10-26 at 23:24 +0100, Mark Wielaard wrote:
> Please just suggest a patch upstream to libc-alpha@sourceware.org.
> We'll pick it up when they decide to accept it. Note that it is also a
> public glibc header installed as /usr/include/elf.h.
I saw your patch was accepted upstream, so I synced it and pushed the
attached.
Thanks,
Mark
[-- Attachment #2: 0001-libelf-Sync-elf.h-from-glibc.patch --]
[-- Type: text/x-patch, Size: 1118 bytes --]
From 56f64c94651f4840e890c1963f9d6f6a4123abde Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
Date: Wed, 28 Oct 2020 12:36:57 +0100
Subject: [PATCH] libelf: Sync elf.h from glibc.
Makes elf.h standalone and removes __BEGIN_DECLS/__END_DECLS macros.
Signed-off-by: Mark Wielaard <mark@klomp.org>
---
libelf/ChangeLog | 4 ++++
libelf/elf.h | 6 ------
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index a3f15883..b15508f2 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,3 +1,7 @@
+2020-10-28 Mark Wielaard <mark@klomp.org>
+
+ * elf.h: Update from glibc.
+
2020-08-28 Mark Wielaard <mark@klomp.org>
* elf.h: Update from glibc.
diff --git a/libelf/elf.h b/libelf/elf.h
index ff9f1dad..6439c1a4 100644
--- a/libelf/elf.h
+++ b/libelf/elf.h
@@ -19,10 +19,6 @@
#ifndef _ELF_H
#define _ELF_H 1
-#include <features.h>
-
-__BEGIN_DECLS
-
/* Standard ELF types. */
#include <stdint.h>
@@ -4105,6 +4101,4 @@ enum
#define R_ARC_TLS_LE_S9 0x4a
#define R_ARC_TLS_LE_32 0x4b
-__END_DECLS
-
#endif /* elf.h */
--
2.18.4
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-10-28 11:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-26 20:44 [PATCH] Don't use __BEGIN_DECLS macros from glibc Érico Nogueira
2020-10-26 20:58 ` Dmitry V. Levin
2020-10-26 21:34 ` Érico Nogueira
2020-10-26 22:24 ` Mark Wielaard
2020-10-28 11:46 ` 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).