summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Dilger <adilger@dilger.ca>2013-12-15 22:09:24 -0500
committerTheodore Ts'o <tytso@mit.edu>2013-12-15 22:10:09 -0500
commit3a941bef3b9036ca3db9d510c71bcae801ea4dd1 (patch)
tree0316a15c1a7011f8c2e79009bdaa6aac4422ead0
parent66457fcb842300e757a69c49c2eb4d8e335be34c (diff)
downloade2fsprogs-3a941bef3b9036ca3db9d510c71bcae801ea4dd1.tar.gz
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>
-rw-r--r--.gitignore1
-rwxr-xr-xconfig/parse-types.sh27
-rw-r--r--lib/blkid/blkid_types.h.in16
-rw-r--r--lib/ext2fs/ext2_types.h.in16
-rw-r--r--lib/uuid/gen_uuid.c5
-rw-r--r--lib/uuid/tst_uuid.c2
-rw-r--r--lib/uuid/uuid_time.c2
-rw-r--r--misc/findsuper.c4
-rw-r--r--po/cs.po8
-rw-r--r--po/es.po12
-rw-r--r--po/fr.po12
-rw-r--r--po/it.po12
-rw-r--r--po/tr.po12
13 files changed, 69 insertions, 60 deletions
diff --git a/.gitignore b/.gitignore
index 328df77c..b243fc22 100644
--- a/.gitignore
+++ b/.gitignore
@@ -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
diff --git a/config/parse-types.sh b/config/parse-types.sh
index 00371ff9..5076f6ca 100755
--- a/config/parse-types.sh
+++ b/config/parse-types.sh
@@ -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;
diff --git a/lib/blkid/blkid_types.h.in b/lib/blkid/blkid_types.h.in
index cb5b10d5..2edc0dad 100644
--- a/lib/blkid/blkid_types.h.in
+++ b/lib/blkid/blkid_types.h.in
@@ -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 */
diff --git a/lib/ext2fs/ext2_types.h.in b/lib/ext2fs/ext2_types.h.in
index aa7ca3a9..5b98f715 100644
--- a/lib/ext2fs/ext2_types.h.in
+++ b/lib/ext2fs/ext2_types.h.in
@@ -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 */
diff --git a/lib/uuid/gen_uuid.c b/lib/uuid/gen_uuid.c
index efa4e3d3..1b23d112 100644
--- a/lib/uuid/gen_uuid.c
+++ b/lib/uuid/gen_uuid.c
@@ -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");
diff --git a/lib/uuid/tst_uuid.c b/lib/uuid/tst_uuid.c
index 22169703..33fb80b9 100644
--- a/lib/uuid/tst_uuid.c
+++ b/lib/uuid/tst_uuid.c
@@ -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) {
diff --git a/lib/uuid/uuid_time.c b/lib/uuid/uuid_time.c
index 4c3536b4..97fd3358 100644
--- a/lib/uuid/uuid_time.c
+++ b/lib/uuid/uuid_time.c
@@ -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;
diff --git a/misc/findsuper.c b/misc/findsuper.c
index 6b5e16fc..eb9130ba 100644
--- a/misc/findsuper.c
+++ b/misc/findsuper.c
@@ -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"));
diff --git a/po/cs.po b/po/cs.po
index 2ea495ef..e38629dd 100644
--- a/po/cs.po
+++ b/po/cs.po
@@ -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"
diff --git a/po/es.po b/po/es.po
index b9be136b..bb43ba7f 100644
--- a/po/es.po
+++ b/po/es.po
@@ -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)"
diff --git a/po/fr.po b/po/fr.po
index 69c13d44..cccd69e8 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -6774,21 +6774,21 @@ msgstr "Valeur magique invalide dans profile_file_data_t"
#~ msgid "startkb should be a number, not %s\n"
#~ msgstr "dbut en Ko doit tre un nombre, non pas %s\n"
-#~ msgid "startkb should be positive, not %Ld\n"
-#~ msgstr "dbut en Ko doit tre positif, non pas %Ld\n"
+#~ msgid "startkb should be positive, not %lld\n"
+#~ msgstr "dbut en Ko doit tre positif, non pas %lld\n"
-#~ msgid "starting at %Ld, with %d byte increments\n"
-#~ msgstr "dbut %Ld, avec un incrment de %d octets\n"
+#~ msgid "starting at %lld, with %d byte increments\n"
+#~ msgstr "dbut %lld, avec un incrment 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"
diff --git a/po/it.po b/po/it.po
index 7ba7d71b..48a0b006 100644
--- a/po/it.po
+++ b/po/it.po
@@ -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)"
diff --git a/po/tr.po b/po/tr.po
index 69d67879..e52bcf3b 100644
--- a/po/tr.po
+++ b/po/tr.po
@@ -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"