build: use long long for __u64 by default

Don't print a verbose configure error in parse-types.h if
<asm/types.h> missing and __[SU]*_TYPEDEF is unset.  This is
always the case for non-Linux builds.

The printf formatting strings all use "%llu" for printing 64-bit
values and this it produces a large number of warnings if __u64
is defined as "unsigned long".  If __U64_TYPEDEF isn't set use
"unsigned long long" for __u64 in ext2-types.h and blkid-types.h
by default instead of using "unsigned long".

Fix a few places where "%d" or "%u" or "%Lu" were used to print a
64-bit value, by converting them to use "%lld" or "%llu" instead.

Fix a few places where "%lu" was used to print .tv_usec, by casting
the variable to "(long)" since .tv_usec is "int" on some systems.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
debian-1.42.9
Andreas Dilger 2013-12-15 22:09:24 -05:00 committed by Theodore Ts'o
parent 66457fcb84
commit 3a941bef3b
13 changed files with 69 additions and 60 deletions

1
.gitignore vendored
View File

@ -183,6 +183,7 @@ misc/uuidd
misc/uuidd.8
misc/uuidgen
misc/uuidgen.1
parse-types.log
po/Makefile.in
po/POTFILES
public_config.h

View File

@ -16,8 +16,15 @@ if test -z "$CPP"; then
CPP="$CC -E"
fi
echo '#include <asm/types.h>' | $CPP - | \
sed -f sed.script | grep '^#' > asm_types.h
/bin/echo -n "checking for __uNN types... "
# can't check [ -f /usr/include/asm/types.h ] directly, since
# the include path might be different if cross-compiling
if echo '#include <asm/types.h>' | $CPP - 2> parse-types.log | \
sed -f sed.script | grep '^#' > asm_types.h; then
echo "using <asm/types.h>"
else
echo "using generic types"
fi
rm sed.script
@ -34,7 +41,7 @@ int main(int argc, char **argv)
(int) sizeof(__U8_TYPEDEF));
exit(1);
}
#else
#elif defined(__linux__)
#warning __U8_TYPEDEF not defined
#endif
#ifdef __S8_TYPEDEF
@ -43,7 +50,7 @@ int main(int argc, char **argv)
(int) sizeof(__S8_TYPEDEF));
exit(1);
}
#else
#elif defined(__linux__)
#warning __S8_TYPEDEF not defined
#endif
#ifdef __U16_TYPEDEF
@ -52,7 +59,7 @@ int main(int argc, char **argv)
(int) sizeof(__U16_TYPEDEF));
exit(1);
}
#else
#elif defined(__linux__)
#warning __U16_TYPEDEF not defined
#endif
#ifdef __S16_TYPEDEF
@ -61,7 +68,7 @@ int main(int argc, char **argv)
(int) sizeof(__S16_TYPEDEF));
exit(1);
}
#else
#elif defined(__linux__)
#warning __S16_TYPEDEF not defined
#endif
@ -71,7 +78,7 @@ int main(int argc, char **argv)
(int) sizeof(__U32_TYPEDEF));
exit(1);
}
#else
#elif defined(__linux__)
#warning __U32_TYPEDEF not defined
#endif
#ifdef __S32_TYPEDEF
@ -80,7 +87,7 @@ int main(int argc, char **argv)
(int) sizeof(__S32_TYPEDEF));
exit(1);
}
#else
#elif defined(__linux__)
#warning __S32_TYPEDEF not defined
#endif
@ -90,7 +97,7 @@ int main(int argc, char **argv)
(int) sizeof(__U64_TYPEDEF));
exit(1);
}
#else
#elif defined(__linux__)
#warning __U64_TYPEDEF not defined
#endif
#ifdef __S64_TYPEDEF
@ -99,7 +106,7 @@ int main(int argc, char **argv)
(int) sizeof(__S64_TYPEDEF));
exit(1);
}
#else
#elif defined(__linux__)
#warning __S64_TYPEDEF not defined
#endif
return 0;

View File

@ -92,13 +92,13 @@ typedef __U64_TYPEDEF __u64;
#if (@SIZEOF_INT@ == 8)
typedef unsigned int __u64;
#else
#if (@SIZEOF_LONG@ == 8)
typedef unsigned long __u64;
#else
#if (@SIZEOF_LONG_LONG@ == 8)
typedef unsigned long long __u64;
#endif /* SIZEOF_LONG_LONG == 8 */
#else
#if (@SIZEOF_LONG@ == 8)
typedef unsigned long __u64;
#endif /* SIZEOF_LONG == 8 */
#endif /* SIZEOF_LONG_LONG == 8 */
#endif /* SIZEOF_INT == 8 */
#endif /* __U64_TYPEDEF */
@ -108,17 +108,17 @@ typedef __S64_TYPEDEF __s64;
#if (@SIZEOF_INT@ == 8)
typedef int __s64;
#else
#if (@SIZEOF_LONG@ == 8)
typedef long __s64;
#else
#if (@SIZEOF_LONG_LONG@ == 8)
#if defined(__GNUC__)
typedef __signed__ long long __s64;
#else
typedef signed long long __s64;
#endif /* __GNUC__ */
#endif /* SIZEOF_LONG_LONG == 8 */
#else
#if (@SIZEOF_LONG@ == 8)
typedef long __s64;
#endif /* SIZEOF_LONG == 8 */
#endif /* SIZEOF_LONG_LONG == 8 */
#endif /* SIZEOF_INT == 8 */
#endif /* __S64_TYPEDEF */

View File

@ -92,11 +92,11 @@ typedef __U64_TYPEDEF __u64;
#if (@SIZEOF_INT@ == 8)
typedef unsigned int __u64;
#else
#if (@SIZEOF_LONG@ == 8)
typedef unsigned long __u64;
#else
#if (@SIZEOF_LONG_LONG@ == 8)
typedef unsigned long long __u64;
#else
#if (@SIZEOF_LONG@ == 8)
typedef unsigned long __u64;
#endif /* SIZEOF_LONG_LONG == 8 */
#endif /* SIZEOF_LONG == 8 */
#endif /* SIZEOF_INT == 8 */
@ -108,15 +108,15 @@ typedef __S64_TYPEDEF __s64;
#if (@SIZEOF_INT@ == 8)
typedef int __s64;
#else
#if (@SIZEOF_LONG@ == 8)
typedef long __s64;
#else
#if (@SIZEOF_LONG_LONG@ == 8)
#if defined(__GNUC__)
typedef __signed__ long long __s64;
typedef __signed__ long long __s64;
#else
typedef signed long long __s64;
typedef signed long long __s64;
#endif /* __GNUC__ */
#else
#if (@SIZEOF_LONG@ == 8)
typedef long __s64;
#endif /* SIZEOF_LONG_LONG == 8 */
#endif /* SIZEOF_LONG == 8 */
#endif /* SIZEOF_INT == 8 */

View File

@ -401,9 +401,10 @@ try_again:
if (state_fd > 0) {
rewind(state_f);
len = fprintf(state_f,
len = fprintf(state_f,
"clock: %04x tv: %016lu %08lu adj: %08d\n",
clock_seq, last.tv_sec, last.tv_usec, adjustment);
clock_seq, last.tv_sec, (long)last.tv_usec,
adjustment);
fflush(state_f);
if (ftruncate(state_fd, len) < 0) {
fprintf(state_f, " \n");

View File

@ -144,7 +144,7 @@ main(int argc ATTR((unused)) , char **argv ATTR((unused)))
tv.tv_usec = 0;
time_reg = uuid_time(buf, &tv);
printf("UUID generated at %lu reports %lu (%ld.%ld)\n",
time_gen, time_reg, tv.tv_sec, tv.tv_usec);
time_gen, time_reg, tv.tv_sec, (long)tv.tv_usec);
/* allow 1s margin in case of rollover between sampling
* the current time and when the UUID is generated. */
if (time_reg > time_gen + 1) {

View File

@ -165,7 +165,7 @@ main(int argc, char **argv)
printf("Warning: not a time-based UUID, so UUID time "
"decoding will likely not work!\n");
}
printf("UUID time is: (%ld, %ld): %s\n", tv.tv_sec, tv.tv_usec,
printf("UUID time is: (%ld, %ld): %s\n", tv.tv_sec, (long)tv.tv_usec,
ctime(&time_reg));
return 0;

View File

@ -172,7 +172,7 @@ int main(int argc, char *argv[])
optind++;
}
if (sk < 0) {
fprintf(stderr, _("startkb should be positive, not %Lu\n"), sk);
fprintf(stderr, _("startkb should be positive, not %llu\n"),sk);
exit(1);
}
@ -183,7 +183,7 @@ int main(int argc, char *argv[])
}
/* Now, go looking for the superblock! */
printf(_("starting at %Lu, with %u byte increments\n"), sk, skiprate);
printf(_("starting at %llu, with %u byte increments\n"), sk, skiprate);
if (print_jnl_copies)
printf(_("[*] probably superblock written in the ext3 "
"journal superblock,\n\tso start/end/grp wrong\n"));

View File

@ -6811,11 +6811,11 @@ msgstr "Chybné magické číslo v profile_file_data_t"
#~ msgid "startkb should be a number, not %s\n"
#~ msgstr "startkb by mělo být číslo, ne %s\n"
#~ msgid "startkb should be positive, not %Ld\n"
#~ msgstr "startkb by mělo být kladné, ne %Ld\n"
#~ msgid "startkb should be positive, not %lld\n"
#~ msgstr "startkb by mělo být kladné, ne %lld\n"
#~ msgid "starting at %Ld, with %d byte increments\n"
#~ msgstr "začínám na %Ld s přírůstky %d bajtů\n"
#~ msgid "starting at %lld, with %d byte increments\n"
#~ msgstr "začínám na %lld s přírůstky %d bajtů\n"
#~ msgid " thisoff block fs_blk_sz blksz grp last_mount\n"
#~ msgstr " tentopos blok fs_blk_sz blksz grp last_mount\n"

View File

@ -6997,21 +6997,21 @@ msgstr ""
#~ msgid "startkb should be a number, not %s\n"
#~ msgstr "principio debe ser un número, no %s\n"
#~ msgid "startkb should be positive, not %Ld\n"
#~ msgstr "principio debe ser positivo, no %Ld\n"
#~ msgid "startkb should be positive, not %lld\n"
#~ msgstr "principio debe ser positivo, no %lld\n"
#~ msgid "starting at %Ld, with %d byte increments\n"
#~ msgstr "se comienza en %Ld, con incrementos de %d bytes\n"
#~ msgid "starting at %lld, with %d byte increments\n"
#~ msgstr "se comienza en %lld, con incrementos de %d bytes\n"
#~ msgid " thisoff block fs_blk_sz blksz grp last_mount\n"
#~ msgstr " este bloque fs_blk_sz blksz grp ultimo_montado\n"
#~ msgid ""
#~ "\n"
#~ "%14Ld: finished with errno %d\n"
#~ "%14lld: finished with errno %d\n"
#~ msgstr ""
#~ "\n"
#~ "%14Ld: se finaliza con el error número %d\n"
#~ "%14lld: se finaliza con el error número %d\n"
#~ msgid "(unknown os)"
#~ msgstr "(so desconocido)"

View File

@ -6774,21 +6774,21 @@ msgstr "Valeur magique invalide dans profile_file_data_t"
#~ msgid "startkb should be a number, not %s\n"
#~ msgstr "début en Ko doit être un nombre, non pas %s\n"
#~ msgid "startkb should be positive, not %Ld\n"
#~ msgstr "début en Ko doit être positif, non pas %Ld\n"
#~ msgid "startkb should be positive, not %lld\n"
#~ msgstr "début en Ko doit être positif, non pas %lld\n"
#~ msgid "starting at %Ld, with %d byte increments\n"
#~ msgstr "début à %Ld, avec un incrément de %d octets\n"
#~ msgid "starting at %lld, with %d byte increments\n"
#~ msgstr "début à %lld, avec un incrément de %d octets\n"
#~ msgid " thisoff block fs_blk_sz blksz grp last_mount\n"
#~ msgstr " thisoff block fs_blk_sz blksz grp last_mount\n"
#~ msgid ""
#~ "\n"
#~ "%14Ld: finished with errno %d\n"
#~ "%14lld: finished with errno %d\n"
#~ msgstr ""
#~ "\n"
#~ "%14Ld: terminé avec errno %d\n"
#~ "%14lld: terminé avec errno %d\n"
#~ msgid ""
#~ "Usage: %s <dev1> <dev2> <dev3>\n"

View File

@ -6840,18 +6840,18 @@ msgstr ""
#~ msgid "startkb should be a number, not %s\n"
#~ msgstr "kb_inizio deve essere un numero, non %s\n"
#~ msgid "startkb should be positive, not %Ld\n"
#~ msgstr "kb_inizio deve essere positivo, non %Ld\n"
#~ msgid "startkb should be positive, not %lld\n"
#~ msgstr "kb_inizio deve essere positivo, non %lld\n"
#~ msgid "starting at %Ld, with %d byte increments\n"
#~ msgstr "inizio a %Ld, con incrementi di %d byte\n"
#~ msgid "starting at %lld, with %d byte increments\n"
#~ msgstr "inizio a %lld, con incrementi di %d byte\n"
#~ msgid ""
#~ "\n"
#~ "%14Ld: finished with errno %d\n"
#~ "%14lld: finished with errno %d\n"
#~ msgstr ""
#~ "\n"
#~ "%14Ld: terminato con errore numero %d\n"
#~ "%14lld: terminato con errore numero %d\n"
#~ msgid "(unknown os)"
#~ msgstr "(so sconosciuto)"

View File

@ -7141,21 +7141,21 @@ msgstr ""
#~ msgid "startkb should be a number, not %s\n"
#~ msgstr "başlangıç_kb bir sayı olmalı, %s değil\n"
#~ msgid "startkb should be positive, not %Ld\n"
#~ msgstr "başlangıç_kb poritif olmalı, %Ld değil\n"
#~ msgid "startkb should be positive, not %lld\n"
#~ msgstr "başlangıç_kb poritif olmalı, %lld değil\n"
#~ msgid "starting at %Ld, with %d byte increments\n"
#~ msgstr "%Ld de başlayıp %d bayt arttırımla\n"
#~ msgid "starting at %lld, with %d byte increments\n"
#~ msgstr "%lld de başlayıp %d bayt arttırımla\n"
#~ msgid " thisoff block fs_blk_sz blksz grp last_mount\n"
#~ msgstr " thisoff blok ds_blok_boyu blokboyu grup son_bağlama\n"
#~ msgid ""
#~ "\n"
#~ "%14Ld: finished with errno %d\n"
#~ "%14lld: finished with errno %d\n"
#~ msgstr ""
#~ "\n"
#~ "%14Ld: %d hatası ile bitti\n"
#~ "%14lld: %d hatası ile bitti\n"
#~ msgid "%s failed for %s: %s\n"
#~ msgstr "%s %s için başarısız: %s\n"