mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Subject: missing extern "C" block
Date: Mon, 10 Oct 2011 18:44:49 +0200	[thread overview]
Message-ID: <20111010164449.GU24939@port70.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 394 bytes --]

while we are fixing c++ compatibility
some headers with function prototypes
do not have extern "C" block for c++

extern "C" block ending is wrong in
pty.h

extern "C" block is missing from
arpa/inet.h
alloca.h
ftw.h
math.h
net/if.h
netinet/in.h
sys/mount.h
sys/msg.h
sys/resource.h
sys/shm.h
sys/statfs.h
sys/statvfs.h
sys/swap.h
sys/sysctl.h
sys/sysinfo.h
sys/times.h
sys/uio.h
sys/utsname.h

[-- Attachment #2: cplusplus.diff --]
[-- Type: text/x-diff, Size: 8695 bytes --]

diff --git a/include/alloca.h b/include/alloca.h
index ac78e46..f61b817 100644
--- a/include/alloca.h
+++ b/include/alloca.h
@@ -1,9 +1,17 @@
 #ifndef	_ALLOCA_H
 #define	_ALLOCA_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define	__NEED_size_t
 #include <bits/alltypes.h>
 
 void *alloca(size_t);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/include/arpa/inet.h b/include/arpa/inet.h
index 9342713..b604f60 100644
--- a/include/arpa/inet.h
+++ b/include/arpa/inet.h
@@ -1,6 +1,10 @@
 #ifndef _ARPA_INET_H
 #define	_ARPA_INET_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include <netinet/in.h>
 #include <inttypes.h>
 
@@ -30,4 +34,8 @@ int inet_aton (const char *, struct in_addr *); /* nonstandard but widely used *
 #define INET_ADDRSTRLEN  16
 #define INET6_ADDRSTRLEN 46
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/include/ftw.h b/include/ftw.h
index 8d31c6d..9bb38c7 100644
--- a/include/ftw.h
+++ b/include/ftw.h
@@ -1,6 +1,10 @@
 #ifndef _FTW_H
 #define	_FTW_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* Normally we do not nest header includes. However useless bloat
  * like ftw may be treated as a special case. Otherwise we would
  * have to deal with duplicating all the stat.h mess. */
@@ -28,4 +32,8 @@ struct FTW
 int ftw(const char *, int (*)(const char *, const struct stat *, int), int);
 int nftw(const char *, int (*)(const char *, const struct stat *, int, struct FTW *), int, int);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/include/math.h b/include/math.h
index 6772482..9c5f06e 100644
--- a/include/math.h
+++ b/include/math.h
@@ -1,6 +1,10 @@
 #ifndef _MATH_H
 #define _MATH_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define __NEED___uint16_t
 #define __NEED___uint32_t
 #define __NEED___uint64_t
@@ -317,4 +321,8 @@ extern int signgam;
 double      scalb(double, double);
 #endif
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/include/net/if.h b/include/net/if.h
index 2ae5f89..f72228b 100644
--- a/include/net/if.h
+++ b/include/net/if.h
@@ -1,6 +1,10 @@
 #ifndef _NET_IF_H
 #define _NET_IF_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define IF_NAMESIZE 16
 
 struct if_nameindex
@@ -104,7 +108,7 @@ struct ifreq {
 #define _IOT_ifreq_int	_IOT(_IOTS(char),IFNAMSIZ,_IOTS(int),1,0,0)
 
 struct ifconf {
-	int ifc_len;		
+	int ifc_len;
 	union {
 		void *ifcu_buf;
 		struct ifreq *ifcu_req;
@@ -118,5 +122,8 @@ struct ifconf {
 #endif
 
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif
diff --git a/include/netinet/in.h b/include/netinet/in.h
index b7b8c82..cae16c7 100644
--- a/include/netinet/in.h
+++ b/include/netinet/in.h
@@ -1,6 +1,10 @@
 #ifndef	_NETINET_IN_H
 #define	_NETINET_IN_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define __NEED_in_addr_t
 #define __NEED_in_port_t
 #define __NEED_sa_family_t
@@ -300,4 +304,8 @@ struct ip6_mtuinfo
 
 #define IPV6_RTHDR_TYPE_0       0
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/include/pty.h b/include/pty.h
index 46a99f4..db63853 100644
--- a/include/pty.h
+++ b/include/pty.h
@@ -12,7 +12,7 @@ int openpty(int *, int *, char *, const struct termios *, const struct winsize *
 int forkpty(int *, char *, const struct termios *, const struct winsize *);
 
 #ifdef __cplusplus
-extern }
+}
 #endif
 
 #endif
diff --git a/include/sys/mount.h b/include/sys/mount.h
index 9420c56..3f652e9 100644
--- a/include/sys/mount.h
+++ b/include/sys/mount.h
@@ -1,6 +1,10 @@
 #ifndef _SYS_MOUNT_H
 #define _SYS_MOUNT_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include <sys/ioctl.h>
 
 #define BLKROSET   _IO(0x12, 93)
@@ -43,4 +47,8 @@ int mount(const char *, const char *, const char *, unsigned long, const void *)
 int umount(const char *);
 int umount2(const char *, int);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/include/sys/msg.h b/include/sys/msg.h
index 06f2553..460275c 100644
--- a/include/sys/msg.h
+++ b/include/sys/msg.h
@@ -1,6 +1,10 @@
 #ifndef _SYS_MSG_H
 #define _SYS_MSG_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include <sys/ipc.h>
 
 #define __NEED_pid_t
@@ -33,4 +37,8 @@ int msgget (key_t, int);
 ssize_t msgrcv (int, void *, size_t, long, int);
 int msgsnd (int, const void *, size_t, int);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/include/sys/resource.h b/include/sys/resource.h
index 7837adb..3e74850 100644
--- a/include/sys/resource.h
+++ b/include/sys/resource.h
@@ -1,6 +1,10 @@
 #ifndef	_SYS_RESOURCE_H
 #define	_SYS_RESOURCE_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define __NEED_id_t
 #define __NEED_time_t
 #define __NEED_struct_timeval
@@ -75,5 +79,8 @@ int setpriority (int, id_t, int);
 
 #define RLIM_NLIMITS RLIMIT_NLIMITS
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif
diff --git a/include/sys/shm.h b/include/sys/shm.h
index fa92710..34117cc 100644
--- a/include/sys/shm.h
+++ b/include/sys/shm.h
@@ -1,6 +1,10 @@
 #ifndef _SYS_SHM_H
 #define _SYS_SHM_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define __NEED_time_t
 #define __NEED_size_t
 #define __NEED_pid_t
@@ -43,4 +47,8 @@ int shmctl(int, int, struct shmid_ds *);
 int shmdt(const void *);
 int shmget(key_t, size_t, int);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/include/sys/statfs.h b/include/sys/statfs.h
index 05c9b13..f5239d8 100644
--- a/include/sys/statfs.h
+++ b/include/sys/statfs.h
@@ -1,6 +1,10 @@
 #ifndef	_SYS_STATFS_H
 #define	_SYS_STATFS_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include <sys/statvfs.h>
 
 typedef struct {
@@ -12,4 +16,8 @@ typedef struct {
 int statfs (const char *, struct statfs *);
 int fstatfs (int, struct statfs *);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/include/sys/statvfs.h b/include/sys/statvfs.h
index fd22fab..b9f72b7 100644
--- a/include/sys/statvfs.h
+++ b/include/sys/statvfs.h
@@ -1,6 +1,9 @@
 #ifndef	_SYS_STATVFS_H
 #define	_SYS_STATVFS_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 #define __NEED_fsblkcnt_t
 #define __NEED_fsfilcnt_t
@@ -38,5 +41,8 @@ int fstatvfs (int, struct statvfs *);
 #define ST_NOATIME     1024
 #define ST_NODIRATIME  2048
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif
diff --git a/include/sys/swap.h b/include/sys/swap.h
index c5824f1..2d921ad 100644
--- a/include/sys/swap.h
+++ b/include/sys/swap.h
@@ -1,6 +1,10 @@
 #ifndef _SYS_SWAP_H
 #define _SYS_SWAP_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define	SWAP_FLAG_PREFER        0x8000
 #define	SWAP_FLAG_PRIO_MASK     0x7fff
 #define	SWAP_FLAG_PRIO_SHIFT    0
@@ -8,4 +12,8 @@
 int swapon (const char *, int);
 int swapoff (const char *);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/include/sys/sysctl.h b/include/sys/sysctl.h
index af5ca8b..c358b79 100644
--- a/include/sys/sysctl.h
+++ b/include/sys/sysctl.h
@@ -1,9 +1,17 @@
 #ifndef	_SYS_SYSCTL_H
 #define	_SYS_SYSCTL_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define __NEED_size_t
 #include <bits/alltypes.h>
 
 int sysctl (int *, int, void *, size_t *, void *, size_t);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/include/sys/sysinfo.h b/include/sys/sysinfo.h
index ca52088..3bf6cb0 100644
--- a/include/sys/sysinfo.h
+++ b/include/sys/sysinfo.h
@@ -1,6 +1,10 @@
 #ifndef _SYS_SYSINFO_H
 #define _SYS_SYSINFO_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ?? */
 #define SI_LOAD_SHIFT 16
 
@@ -26,4 +30,8 @@ int get_nprocs (void);
 long long get_phys_pages (void);
 long long get_avphys_pages (void);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/include/sys/times.h b/include/sys/times.h
index aca743d..98d2324 100644
--- a/include/sys/times.h
+++ b/include/sys/times.h
@@ -1,6 +1,10 @@
 #ifndef	_SYS_TIMES_H
 #define	_SYS_TIMES_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define __NEED_clock_t
 #include <bits/alltypes.h>
 
@@ -14,4 +18,8 @@ struct tms
 
 clock_t times (struct tms *);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/include/sys/uio.h b/include/sys/uio.h
index 11b6bd2..f77db33 100644
--- a/include/sys/uio.h
+++ b/include/sys/uio.h
@@ -1,6 +1,10 @@
 #ifndef _SYS_UIO_H
 #define _SYS_UIO_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define __NEED_size_t
 #define __NEED_ssize_t
 #define __NEED_struct_iovec
@@ -10,4 +14,8 @@
 ssize_t readv (int, const struct iovec *, int);
 ssize_t writev (int, const struct iovec *, int);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/include/sys/utsname.h b/include/sys/utsname.h
index 383e825..4c36960 100644
--- a/include/sys/utsname.h
+++ b/include/sys/utsname.h
@@ -1,6 +1,10 @@
 #ifndef	_SYS_UTSNAME_H
 #define	_SYS_UTSNAME_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct utsname
 {
 	char sysname[65];
@@ -17,5 +21,8 @@ struct utsname
 
 int uname (struct utsname *);
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif

             reply	other threads:[~2011-10-10 16:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-10 16:44 Szabolcs Nagy [this message]
2011-10-11  3:49 ` Isaac Dunham
2011-10-11  4:10   ` Rich Felker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111010164449.GU24939@port70.net \
    --to=nsz@port70.net \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).