Use '%z' instead of '%Z' on printf functions

The Z modifier is a nonstandard synonymn for z (that predates z
itself) and compiler might issue an warning for in invalid
conversion specifier.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
This commit is contained in:
Adhemerval Zanella Netto 2022-09-01 10:02:30 -03:00 committed by Adhemerval Zanella
parent 340097d0b5
commit de477abcaa
29 changed files with 70 additions and 70 deletions

View File

@ -1033,7 +1033,7 @@ write_out (struct catalog *catalog, const char *output_name,
/* If the current message set has a symbolic name write this /* If the current message set has a symbolic name write this
out first. */ out first. */
if (set_run->symbol != NULL) if (set_run->symbol != NULL)
fprintf (fp, "%s#define %sSet %#x\t/* %s:%Zu */\n", fprintf (fp, "%s#define %sSet %#x\t/* %s:%zu */\n",
first ? "" : "\n", set_run->symbol, set_run->number - 1, first ? "" : "\n", set_run->symbol, set_run->number - 1,
set_run->fname, set_run->line); set_run->fname, set_run->line);
first = 0; first = 0;
@ -1047,12 +1047,12 @@ write_out (struct catalog *catalog, const char *output_name,
if (message_run->symbol != NULL) if (message_run->symbol != NULL)
{ {
if (set_run->symbol == NULL) if (set_run->symbol == NULL)
fprintf (fp, "#define AutomaticSet%d%s %#x\t/* %s:%Zu */\n", fprintf (fp, "#define AutomaticSet%d%s %#x\t/* %s:%zu */\n",
set_run->number, message_run->symbol, set_run->number, message_run->symbol,
message_run->number, message_run->fname, message_run->number, message_run->fname,
message_run->line); message_run->line);
else else
fprintf (fp, "#define %s%s %#x\t/* %s:%Zu */\n", fprintf (fp, "#define %s%s %#x\t/* %s:%zu */\n",
set_run->symbol, message_run->symbol, set_run->symbol, message_run->symbol,
message_run->number, message_run->fname, message_run->number, message_run->fname,
message_run->line); message_run->line);

View File

@ -1406,7 +1406,7 @@ cannot enable executable stack as shared object requires");
if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES)) if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
_dl_debug_printf ("\ _dl_debug_printf ("\
dynamic: 0x%0*lx base: 0x%0*lx size: 0x%0*Zx\n\ dynamic: 0x%0*lx base: 0x%0*lx size: 0x%0*zx\n\
entry: 0x%0*lx phdr: 0x%0*lx phnum: %*u\n\n", entry: 0x%0*lx phdr: 0x%0*lx phnum: %*u\n\n",
(int) sizeof (void *) * 2, (int) sizeof (void *) * 2,
(unsigned long int) l->l_ld, (unsigned long int) l->l_ld,

View File

@ -113,7 +113,7 @@ _dl_debug_vdprintf (int fd, int tag_p, const char *fmt, va_list arg)
/* Recognize the l modifier. It is only important on some /* Recognize the l modifier. It is only important on some
platforms where long and int have a different size. We platforms where long and int have a different size. We
can use the same code for size_t. */ can use the same code for size_t. */
if (*fmt == 'l' || *fmt == 'Z') if (*fmt == 'l' || *fmt == 'z')
{ {
#if LONG_MAX != INT_MAX #if LONG_MAX != INT_MAX
long_mod = 1; long_mod = 1;

View File

@ -380,7 +380,7 @@ __tunables_print (void)
(long int) cur->type.max); (long int) cur->type.max);
break; break;
case TUNABLE_TYPE_SIZE_T: case TUNABLE_TYPE_SIZE_T:
_dl_printf ("0x%Zx (min: 0x%Zx, max: 0x%Zx)\n", _dl_printf ("0x%zx (min: 0x%zx, max: 0x%zx)\n",
(size_t) cur->val.numval, (size_t) cur->val.numval,
(size_t) cur->type.min, (size_t) cur->type.min,
(size_t) cur->type.max); (size_t) cur->type.max);

View File

@ -2125,11 +2125,11 @@ dl_main (const ElfW(Phdr) *phdr,
else if (strcmp (l->l_libname->name, l->l_name) == 0) else if (strcmp (l->l_libname->name, l->l_name) == 0)
/* Print vDSO like libraries without duplicate name. Some /* Print vDSO like libraries without duplicate name. Some
consumers depend of this format. */ consumers depend of this format. */
_dl_printf ("\t%s (0x%0*Zx)\n", l->l_libname->name, _dl_printf ("\t%s (0x%0*zx)\n", l->l_libname->name,
(int) sizeof l->l_map_start * 2, (int) sizeof l->l_map_start * 2,
(size_t) l->l_map_start); (size_t) l->l_map_start);
else else
_dl_printf ("\t%s => %s (0x%0*Zx)\n", _dl_printf ("\t%s => %s (0x%0*zx)\n",
DSO_FILENAME (l->l_libname->name), DSO_FILENAME (l->l_libname->name),
DSO_FILENAME (l->l_name), DSO_FILENAME (l->l_name),
(int) sizeof l->l_map_start * 2, (int) sizeof l->l_map_start * 2,
@ -2151,7 +2151,7 @@ dl_main (const ElfW(Phdr) *phdr,
loadbase = LOOKUP_VALUE_ADDRESS (result, false); loadbase = LOOKUP_VALUE_ADDRESS (result, false);
_dl_printf ("%s found at 0x%0*Zd in object at 0x%0*Zd\n", _dl_printf ("%s found at 0x%0*zd in object at 0x%0*zd\n",
_dl_argv[i], _dl_argv[i],
(int) sizeof ref->st_value * 2, (int) sizeof ref->st_value * 2,
(size_t) ref->st_value, (size_t) ref->st_value,

View File

@ -476,7 +476,7 @@ load_shobj (const char *name)
result->kcountsize = textsize / HISTFRACTION; result->kcountsize = textsize / HISTFRACTION;
result->hashfraction = HASHFRACTION; result->hashfraction = HASHFRACTION;
if (do_test) if (do_test)
printf ("hashfraction = %d\ndivider = %Zu\n", printf ("hashfraction = %d\ndivider = %zu\n",
result->hashfraction, result->hashfraction,
result->hashfraction * sizeof (struct here_fromstruct)); result->hashfraction * sizeof (struct here_fromstruct));
result->tossize = textsize / HASHFRACTION; result->tossize = textsize / HASHFRACTION;
@ -495,7 +495,7 @@ load_shobj (const char *name)
* sizeof (struct here_cg_arc_record))); * sizeof (struct here_cg_arc_record)));
if (do_test) if (do_test)
printf ("expected size: %Zd\n", result->expected_size); printf ("expected size: %zd\n", result->expected_size);
#define SCALE_1_TO_1 0x10000L #define SCALE_1_TO_1 0x10000L
@ -1357,15 +1357,15 @@ generate_call_graph (struct profdata *profdata)
? sortsym[runp->idx]->name : "<UNKNOWN>")); ? sortsym[runp->idx]->name : "<UNKNOWN>"));
if (runp->idx != (size_t) -1l) if (runp->idx != (size_t) -1l)
printf (" [%Zd]", runp->idx); printf (" [%zd]", runp->idx);
putchar_unlocked ('\n'); putchar_unlocked ('\n');
runp = runp->next; runp = runp->next;
} }
/* Info about the function itself. */ /* Info about the function itself. */
n = printf ("[%Zu]", cnt); n = printf ("[%zu]", cnt);
printf ("%*s%5.1f%8.2f%8.2f%9" PRIdMAX " %s [%Zd]\n", printf ("%*s%5.1f%8.2f%8.2f%9" PRIdMAX " %s [%zd]\n",
(int) (7 - n), " ", (int) (7 - n), " ",
total_ticks ? (100.0 * sortsym[cnt]->ticks) / total_ticks : 0, total_ticks ? (100.0 * sortsym[cnt]->ticks) / total_ticks : 0,
sortsym[cnt]->ticks * tick_unit, sortsym[cnt]->ticks * tick_unit,
@ -1384,7 +1384,7 @@ generate_call_graph (struct profdata *profdata)
runp->count); runp->count);
if (runp->idx != (size_t) -1l) if (runp->idx != (size_t) -1l)
printf ("%-9" PRIdMAX " %s [%Zd]\n", printf ("%-9" PRIdMAX " %s [%zd]\n",
sortsym[runp->idx]->calls, sortsym[runp->idx]->calls,
sortsym[runp->idx]->name, sortsym[runp->idx]->name,
runp->idx); runp->idx);

View File

@ -32,7 +32,7 @@ callback (struct dl_phdr_info *info, size_t size, void *ptr)
static int last_adds = 0, last_subs = 0; static int last_adds = 0, last_subs = 0;
intptr_t cmd = (intptr_t) ptr; intptr_t cmd = (intptr_t) ptr;
printf (" size = %Zu\n", size); printf (" size = %zu\n", size);
if (size < (offsetof (struct dl_phdr_info, dlpi_subs) if (size < (offsetof (struct dl_phdr_info, dlpi_subs)
+ sizeof (info->dlpi_subs))) + sizeof (info->dlpi_subs)))
{ {

View File

@ -33,7 +33,7 @@ do_test (void)
result = 1; result = 1;
} }
else else
printf ("dlinfo says TLS module ID %Zu\n", modid); printf ("dlinfo says TLS module ID %zu\n", modid);
void *block; void *block;
if (dlinfo (h, RTLD_DI_TLS_DATA, &block)) if (dlinfo (h, RTLD_DI_TLS_DATA, &block))

View File

@ -161,7 +161,7 @@ main (int argc, char **argv)
for (i = 0; i < NELEMS (taddr); ++i) for (i = 0; i < NELEMS (taddr); ++i)
for (j = 0; j < 0x10000 / sizeof (int); ++j) for (j = 0; j < 0x10000 / sizeof (int); ++j)
if (buf[i][j] != 0) if (buf[i][j] != 0)
printf ("%0*Zx\t%u\t(buffer %d)\n", printf ("%0*zx\t%u\t(buffer %d)\n",
(int) (sizeof (size_t) * 2), (int) (sizeof (size_t) * 2),
(taddr[i] + ((char *) &buf[i][j] - (char *) &buf[i][0])), (taddr[i] + ((char *) &buf[i][j] - (char *) &buf[i][0])),
buf[i][j], i); buf[i][j], i);

View File

@ -440,7 +440,7 @@ process_block (struct convtable *tbl, char *addr, size_t len, FILE *output)
ignoring errors. Otherwise punt. */ ignoring errors. Otherwise punt. */
if (! omit_invalid) if (! omit_invalid)
{ {
error (0, 0, _("illegal input sequence at position %Zd"), n); error (0, 0, _("illegal input sequence at position %zd"), n);
return -1; return -1;
} }

View File

@ -25,8 +25,8 @@ main (void)
/* Get the buffer size. */ /* Get the buffer size. */
if (__fbufsize (fp) != sizeof buf) if (__fbufsize (fp) != sizeof buf)
{ {
printf ("__fbusize() reported a buffer size of %Zd bytes;" printf ("__fbusize() reported a buffer size of %zd bytes;"
" we installed a buffer with %Zd bytes\n", " we installed a buffer with %zd bytes\n",
__fbufsize (fp), sizeof buf); __fbufsize (fp), sizeof buf);
result = 1; result = 1;
} }
@ -91,7 +91,7 @@ main (void)
/* The string we wrote above should still be in the buffer. */ /* The string we wrote above should still be in the buffer. */
if (__fpending (fp) != strlen (teststring)) if (__fpending (fp) != strlen (teststring))
{ {
printf ("__fpending() returned %Zd; expected %Zd\n", printf ("__fpending() returned %zd; expected %zd\n",
__fpending (fp), strlen (teststring)); __fpending (fp), strlen (teststring));
result = 1; result = 1;
} }
@ -100,7 +100,7 @@ main (void)
/* And check again. */ /* And check again. */
if (__fpending (fp) != 0) if (__fpending (fp) != 0)
{ {
printf ("__fpending() returned %Zd; expected 0\n", printf ("__fpending() returned %zd; expected 0\n",
__fpending (fp)); __fpending (fp));
result = 1; result = 1;
} }

View File

@ -59,7 +59,7 @@ do_test (void)
exit (1); exit (1);
} }
printf ("INFO: input file has %Zd bytes\n", mbsize); printf ("INFO: input file has %zd bytes\n", mbsize);
/* First convert the text to wide characters. We use iconv here. */ /* First convert the text to wide characters. We use iconv here. */
{ {
@ -82,7 +82,7 @@ do_test (void)
nonr = iconv (cd, &inbuf, &inleft, &outbuf, &outleft); nonr = iconv (cd, &inbuf, &inleft, &outbuf, &outleft);
if (nonr != 0 && nonr != (size_t) -1) if (nonr != 0 && nonr != (size_t) -1)
{ {
printf ("%u: iconv performed %Zd nonreversible conversions\n", printf ("%u: iconv performed %zd nonreversible conversions\n",
__LINE__, nonr); __LINE__, nonr);
exit (1); exit (1);
} }
@ -90,7 +90,7 @@ do_test (void)
if (nonr == (size_t) -1) if (nonr == (size_t) -1)
{ {
printf ("\ printf ("\
%u: iconv returned with %Zd and errno = %m (inleft: %Zd, outleft: %Zd)\n", %u: iconv returned with %zd and errno = %m (inleft: %zd, outleft: %zd)\n",
__LINE__, nonr, inleft, outleft); __LINE__, nonr, inleft, outleft);
exit (1); exit (1);
} }
@ -163,7 +163,7 @@ do_test (void)
wint_t wch = fgetwc (fp); wint_t wch = fgetwc (fp);
if (wch == WEOF) if (wch == WEOF)
{ {
printf ("%u: fgetwc failed (idx %Zd): %m\n", __LINE__, n); printf ("%u: fgetwc failed (idx %zd): %m\n", __LINE__, n);
exit (1); exit (1);
} }
wc2buf[n] = wch; wc2buf[n] = wch;
@ -290,7 +290,7 @@ do_test (void)
{ {
if (fgetws (wcp, &wc2buf[wcsize] - wcp + 1, fp) == NULL) if (fgetws (wcp, &wc2buf[wcsize] - wcp + 1, fp) == NULL)
{ {
printf ("%u: short read using fgetws (only %td of %Zd)\n", printf ("%u: short read using fgetws (only %td of %zd)\n",
__LINE__, wcp - wc2buf, wcsize); __LINE__, wcp - wc2buf, wcsize);
status = 1; status = 1;
break; break;

View File

@ -42,18 +42,18 @@ do_test (void)
if (tests[n].exp < 0 && res >= 0) if (tests[n].exp < 0 && res >= 0)
{ {
support_record_failure (); support_record_failure ();
printf ("swprintf (buf, %Zu, L\"%%s\", \"%s\") expected to fail\n", printf ("swprintf (buf, %zu, L\"%%s\", \"%s\") expected to fail\n",
tests[n].n, tests[n].str); tests[n].n, tests[n].str);
} }
else if (tests[n].exp >= 0 && tests[n].exp != res) else if (tests[n].exp >= 0 && tests[n].exp != res)
{ {
support_record_failure (); support_record_failure ();
printf ("\ printf ("\
swprintf (buf, %Zu, L\"%%s\", \"%s\") expected to return %Zd, but got %Zd\n", swprintf (buf, %zu, L\"%%s\", \"%s\") expected to return %zd, but got %zd\n",
tests[n].n, tests[n].str, tests[n].exp, res); tests[n].n, tests[n].str, tests[n].exp, res);
} }
else else
printf ("swprintf (buf, %Zu, L\"%%s\", \"%s\") OK\n", printf ("swprintf (buf, %zu, L\"%%s\", \"%s\") OK\n",
tests[n].n, tests[n].str); tests[n].n, tests[n].str);
} }

View File

@ -20,7 +20,7 @@ main (int argc, char *argv[])
n = swscanf (in, L"%d + %d is %d", &a, &b, &c); n = swscanf (in, L"%d + %d is %d", &a, &b, &c);
if (n != 3 || a + b != c || c != 42) if (n != 3 || a + b != c || c != 42)
{ {
printf ("*** FAILED, n = %Zu, a = %d, b = %d, c = %d\n", n, a, b, c); printf ("*** FAILED, n = %zu, a = %d, b = %d, c = %d\n", n, a, b, c);
result = 1; result = 1;
} }
@ -30,7 +30,7 @@ main (int argc, char *argv[])
if (n != 5 || strcmp (buf1, "one") != 0 || wcscmp (wbuf2, L"two") != 0 if (n != 5 || strcmp (buf1, "one") != 0 || wcscmp (wbuf2, L"two") != 0
|| strcmp (buf3, "three") != 0 || c4 != '!' || wc5 != L'!') || strcmp (buf3, "three") != 0 || c4 != '!' || wc5 != L'!')
{ {
printf ("*** FAILED, n = %Zu, buf1 = \"%s\", wbuf2 = L\"%S\", buf3 = \"%s\", c4 = '%c', wc5 = L'%C'\n", printf ("*** FAILED, n = %zu, buf1 = \"%s\", wbuf2 = L\"%S\", buf3 = \"%s\", c4 = '%c', wc5 = L'%C'\n",
n, buf1, wbuf2, buf3, c4, (wint_t) wc5); n, buf1, wbuf2, buf3, c4, (wint_t) wc5);
result = 1; result = 1;
} }

View File

@ -1059,7 +1059,7 @@ insert_value (struct linereader *ldfile, const char *symstr, size_t symlen,
/* Test whether this element is not already in the list. */ /* Test whether this element is not already in the list. */
if (elem->next != NULL || elem == collate->cursor) if (elem->next != NULL || elem == collate->cursor)
{ {
lr_error (ldfile, _("order for `%.*s' already defined at %s:%Zu"), lr_error (ldfile, _("order for `%.*s' already defined at %s:%zu"),
(int) symlen, symstr, elem->file, elem->line); (int) symlen, symstr, elem->file, elem->line);
lr_ignore_rest (ldfile, 0); lr_ignore_rest (ldfile, 0);
return 1; return 1;
@ -1235,7 +1235,7 @@ range is not lower than that of the last character"), "LC_COLLATE");
&& elem->next == collate->cursor)) && elem->next == collate->cursor))
{ {
lr_error (ldfile, _("\ lr_error (ldfile, _("\
order for `%.*s' already defined at %s:%Zu"), order for `%.*s' already defined at %s:%zu"),
(int) namelen, seq->name, (int) namelen, seq->name,
elem->file, elem->line); elem->file, elem->line);
goto increment; goto increment;
@ -1378,7 +1378,7 @@ order for `%.*s' already defined at %s:%Zu"),
&& elem->next == collate->cursor)) && elem->next == collate->cursor))
{ {
lr_error (ldfile, _("\ lr_error (ldfile, _("\
%s: order for `%.*s' already defined at %s:%Zu"), %s: order for `%.*s' already defined at %s:%zu"),
"LC_COLLATE", (int) lenfrom, buf, "LC_COLLATE", (int) lenfrom, buf,
elem->file, elem->line); elem->file, elem->line);
continue; continue;
@ -3728,7 +3728,7 @@ error while adding equivalent collating symbol"));
|| &collate->undefined == collate->cursor) || &collate->undefined == collate->cursor)
{ {
lr_error (ldfile, lr_error (ldfile,
_("%s: order for `%.*s' already defined at %s:%Zu"), _("%s: order for `%.*s' already defined at %s:%zu"),
"LC_COLLATE", 9, "UNDEFINED", "LC_COLLATE", 9, "UNDEFINED",
collate->undefined.file, collate->undefined.file,
collate->undefined.line); collate->undefined.line);

View File

@ -526,7 +526,7 @@ internal error in %s, line %u"), __FUNCTION__, __LINE__);
{ {
char buf[17]; char buf[17];
snprintf (buf, sizeof buf, "\\%Zo", cnt); snprintf (buf, sizeof buf, "\\%zo", cnt);
record_error (0, 0, _("\ record_error (0, 0, _("\
character '%s' in class `%s' must be in class `%s'"), character '%s' in class `%s' must be in class `%s'"),
@ -541,7 +541,7 @@ character '%s' in class `%s' must be in class `%s'"),
{ {
char buf[17]; char buf[17];
snprintf (buf, sizeof buf, "\\%Zo", cnt); snprintf (buf, sizeof buf, "\\%zo", cnt);
record_error (0, 0, _("\ record_error (0, 0, _("\
character '%s' in class `%s' must not be in class `%s'"), character '%s' in class `%s' must not be in class `%s'"),

View File

@ -36,7 +36,7 @@ main (void)
if (n == (size_t) -1) if (n == (size_t) -1)
printf ("iconv() returned error: %m\n"); printf ("iconv() returned error: %m\n");
else else
printf ("iconv() returned %Zd, expected 7\n", n); printf ("iconv() returned %zd, expected 7\n", n);
result = 1; result = 1;
} }
if (inlen != 0) if (inlen != 0)
@ -57,7 +57,7 @@ main (void)
} }
else if (outlen != sizeof (outbuf) - sizeof (expected)) else if (outlen != sizeof (outbuf) - sizeof (expected))
{ {
printf ("outlen wrong: %Zd, expected %Zd\n", outlen, printf ("outlen wrong: %zd, expected %zd\n", outlen,
sizeof (outbuf) - 15); sizeof (outbuf) - 15);
result = 1; result = 1;
} }

View File

@ -70,7 +70,7 @@ do_test (void)
if (n == (size_t) -1) if (n == (size_t) -1)
printf ("iconv() returned error: %m\n"); printf ("iconv() returned error: %m\n");
else else
printf ("iconv() returned %Zd, expected 24\n", n); printf ("iconv() returned %zd, expected 24\n", n);
result = 1; result = 1;
} }
if (inlen != 0) if (inlen != 0)
@ -91,7 +91,7 @@ do_test (void)
} }
else if (outlen != sizeof (outbuf) - sizeof (expected)) else if (outlen != sizeof (outbuf) - sizeof (expected))
{ {
printf ("outlen wrong: %Zd, expected %Zd\n", outlen, printf ("outlen wrong: %zd, expected %zd\n", outlen,
sizeof (outbuf) - 15); sizeof (outbuf) - 15);
result = 1; result = 1;
} }

View File

@ -83,7 +83,7 @@ do_test (void)
check_return_fromfpx (); check_return_fromfpx ();
check_return_ufromfpx (); check_return_ufromfpx ();
printf ("%Zd\n", sizeof (carg (lx))); printf ("%zd\n", sizeof (carg (lx)));
return errors != 0; return errors != 0;
} }

View File

@ -104,16 +104,16 @@ do_test_clock (clockid_t clockid, const char *fnname)
pthread_rwlockattr_t a; pthread_rwlockattr_t a;
if (pthread_rwlockattr_init (&a) != 0) if (pthread_rwlockattr_init (&a) != 0)
FAIL_EXIT1 ("round %Zu: rwlockattr_t failed\n", cnt); FAIL_EXIT1 ("round %zu: rwlockattr_t failed\n", cnt);
if (pthread_rwlockattr_setkind_np (&a, kind[cnt]) != 0) if (pthread_rwlockattr_setkind_np (&a, kind[cnt]) != 0)
FAIL_EXIT1 ("round %Zu: rwlockattr_setkind failed\n", cnt); FAIL_EXIT1 ("round %zu: rwlockattr_setkind failed\n", cnt);
if (pthread_rwlock_init (&r, &a) != 0) if (pthread_rwlock_init (&r, &a) != 0)
FAIL_EXIT1 ("round %Zu: rwlock_init failed\n", cnt); FAIL_EXIT1 ("round %zu: rwlock_init failed\n", cnt);
if (pthread_rwlockattr_destroy (&a) != 0) if (pthread_rwlockattr_destroy (&a) != 0)
FAIL_EXIT1 ("round %Zu: rwlockattr_destroy failed\n", cnt); FAIL_EXIT1 ("round %zu: rwlockattr_destroy failed\n", cnt);
struct timespec ts; struct timespec ts;
xclock_gettime (clockid_for_get, &ts); xclock_gettime (clockid_for_get, &ts);
@ -124,7 +124,7 @@ do_test_clock (clockid_t clockid, const char *fnname)
? pthread_rwlock_timedwrlock (&r, &ts) ? pthread_rwlock_timedwrlock (&r, &ts)
: pthread_rwlock_clockwrlock (&r, clockid, &ts); : pthread_rwlock_clockwrlock (&r, clockid, &ts);
if (e != 0) if (e != 0)
FAIL_EXIT1 ("round %Zu: %swrlock failed (%d)\n", FAIL_EXIT1 ("round %zu: %swrlock failed (%d)\n",
cnt, fnname, e); cnt, fnname, e);
verbose_printf ("1st %swrlock done\n", fnname); verbose_printf ("1st %swrlock done\n", fnname);
@ -160,7 +160,7 @@ do_test_clock (clockid_t clockid, const char *fnname)
puts ("joined thread"); puts ("joined thread");
if (pthread_rwlock_destroy (&r) != 0) if (pthread_rwlock_destroy (&r) != 0)
FAIL_EXIT1 ("round %Zu: rwlock_destroy failed\n", cnt); FAIL_EXIT1 ("round %zu: rwlock_destroy failed\n", cnt);
} }
return 0; return 0;

View File

@ -100,16 +100,16 @@ do_test_clock (clockid_t clockid, const char *fnname)
pthread_rwlockattr_t a; pthread_rwlockattr_t a;
if (pthread_rwlockattr_init (&a) != 0) if (pthread_rwlockattr_init (&a) != 0)
FAIL_EXIT1 ("round %Zu: rwlockattr_t failed\n", cnt); FAIL_EXIT1 ("round %zu: rwlockattr_t failed\n", cnt);
if (pthread_rwlockattr_setkind_np (&a, kind[cnt]) != 0) if (pthread_rwlockattr_setkind_np (&a, kind[cnt]) != 0)
FAIL_EXIT1 ("round %Zu: rwlockattr_setkind failed\n", cnt); FAIL_EXIT1 ("round %zu: rwlockattr_setkind failed\n", cnt);
if (pthread_rwlock_init (&r, &a) != 0) if (pthread_rwlock_init (&r, &a) != 0)
FAIL_EXIT1 ("round %Zu: rwlock_init failed\n", cnt); FAIL_EXIT1 ("round %zu: rwlock_init failed\n", cnt);
if (pthread_rwlockattr_destroy (&a) != 0) if (pthread_rwlockattr_destroy (&a) != 0)
FAIL_EXIT1 ("round %Zu: rwlockattr_destroy failed\n", cnt); FAIL_EXIT1 ("round %zu: rwlockattr_destroy failed\n", cnt);
struct timespec ts; struct timespec ts;
xclock_gettime (clockid_for_get, &ts); xclock_gettime (clockid_for_get, &ts);
@ -119,10 +119,10 @@ do_test_clock (clockid_t clockid, const char *fnname)
/* Get a read lock. */ /* Get a read lock. */
if (clockid == CLOCK_USE_TIMEDLOCK) { if (clockid == CLOCK_USE_TIMEDLOCK) {
if (pthread_rwlock_timedrdlock (&r, &ts) != 0) if (pthread_rwlock_timedrdlock (&r, &ts) != 0)
FAIL_EXIT1 ("round %Zu: rwlock_timedrdlock failed\n", cnt); FAIL_EXIT1 ("round %zu: rwlock_timedrdlock failed\n", cnt);
} else { } else {
if (pthread_rwlock_clockrdlock (&r, clockid, &ts) != 0) if (pthread_rwlock_clockrdlock (&r, clockid, &ts) != 0)
FAIL_EXIT1 ("round %Zu: rwlock_%srdlock failed\n", cnt, fnname); FAIL_EXIT1 ("round %zu: rwlock_%srdlock failed\n", cnt, fnname);
} }
printf ("%zu: got %srdlock\n", cnt, fnname); printf ("%zu: got %srdlock\n", cnt, fnname);
@ -134,10 +134,10 @@ do_test_clock (clockid_t clockid, const char *fnname)
pthread_t th = xpthread_create (NULL, tf, &args); pthread_t th = xpthread_create (NULL, tf, &args);
void *status = xpthread_join (th); void *status = xpthread_join (th);
if (status != NULL) if (status != NULL)
FAIL_EXIT1 ("failure in round %Zu\n", cnt); FAIL_EXIT1 ("failure in round %zu\n", cnt);
if (pthread_rwlock_destroy (&r) != 0) if (pthread_rwlock_destroy (&r) != 0)
FAIL_EXIT1 ("round %Zu: rwlock_destroy failed\n", cnt); FAIL_EXIT1 ("round %zu: rwlock_destroy failed\n", cnt);
} }
return 0; return 0;

View File

@ -115,7 +115,7 @@ main (int argc, char *argv[])
regfree (&re); regfree (&re);
} }
printf ("\n%Zu tests, %d errors\n", cnt, errors); printf ("\n%zu tests, %d errors\n", cnt, errors);
return errors != 0; return errors != 0;
} }

View File

@ -413,11 +413,11 @@ testit (struct test_case_struct *tc)
if (bzzzt) if (bzzzt)
{ {
printf ("FAILED\n"); printf ("FAILED\n");
printf ("info: Test words: <%s>, need retval %d, wordc %Zd\n", printf ("info: Test words: <%s>, need retval %d, wordc %zd\n",
tc->words, tc->retval, tc->wordc); tc->words, tc->retval, tc->wordc);
if (start_offs != 0) if (start_offs != 0)
printf ("(preceded by %d NULLs)\n", start_offs); printf ("(preceded by %d NULLs)\n", start_offs);
printf ("Got retval %d, wordc %Zd: ", retval, we.we_wordc); printf ("Got retval %d, wordc %zd: ", retval, we.we_wordc);
if (retval == 0 || retval == WRDE_NOSPACE) if (retval == 0 || retval == WRDE_NOSPACE)
{ {
for (i = 0; i < we.we_wordc + start_offs; ++i) for (i = 0; i < we.we_wordc + start_offs; ++i)

View File

@ -274,7 +274,7 @@ do_test (int argc, char *argv[])
for (cnt = 10; cnt > 0; ) for (cnt = 10; cnt > 0; )
if (aio_cancel (fd, cbp[--cnt]) == -1) if (aio_cancel (fd, cbp[--cnt]) == -1)
/* This is not an error. The request can simply be finished. */ /* This is not an error. The request can simply be finished. */
printf ("aio_cancel (fd, cbp[%Zd]) cannot be canceled\n", cnt); printf ("aio_cancel (fd, cbp[%zd]) cannot be canceled\n", cnt);
puts ("finished2"); puts ("finished2");
result |= do_wait (cbp, 10, ECANCELED); result |= do_wait (cbp, 10, ECANCELED);

View File

@ -275,7 +275,7 @@ do_test (int argc, char *argv[])
for (cnt = 10; cnt > 0; ) for (cnt = 10; cnt > 0; )
if (aio_cancel64 (fd, cbp[--cnt]) == -1) if (aio_cancel64 (fd, cbp[--cnt]) == -1)
/* This is not an error. The request can simply be finished. */ /* This is not an error. The request can simply be finished. */
printf ("aio_cancel64 (fd, cbp[%Zd]) cannot be canceled\n", cnt); printf ("aio_cancel64 (fd, cbp[%zd]) cannot be canceled\n", cnt);
puts ("finished2"); puts ("finished2");
result |= do_wait (cbp, 10, ECANCELED); result |= do_wait (cbp, 10, ECANCELED);

View File

@ -1647,7 +1647,7 @@ main (void)
else else
{ {
status = EXIT_FAILURE; status = EXIT_FAILURE;
printf("%Zd errors.\n", errors); printf("%zd errors.\n", errors);
} }
return status; return status;

View File

@ -34,7 +34,7 @@ do_test (void)
if (strlen (buf) != words * 4 + lens[last]) if (strlen (buf) != words * 4 + lens[last])
{ {
printf ("\ printf ("\
strlen failed for base=%Zu, words=%Zu, and last=%Zu (is %zd, expected %zd)\n", strlen failed for base=%zu, words=%zu, and last=%zu (is %zd, expected %zd)\n",
base, words, last, base, words, last,
strlen (buf), words * 4 + lens[last]); strlen (buf), words * 4 + lens[last]);
return 1; return 1;
@ -43,7 +43,7 @@ strlen failed for base=%Zu, words=%Zu, and last=%Zu (is %zd, expected %zd)\n",
if (strnlen (buf, -1) != words * 4 + lens[last]) if (strnlen (buf, -1) != words * 4 + lens[last])
{ {
printf ("\ printf ("\
strnlen failed for base=%Zu, words=%Zu, and last=%Zu (is %zd, expected %zd)\n", strnlen failed for base=%zu, words=%zu, and last=%zu (is %zd, expected %zd)\n",
base, words, last, base, words, last,
strnlen (buf, -1), words * 4 + lens[last]); strnlen (buf, -1), words * 4 + lens[last]);
return 1; return 1;

View File

@ -102,18 +102,18 @@ do_test (void)
if (res == 0) if (res == 0)
{ {
printf ("%Zu: %s: res == 0 despite size == %Zu\n", printf ("%zu: %s: res == 0 despite size == %zu\n",
cnt, tests[cnt].fmt, size); cnt, tests[cnt].fmt, size);
result = 1; result = 1;
} }
else if (size < tests[cnt].min) else if (size < tests[cnt].min)
{ {
printf ("%Zu: %s: size == %Zu was enough\n", printf ("%zu: %s: size == %zu was enough\n",
cnt, tests[cnt].fmt, size); cnt, tests[cnt].fmt, size);
result = 1; result = 1;
} }
else else
printf ("%Zu: %s: size == %Zu: OK\n", cnt, tests[cnt].fmt, size); printf ("%zu: %s: size == %zu: OK\n", cnt, tests[cnt].fmt, size);
free (buf); free (buf);
} }

View File

@ -20,7 +20,7 @@ main (void)
pchar = setlocale (LC_ALL, "de_DE.UTF-8"); pchar = setlocale (LC_ALL, "de_DE.UTF-8");
printf ("locale : %s\n",pchar); printf ("locale : %s\n",pchar);
printf ("MB_CUR_MAX %Zd\n", MB_CUR_MAX); printf ("MB_CUR_MAX %zd\n", MB_CUR_MAX);
puts ("---- test 1 ------"); puts ("---- test 1 ------");
test = mbstowcs (tmp, str, (strlen (str) + 1) * sizeof (char)); test = mbstowcs (tmp, str, (strlen (str) + 1) * sizeof (char));