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] Misc fixes
Date: Tue, 28 Dec 1999 07:14:00 -0000	[thread overview]
Message-ID: <19991228161746.D697@mff.cuni.cz> (raw)

Hi!

This patch kills a few warnings here and there, plus provides two different
__signbit{,l} inlines for 32bit/64bit SPARC, because what we use to have did
generate suboptimal code on 64bit (if it was accidentally correct).

1999-12-28  Jakub Jelinek  <jakub@redhat.com>

	* elf/sprof.c (load_shobj): Fix error message.
	(generate_call_graph): Cast %*s length argument to int.
	* locale/programs/localedef.c (construct_output_path): Likewise.
	* locale/programs/ld-ctype.c (ctype_finish): Use proper format
	specifier.
	(ctype_class_new): Likewise.
	* locale/programs/ld-time.c (time_finish): Likewise.
	* sunrpc/svc_simple.c (register_rpc): Likewise.
	* nscd/connections.c (nscd_run, start_threads): Use long instead of
	int to avoid cast warnings.
	* sysdeps/ieee754/ldbl-128/e_atan2l.c (__ieee754_atan2l): Kill
	warning.
	* sysdeps/ieee754/ldbl-128/s_roundl.c (__roundl): Remove unused
	variable se.

	* time/strftime.c (my_strftime): Provide wide era string when
	requested.

	* sysdeps/sparc/fpu/bits/mathinline.h (__signbit, __signbitl):
	Separate into 32bit and 64bit versions.

--- libc/elf/sprof.c.jj	Tue Feb  9 10:33:00 1999
+++ libc/elf/sprof.c	Tue Dec 28 13:43:54 1999
@@ -530,7 +530,8 @@ load_shobj (const char *name)
   fd = open (map->l_name, O_RDONLY);
   if (fd == -1)
     /* Dooh, this really shouldn't happen.  We know the file is available.  */
-    error (EXIT_FAILURE, errno, _("Reopening shared object `%s' failed"));
+    error (EXIT_FAILURE, errno, _("Reopening shared object `%s' failed"),
+	   map->l_name);
 
   /* Now map the section header.  */
   ptr = mmap (NULL, (ehdr->e_shnum * sizeof (ElfW(Shdr))
@@ -1206,7 +1207,7 @@ generate_call_graph (struct profdata *pr
 	/* Info abount the function itself.  */
 	n = printf ("[%Zu]", cnt);
 	printf ("%*s%5.1f%8.2f%8.2f%9" PRIdMAX "         %s [%Zd]\n",
-		7 - n, " ",
+		(int) (7 - n), " ",
 		total_ticks ? (100.0 * sortsym[cnt]->ticks) / total_ticks : 0,
 		sortsym[cnt]->ticks * tick_unit,
 		0.0, /* FIXME: what's time for the children, recursive */
--- libc/locale/programs/ld-ctype.c.jj	Tue Dec 28 11:28:26 1999
+++ libc/locale/programs/ld-ctype.c	Tue Dec 28 14:36:07 1999
@@ -437,7 +437,7 @@ character L'\\u%0*x' in class `%s' must 
 			  {
 			    char buf[17];
 
-			    sprintf (buf, "\\%o", cnt);
+			    sprintf (buf, "\\%zo", cnt);
 
 			    if (!be_quiet)
 			      error (0, 0, _("\
@@ -452,7 +452,7 @@ character '%s' in class `%s' must be in 
 			  {
 			    char buf[17];
 
-			    sprintf (buf, "\\%o", cnt);
+			    sprintf (buf, "\\%zo", cnt);
 
 			    if (!be_quiet)
 			      error (0, 0, _("\
@@ -1021,7 +1021,7 @@ ctype_class_new (struct linereader *lr, 
   if (ctype->nr_charclass == MAX_NR_CHARCLASS)
     /* Exit code 2 is prescribed in P1003.2b.  */
     error (2, 0, _("\
-implementation limit: no more than %d character classes allowed"),
+implementation limit: no more than %z character classes allowed"),
 	   MAX_NR_CHARCLASS);
 
   ctype->classnames[ctype->nr_charclass++] = name;
--- libc/locale/programs/ld-time.c.jj	Tue Dec 28 11:28:26 1999
+++ libc/locale/programs/ld-time.c	Tue Dec 28 14:37:33 1999
@@ -219,7 +219,7 @@ time_finish (struct localedef_t *locale,
 	  if (*str != '+' && *str != '-')
 	    {
 	      if (!be_quiet)
-		error (0, 0, _("%s: direction flag in string %d in `era' field"
+		error (0, 0, _("%s: direction flag in string %z in `era' field"
 			       " is not '+' nor '-'"),
 		       "LC_TIME", idx + 1);
 	      /* Default arbitrarily to '+'.  */
@@ -230,7 +230,7 @@ time_finish (struct localedef_t *locale,
 	  if (*++str != ':')
 	    {
 	      if (!be_quiet)
-		error (0, 0, _("%s: direction flag in string %d in `era' field"
+		error (0, 0, _("%s: direction flag in string %z in `era' field"
 			       " is not a single character"),
 		       "LC_TIME", idx + 1);
 	      (void) strsep (&str, ":");
@@ -243,7 +243,7 @@ time_finish (struct localedef_t *locale,
 	  if (endp == str)
 	    {
 	      if (!be_quiet)
-		error (0, 0, _("%s: invalid number for offset in string %d in"
+		error (0, 0, _("%s: invalid number for offset in string %z in"
 			       " `era' field"),
 		       "LC_TIME", idx + 1);
 	      (void) strsep (&str, ":");
@@ -252,7 +252,7 @@ time_finish (struct localedef_t *locale,
 	    {
 	      if (!be_quiet)
 		error (0, 0, _("%s: garbage at end of offset value in"
-			       " string %d in `era' field"),
+			       " string %z in `era' field"),
 		       "LC_TIME", idx + 1);
 	      (void) strsep (&str, ":");
 	    }
@@ -302,7 +302,7 @@ time_finish (struct localedef_t *locale,
 		{
 		invalid_start_date:
 		  if (!be_quiet)
-		    error (0, 0, _("%s: invalid starting date in string %d in"
+		    error (0, 0, _("%s: invalid starting date in string %z in"
 				   " `era' field"),
 			   "LC_TIME", idx + 1);
 		  (void) strsep (&str, ":");
@@ -312,7 +312,7 @@ time_finish (struct localedef_t *locale,
 		garbage_start_date:
 		  if (!be_quiet)
 		    error (0, 0, _("%s: garbage at end of starting date "
-				   "in string %d in `era' field "),
+				   "in string %z in `era' field "),
 			   "LC_TIME", idx + 1);
 		  (void) strsep (&str, ":");
 		}
@@ -331,7 +331,7 @@ time_finish (struct localedef_t *locale,
 			   && !__isleap (time->era_entries[idx].start_date[0])))
 		      && !be_quiet)
 			  error (0, 0, _("%s: starting date is invalid in"
-					 " string %d in `era' field"),
+					 " string %z in `era' field"),
 				 "LC_TIME", idx + 1);
 		}
 	    }
@@ -379,7 +379,7 @@ time_finish (struct localedef_t *locale,
 		{
 		invalid_stop_date:
 		  if (!be_quiet)
-		    error (0, 0, _("%s: invalid stopping date in string %d in"
+		    error (0, 0, _("%s: invalid stopping date in string %z in"
 				   " `era' field"),
 			   "LC_TIME", idx + 1);
 		  (void) strsep (&str, ":");
@@ -389,7 +389,7 @@ time_finish (struct localedef_t *locale,
 		garbage_stop_date:
 		  if (!be_quiet)
 		    error (0, 0, _("%s: garbage at end of stopping date "
-				   "in string %d in `era' field"),
+				   "in string %z in `era' field"),
 			   "LC_TIME", idx + 1);
 		  (void) strsep (&str, ":");
 		}
@@ -408,7 +408,7 @@ time_finish (struct localedef_t *locale,
 			   && !__isleap (time->era_entries[idx].stop_date[0])))
 		      && !be_quiet)
 			  error (0, 0, _("%s: stopping date is invalid in"
-					 " string %d in `era' field"),
+					 " string %z in `era' field"),
 				 "LC_TIME", idx + 1);
 		}
 	    }
@@ -416,7 +416,7 @@ time_finish (struct localedef_t *locale,
 	  if (str == NULL || *str == '\0')
 	    {
 	      if (!be_quiet)
-		error (0, 0, _("%s: missing era name in string %d in `era'"
+		error (0, 0, _("%s: missing era name in string %z in `era'"
 			       " field"), "LC_TIME", idx + 1);
 	      time->era_entries[idx].name =
 		time->era_entries[idx].format = "";
@@ -428,7 +428,7 @@ time_finish (struct localedef_t *locale,
 	      if (str == NULL || *str == '\0')
 		{
 		  if (!be_quiet)
-		    error (0, 0, _("%s: missing era format in string %d"
+		    error (0, 0, _("%s: missing era format in string %z"
 				   " in `era' field"),
 			   "LC_TIME", idx + 1);
 		  time->era_entries[idx].name =
--- libc/locale/programs/localedef.c.jj	Tue Dec 28 11:28:26 1999
+++ libc/locale/programs/localedef.c	Tue Dec 28 13:30:07 1999
@@ -356,8 +356,8 @@ construct_output_path (char *path)
       if (normal == NULL)
 	n = asprintf (&result, "%s/%s%c", LOCALEDIR, path, '\0');
       else
-	n = asprintf (&result, "%s/%.*s%s%s%c", LOCALEDIR, startp - path, path,
-		      normal, endp, '\0');
+	n = asprintf (&result, "%s/%.*s%s%s%c", LOCALEDIR,
+		      (int) (startp - path), path, normal, endp, '\0');
 
       endp = result + n;
     }
--- libc/nscd/connections.c.jj	Mon Sep 27 05:50:58 1999
+++ libc/nscd/connections.c	Tue Dec 28 13:41:53 1999
@@ -382,7 +382,7 @@ static void *
 __attribute__ ((__noreturn__))
 nscd_run (void *p)
 {
-  int my_number = (int) p;
+  long my_number = (long) p;
   struct pollfd conn;
   int run_prune = my_number < lastdb && dbs[my_number].enabled;
   time_t now = time (NULL);
@@ -496,7 +496,7 @@ nscd_run (void *p)
 void
 start_threads (void)
 {
-  int i;
+  long i;
   pthread_attr_t attr;
   pthread_t th;
 
--- libc/sunrpc/svc_simple.c.jj	Sat Jun 19 11:47:45 1999
+++ libc/sunrpc/svc_simple.c	Tue Dec 28 13:14:56 1999
@@ -73,7 +73,7 @@ registerrpc (u_long prognum, u_long vers
   if (procnum == NULLPROC)
     {
       (void) fprintf (stderr,
-		      _("can't reassign procedure number %d\n"), NULLPROC);
+		      _("can't reassign procedure number %ld\n"), NULLPROC);
       return -1;
     }
   if (transp == 0)
@@ -89,7 +89,7 @@ registerrpc (u_long prognum, u_long vers
   if (!svc_register (transp, (u_long) prognum, (u_long) versnum,
 		     universal, IPPROTO_UDP))
     {
-      (void) fprintf (stderr, _("couldn't register prog %d vers %d\n"),
+      (void) fprintf (stderr, _("couldn't register prog %ld vers %ld\n"),
 		      prognum, versnum);
       return -1;
     }
--- libc/sysdeps/ieee754/ldbl-128/e_atan2l.c.jj	Wed Jul 14 02:04:51 1999
+++ libc/sysdeps/ieee754/ldbl-128/e_atan2l.c	Tue Dec 28 13:32:56 1999
@@ -73,7 +73,7 @@ pi_lo   = 8.6718101301237810247970440260
 	if(((ix|((lx|-lx)>>63))>0x7fff000000000000LL)||
 	   ((iy|((ly|-ly)>>63))>0x7fff000000000000LL))	/* x or y is NaN */
 	   return x+y;
-	if((hx-0x3fff000000000000LL|lx)==0) return __atanl(y);   /* x=1.0L */
+	if(((hx-0x3fff000000000000LL)|lx)==0) return __atanl(y);   /* x=1.0L */
 	m = ((hy>>63)&1)|((hx>>62)&2);	/* 2*sign(x)+sign(y) */
 
     /* when y = 0 */
--- libc/sysdeps/ieee754/ldbl-128/s_roundl.c.jj	Wed Jul 14 02:09:56 1999
+++ libc/sysdeps/ieee754/ldbl-128/s_roundl.c	Tue Dec 28 13:33:42 1999
@@ -31,7 +31,7 @@ long double
 __roundl (long double x)
 {
   int32_t j0;
-  u_int64_t se, i1, i0;
+  u_int64_t i1, i0;
 
   GET_LDOUBLE_WORDS64 (i0, i1, x);
   j0 = ((i0 >> 48) & 0x7fff) - 0x3fff;
--- libc/sysdeps/sparc/fpu/bits/mathinline.h.jj	Fri Nov 12 16:30:35 1999
+++ libc/sysdeps/sparc/fpu/bits/mathinline.h	Tue Dec 28 11:51:06 1999
@@ -110,6 +110,8 @@ __signbitf (float __x)
   return __u.__i < 0;
 }
 
+#if __WORDSIZE == 32
+
 __MATH_INLINE int
 __signbit (double __x)
 {
@@ -120,17 +122,26 @@ __signbit (double __x)
 __MATH_INLINE int
 __signbitl (long double __x)
 {
-  if (sizeof(long double) == 8)
-    {
-      __extension__ union { long double __l; int __i[2]; } __u = { __l: __x };
-      return __u.__i[0] < 0;
-    }
-  else
-    {
-      __extension__ union { long double __l; int __i[4]; } __u = { __l: __x };
-      return __u.__i[0] < 0;
-    }
+  return __signbit ((double)__x);
+}
+
+#else /* sparc64 */
+
+__MATH_INLINE int
+__signbit (double __x)
+{
+  __extension__ union { double __d; long __i; } __u = { __d: __x };
+  return __u.__i < 0;
+}
+
+__MATH_INLINE int
+__signbitl (long double __x)
+{
+  __extension__ union { long double __l; long __i[2]; } __u = { __l: __x };
+  return __u.__i[0] < 0;
 }
+
+#endif /* sparc64 */
 
 __MATH_INLINE double
 sqrt(double __x)
--- libc/time/strftime.c.jj	Wed Dec 22 08:04:48 1999
+++ libc/time/strftime.c	Tue Dec 28 13:49:20 1999
@@ -834,8 +834,8 @@ my_strftime (s, maxsize, format, tp ut_a
 	      if (era)
 		{
 # ifdef COMPILE_WIDE
-		  size_t len = strlen (era->era_name);
-		  cpy (len, era->era_name);
+		  size_t len = wcslen (era->era_wname);
+		  cpy (len, era->era_wname);
 # else
 		  size_t len = strlen (era->era_name);
 		  cpy (len, era->era_name);

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

             reply	other threads:[~1999-12-28  7:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-12-28  7:14 Jakub Jelinek [this message]
1999-12-28  8:29 ` Ulrich Drepper
2002-12-16 10:56 Jakub Jelinek
2002-12-16 11:33 ` Ulrich Drepper
2003-07-12 14:19 Jakub Jelinek
2003-07-12 18:49 ` Ulrich Drepper
2004-10-06 11:41 Jakub Jelinek
2009-03-10 13:42 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=19991228161746.D697@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).