This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


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

Re: [PATCH] for bits/string2.h


On Fri, Dec 17, 1999 at 12:13:12PM +0100, Thorsten Kukuk wrote:
> 
> Hi,
> 
> The patch:
> 
> 1999-12-07  Jakub Jelinek  <jakub@redhat.com>
> 
>         * string/bits/string2.h (__memset_gc, __mempcpy_small, __strcpy_small,
>         __stpcpy_small): Cast switch expressions to int to shut up compiler
>         warnings.
> 
> breaks a lot of programs. The following construct ends with a
> compiler error:
> 
> memset(pwbuf, 0, p - pwbuf);
> 
> Reason: It will be resolved to "(unsinged int) p - pwbuf"
> 
> The attached Patch for glibc 2.1 and 2.2 fixes this.

Thanks, though only the first chunk is needed. The rest are inline
functions, not defines.

> 1999-12-17  Thorsten Kukuk  <kukuk@suse.de>
> 
> 	* string/bits/string2.h: Fix patch from 1999-12-07
> 
> --- string/bits/string2.h
> +++ string/bits/string2.h	1999/12/17 10:59:17
> @@ -118,7 +118,7 @@
>       __uint8_t __c = (__uint8_t) (c);					      \
>  									      \
>       /* This `switch' statement will be removed at compile-time.  */	      \
> -     switch ((unsigned int) n)						      \
> +     switch ((unsigned int) (n))       					      \
>         {								      \
>         case 15:								      \
>  	 __u->__ui = __c * 0x01010101;					      \


Cheers,
    Jakub
___________________________________________________________________
Jakub Jelinek | jakub@redhat.com | http://sunsite.mff.cuni.cz/~jj
Linux version 2.3.26 on a sparc64 machine (1343.49 BogoMips)
___________________________________________________________________

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