[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patches] Patch for glibc bug #11157 "__block is a reserved word with clang -fblocks"



Hello,

I have attached a patch that solves glibc bug #11157 [1]. The basic problem is that the clang compiler defines a new keyword __block that conflicts with a function prototype in <unistd.h>. This makes it difficult to compile programs that use the new keyword.

The solution I propose is to add the prefix "libc_" to the glibc prototypes that use "__block" as an argument name.

Thanks,

 - Mark

[1]

http://sources.redhat.com/bugzilla/show_bug.cgi?id=11157
diff -ruN eglibc.r10766/libc/crypt/crypt.h eglibc/libc/crypt/crypt.h
--- eglibc.r10766/libc/crypt/crypt.h	2010-06-19 13:09:00.000000000 -0400
+++ eglibc/libc/crypt/crypt.h	2010-06-19 13:12:03.000000000 -0400
@@ -38,7 +38,7 @@
 
 /* Encrypt data in BLOCK in place if EDFLAG is zero; otherwise decrypt
    block in place.  */
-extern void encrypt (char *__block, int __edflag) __THROW __nonnull ((1));
+extern void encrypt (char *__libc_block, int __edflag) __THROW __nonnull ((1));
 
 #ifdef __USE_GNU
 /* Reentrant versions of the functions above.  The additional argument
@@ -65,7 +65,7 @@
 		      struct crypt_data * __restrict __data)
      __THROW __nonnull ((1, 2));
 
-extern void encrypt_r (char *__block, int __edflag,
+extern void encrypt_r (char *__libc_block, int __edflag,
 		       struct crypt_data * __restrict __data)
      __THROW __nonnull ((1, 3));
 #endif
diff -ruN eglibc.r10766/libc/posix/unistd.h eglibc/libc/posix/unistd.h
--- eglibc.r10766/libc/posix/unistd.h	2010-06-19 13:09:00.000000000 -0400
+++ eglibc/libc/posix/unistd.h	2010-06-19 13:11:20.000000000 -0400
@@ -1132,7 +1132,7 @@
 
 /* Encrypt data in BLOCK in place if EDFLAG is zero; otherwise decrypt
    block in place.  */
-extern void encrypt (char *__block, int __edflag) __THROW __nonnull ((1));
+extern void encrypt (char *__libc_block, int __edflag) __THROW __nonnull ((1));
 
 
 /* Swab pairs bytes in the first N bytes of the area pointed to by