This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix two uses of __BEGIN_DECLS

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.)


2015-08-12  Stan Shebs <>

        * 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>

 /* 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;

 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'.  */

 /* 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)       \

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]