This is the mail archive of the libc-alpha@sourceware.org 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] 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


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