Re: [PATCH] init warning
* David Champion wrote:
I hope I'm misremembering, but I'm pretty sure this is why you see a
fair amount of code that takes pains to use macros for its integer
I found out about these, too. However, I think we should provide a
fallback since it's IHMO not worth it to require C99 compatible
compilers just for a few printf statements being part of large file
Using the current code as fallback together with the SIZEOF_LONG==4
check, the attached patch only leaves me with warnings about format
modifiers not being C90 compatible but without argument size warnings in
32bit and 64bit compilation mode. This seems to be much better than cast
to the type we think is right and disallow the compiler to warn us we're
Does mutt support < C99? I don't remember.
Yes, it more or less even "requires" it since it adds -pedantic to the
arguments when configure detects gcc as compiler.
diff --git a/configure.ac b/configure.ac
@@ -88,10 +88,18 @@ AH_BOTTOM([/* fseeko portability defines
AH_BOTTOM([/* fseeko portability defines */
# define LOFF_T off_t
-# if SIZEOF_OFF_T == 8
-# define OFF_T_FMT "%lld"
+# if HAVE_C99_INTTYPES
+# if SIZEOF_OFF_T == 8
+# define OFF_T_FMT "%" PRId64
+# define OFF_T_FMT "%" PRId32
-# define OFF_T_FMT "%ld"
+# if (SIZEOF_OFF_T == 8) && (SIZEOF_LONG == 4)
+# define OFF_T_FMT "%lld"
+# define OFF_T_FMT "%ld"
# define LOFF_T long
diff --git a/m4/types.m4 b/m4/types.m4
@@ -10,11 +10,11 @@ AC_DEFUN([MUTT_C99_INTTYPES],
- [AC_DEFINE(HAVE_C99_INTTYPES, 1, [Define if you have the C99 integer
- AC_CHECK_SIZEOF(long long)])
+ [AC_DEFINE(HAVE_C99_INTTYPES, 1, [Define if you have the C99 integer
# if SIZEOF_SHORT == 4
@@ -33,4 +33,3 @@ typedef unsigned long long uint64_t;