This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[patch] Add missing {__BEGIN,__END}_DECLS to sys/sysmacros.h
- From: ppluzhnikov at google dot com (Paul Pluzhnikov)
- To: libc-alpha at sourceware dot org
- Cc: ppluzhnikov at google dot com
- Date: Fri, 6 May 2011 17:23:56 -0700 (PDT)
- Subject: [patch] Add missing {__BEGIN,__END}_DECLS to sys/sysmacros.h
Greetings,
The following program:
#include <sys/sysmacros.h>
int main()
{
return makedev(1, 2);
}
builds fine in C mode on Linux/x86_64, but fails in C++ mode:
g++ /tmp/t.c
/tmp/ccJ0GPYl.o: In function `main':
t.c:(.text+0xf): undefined reference to `gnu_dev_makedev(unsigned int, unsigned int)'
collect2: ld returned 1 exit status
This is happening because of missing __BEGIN_DECLS / __END_DECLS in
sysdeps/unix/sysv/linux/sys/sysmacros.h
Attached patch fixes that.
Thanks,
--
Paul Pluzhnikov
2011-05-06 Paul Pluzhnikov <ppluzhnikov@google.com>
* sysdeps/unix/sysv/linux/sys/sysmacros.h: Add missing
__BEGIN/__END_DECLS.
diff --git a/sysdeps/unix/sysv/linux/sys/sysmacros.h b/sysdeps/unix/sysv/linux/sys/sysmacros.h
index 92b3a19..5626615 100644
--- a/sysdeps/unix/sysv/linux/sys/sysmacros.h
+++ b/sysdeps/unix/sysv/linux/sys/sysmacros.h
@@ -27,6 +27,7 @@
not going to hack weird hacks to support the dev_t representation
they need. */
#ifdef __GLIBC_HAVE_LONG_LONG
+__BEGIN_DECLS
__extension__
extern unsigned int gnu_dev_major (unsigned long long int __dev)
__THROW;
@@ -37,6 +38,7 @@ __extension__
extern unsigned long long int gnu_dev_makedev (unsigned int __major,
unsigned int __minor)
__THROW;
+__END_DECLS
# if defined __GNUC__ && __GNUC__ >= 2 && defined __USE_EXTERN_INLINES
__extension__ __extern_inline unsigned int