Fix two uses of __BEGIN_DECLS
Commit Message
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.
Comments
On 12 Aug 2015 16:14, Stan Shebs wrote:
> 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.
what problems ? you're moving structs/enums under the external part.
-mike
On Wed, Aug 12, 2015 at 11:26 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> On 12 Aug 2015 16:14, Stan Shebs wrote:
>> 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.
>
> what problems ? you're moving structs/enums under the external part.
Also _DYNAMIC - Google has several chunks of C++ code that iterate over it.
Stan
On 13 Aug 2015 07:08, Stan Shebs wrote:
> On Wed, Aug 12, 2015 at 11:26 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> > On 12 Aug 2015 16:14, Stan Shebs wrote:
> >> 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.
> >
> > what problems ? you're moving structs/enums under the external part.
>
> Also _DYNAMIC - Google has several chunks of C++ code that iterate over it.
so it's the few symbols that are causing problems ? i'm not against the
patch, but we want to see the reason behind it including error messages.
-mike
@@ -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);
@@ -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) \