public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: drepper@cygnus.com
Cc: libc-hacker@sourceware.cygnus.com
Subject: [PATCH] shut up warnings in bits/string2.h
Date: Tue, 07 Dec 1999 13:02:00 -0000	[thread overview]
Message-ID: <19991207220811.M515@mff.cuni.cz> (raw)

Hi!

This patch shuts up gcc 2.96 warnings about long switch expressions not
converted to int.
BTW: I've seen pretty bad code as result of the string2.h inlines on sparc,
while -D__NO_STRING_INLINES gave me much better code as the compiler did the
job. I'll investigate why that happens and for which functions and submit a
sparc string.h which will disable those inlines from string2.h which result
in bad code. How does it work on other architectures?

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.

--- string/bits/string2.h.jj12	Thu Oct 14 21:29:59 1999
+++ string/bits/string2.h	Mon Dec  6 12:18:37 1999
@@ -118,7 +118,7 @@ __STRING2_COPY_TYPE (8);
      __uint8_t __c = (__uint8_t) (c);					      \
 									      \
      /* This `switch' statement will be removed at compile-time.  */	      \
-     switch (n)								      \
+     switch ((unsigned int)n)						      \
        {								      \
        case 15:								      \
 	 __u->__ui = __c * 0x01010101;					      \
@@ -230,7 +230,7 @@ __mempcpy_small (void *__dest1,
     unsigned char __uc;
     unsigned char __c;
   } *__u = __dest1;
-  switch (__srclen)
+  switch ((unsigned int)__srclen)
     {
     case 1:
       __u->__c = __src0_1;
@@ -332,7 +332,7 @@ __mempcpy_small (void *__dest, char __sr
     __STRING2_COPY_ARR7 __sca7;
     __STRING2_COPY_ARR8 __sca8;
   } *__u = __dest;
-  switch (__srclen)
+  switch ((unsigned int)__srclen)
     {
     case 1:
       __u->__c = __src1;
@@ -405,7 +405,7 @@ __strcpy_small (char *__dest,
     __uint16_t __usi;
     unsigned char __uc;
   } *__u = (void *) __dest;
-  switch (__srclen)
+  switch ((unsigned int)__srclen)
     {
     case 1:
       __u->__uc = '\0';
@@ -498,7 +498,7 @@ __strcpy_small (char *__dest,
     __STRING2_COPY_ARR7 __sca7;
     __STRING2_COPY_ARR8 __sca8;
   } *__u = (void *) __dest;
-  switch (__srclen)
+  switch ((unsigned int)__srclen)
     {
     case 1:
       __u->__c = '\0';
@@ -565,7 +565,7 @@ __stpcpy_small (char *__dest,
     unsigned char __uc;
     char __c;
   } *__u = (void *) __dest;
-  switch (__srclen)
+  switch ((unsigned int)__srclen)
     {
     case 1:
       __u->__uc = '\0';
@@ -662,7 +662,7 @@ __stpcpy_small (char *__dest,
     __STRING2_COPY_ARR7 __sca7;
     __STRING2_COPY_ARR8 __sca8;
   } *__u = (void *) __dest;
-  switch (__srclen)
+  switch ((unsigned int)__srclen)
     {
     case 1:
       __u->__c = '\0';

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

             reply	other threads:[~1999-12-07 13:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-12-07 13:02 Jakub Jelinek [this message]
1999-12-07 18:41 ` Richard Henderson
1999-12-07 23:41 ` Ulrich Drepper
1999-12-08  0:22   ` Jakub Jelinek
1999-12-08  0:34     ` Ulrich Drepper
1999-12-08  7:56       ` Jakub Jelinek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19991207220811.M515@mff.cuni.cz \
    --to=jakub@redhat.com \
    --cc=drepper@cygnus.com \
    --cc=libc-hacker@sourceware.cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).