]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
build: use long long for __u64 by default
authorAndreas Dilger <adilger@dilger.ca>
Mon, 16 Dec 2013 03:09:24 +0000 (22:09 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 16 Dec 2013 03:10:09 +0000 (22:10 -0500)
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>
13 files changed:
.gitignore
config/parse-types.sh
lib/blkid/blkid_types.h.in
lib/ext2fs/ext2_types.h.in
lib/uuid/gen_uuid.c
lib/uuid/tst_uuid.c
lib/uuid/uuid_time.c
misc/findsuper.c
po/cs.po
po/es.po
po/fr.po
po/it.po
po/tr.po

index 328df77c89345aa55a6381d03b7f23fd85b508b7..b243fc224034f5c3cc0e45d5419dc7cc1d90a932 100644 (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
index 00371ff947c080b70f89584a45871b8bc40a3ecb..5076f6ca8d55ef11e9a4eec4d0f5345be47d500e 100755 (executable)
@@ -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;
index cb5b10d522e9299250bed12ec6c5c76b25a6f7a3..2edc0dad6083ce804d6a1b4ca093746d53996f2f 100644 (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 */
 
index aa7ca3a9c5f52aa892b680db026df56ea5280332..5b98f71550915a0bcca2979269e6f5cdee1bdb36 100644 (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 */
index efa4e3d3dd16586f3279c28d36f4fc84873f40f2..1b23d112a11997cbc7cb8e69fa2c97c033ee767d 100644 (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");
index 22169703c35fcc5cd2b51d05629608b03565974f..33fb80b9e2885f5e4fe4e6b404aa9062a61ba1d6 100644 (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) {
index 4c3536b479485cae5da81b01a5a0915d972fa5b7..97fd33588276b0543278af2e4357ccd3ae661ea5 100644 (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;
index 6b5e16fc1cdd1c775dd95440fd0c8bb34ab33d49..eb9130baa7cb70cedc3f591da2a62853da60a9e5 100644 (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"));
index 2ea495ef895d10b48fa6f84fb3eaf2e1894943c0..e38629dd93dbfc32d3aca0d46ff42514cfe6caed 100644 (file)
--- 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"
index b9be136b8252a49f69d2f2186e0f580e564930a2..bb43ba7f981bd9c515cc653eef70e9028c9c4d6e 100644 (file)
--- 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)"
index 69c13d441571893ef92e89ed6fda3af71081ca22..cccd69e89281884a0c6d12fdb1c951b39e6aa257 100644 (file)
--- 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 "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"
index 7ba7d71b10a8740bcff43e96a78d8b7eb7e9669f..48a0b006d02314e6641ebed30d3a5cf48ec3d41e 100644 (file)
--- 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)"
index 69d67879fd3e52be411a57f15a76485945c555cf..e52bcf3bc7763be2060eea1ead4e28be3316e8d5 100644 (file)
--- 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"