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]

Re: [PATCH] Rename uses of '__block' in installed header files


On 11/21/2013 01:03 PM, Meador Inge wrote:
> Hi All,
> 
> The use of '__block' is known to interfere with keywords in some
> environments.  For example, the Clang -fblocks extension mentioned
> in PR11157.  Recently a similar issue was raised concerning the use of
> '__unused' and a '__glibc_reserved' prefix was proposed to create a glibc
> implementation namespace for these sorts of issues [1].  This patches takes
> that approach.
> 
> I performed the usual 'make check' testing, verified that issues compiling
> applications with glibc headers using 'clang -fblocks' are gone, and ensured
> that there are no code generation differences as a result of the change.
> 
> Note that this is also on Joseph's glibc/EGLIBC differences list [2].
> 
> OK?

No, but almost, and it might just be that my interpretation of the results of
the discussion are different than yours. So please feel free to counter my
argument.

The use of `__glibc_reservedN' for `__unusedN' makes the substitution of
`unused' for `reserved.' We wanted to make it clear that the entries in
a structure marked __unused are actually reserved for the implementation.

In this case I think we can leave `block' in place and just add the __glibc
implementation-specific prefix e.g. `__glibc_blockN'.

> [1] https://sourceware.org/ml/libc-alpha/2012-02/msg00047.html
> [2] http://lists.debian.org/debian-glibc/2013/11/msg00020.html
> 
> 2013-11-21  Meador Inge  <meadori@codesourcery.com>
> 
> 	* crypt/crypt.h (encrypt): Use __glibc_reserved_block instead of
> 	__block.
> 	(encrypt_r): Likewise.
> 	* malloc/obstack.h (obstack_free): Likewise.
> 	* posix/unistd.h (encrypt): Likewise.
> 
> ---
>  crypt/crypt.h    | 5 +++--
>  malloc/obstack.h | 2 +-
>  posix/unistd.h   | 3 ++-
>  3 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/crypt/crypt.h b/crypt/crypt.h
> index 985720b..f1116a2 100644
> --- a/crypt/crypt.h
> +++ b/crypt/crypt.h
> @@ -37,7 +37,8 @@ extern void setkey (const char *__key) __THROW __nonnull ((1));
>  
>  /* 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 *__glibc_reserved_block, int __edflag)

s/_reserved//g

> +     __THROW __nonnull ((1));
>  
>  #ifdef __USE_GNU
>  /* Reentrant versions of the functions above.  The additional argument
> @@ -64,7 +65,7 @@ extern void setkey_r (const char *__key,
>  		      struct crypt_data * __restrict __data)
>       __THROW __nonnull ((1, 2));
>  
> -extern void encrypt_r (char *__block, int __edflag,
> +extern void encrypt_r (char *__glibc_reserved_block, int __edflag,

s/_reserved//g

>  		       struct crypt_data * __restrict __data)
>       __THROW __nonnull ((1, 3));
>  #endif
> diff --git a/malloc/obstack.h b/malloc/obstack.h
> index d2e056b..e4f8d78 100644
> --- a/malloc/obstack.h
> +++ b/malloc/obstack.h
> @@ -185,7 +185,7 @@ extern int _obstack_begin_1 (struct obstack *, int, int,
>  			     void (*) (void *, void *), void *);
>  extern int _obstack_memory_used (struct obstack *);
>  
> -void obstack_free (struct obstack *__obstack, void *__block);
> +void obstack_free (struct obstack *__obstack, void *__glibc_reserved_block);

s/_reserved//g

>  
>  
>  /* Error handler called when `obstack_chunk_alloc' failed to allocate
> diff --git a/posix/unistd.h b/posix/unistd.h
> index 178223d..1ac1e6e 100644
> --- a/posix/unistd.h
> +++ b/posix/unistd.h
> @@ -1144,7 +1144,8 @@ extern char *crypt (const char *__key, const char *__salt)
>  
>  /* 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 *__glibc_reserved_block, int __edflag)

s/_reserved//g

> +     __THROW __nonnull ((1));
>  
>  
>  /* Swab pairs bytes in the first N bytes of the area pointed to by
> 

OK with those changes and:
- File a user visible bug explaining the problem (if there isn't one already).
- Add BZ to the ChangeLog.
- Update ChangeLog to match changes.
- Remember to update NEWS with the BZ upon checkin (if you have commit rights).

I don't expect this to impact anything in the testsuite.

Cheers,
Carlos.


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