This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] Fix two uses of __BEGIN_DECLS
- From: Stan Shebs <stanshebs at google dot com>
- To: "libc-alpha at sourceware dot org" <libc-alpha at sourceware dot org>
- Date: Wed, 12 Aug 2015 16:14:56 -0500
- Subject: [PATCH] Fix two uses of __BEGIN_DECLS
- Authentication-results: sourceware.org; auth=none
We ran across a couple cases of problems in headers when they were included in
C++ sources, the positioning of extern "C" wrappers came out wrong.
(Is there a test for this kind of thing? I didn't see anything relevant.)
Stan
2015-08-12 Stan Shebs <stanshebs@google.com>
* elf/link.h: Move __BEGIN_DECLS up.
* socket/sys/un.h: Include string.h before __BEGIN_DECLS.
diff --git a/elf/link.h b/elf/link.h
index eaca802..6ec9b55 100644
--- a/elf/link.h
+++ b/elf/link.h
@@ -34,6 +34,8 @@
#include <bits/elfclass.h> /* Defines __ELF_NATIVE_CLASS. */
#include <bits/link.h>
+__BEGIN_DECLS
+
/* Rendezvous structure used by the run-time dynamic linker to communicate
details of shared object loading to the debugger. If the executable's
dynamic section has a DT_DEBUG element, the run-time linker sets that
@@ -162,8 +164,6 @@ struct dl_phdr_info
void *dlpi_tls_data;
};
-__BEGIN_DECLS
-
extern int dl_iterate_phdr (int (*__callback) (struct dl_phdr_info *,
size_t, void *),
void *__data);
diff --git a/socket/sys/un.h b/socket/sys/un.h
index 0059570..2fbf1fe 100644
--- a/socket/sys/un.h
+++ b/socket/sys/un.h
@@ -23,6 +23,10 @@
/* Get the definition of the macro to define the common sockaddr members. */
#include <bits/sockaddr.h>
+#ifdef __USE_MISC
+# include <string.h> /* For prototype of `strlen'. */
+#endif
+
__BEGIN_DECLS
/* Structure describing the address of an AF_LOCAL (aka AF_UNIX) socket. */
@@ -34,7 +38,6 @@ struct sockaddr_un
#ifdef __USE_MISC
-# include <string.h> /* For prototype of `strlen'. */
/* Evaluate to actual length of the `sockaddr_un' structure. */
# define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) \