diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2013-02-17 22:41:33 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2013-02-17 22:41:33 +0100 |
commit | c9d0fc0a63d5b425d6a4e9fedb4cb7a8e3129d6c (patch) | |
tree | bcc2a1faddb30ad9070ba07925653807753f31f5 /util.c | |
parent | 061217669b843f765992c57ea1de07293efa0f86 (diff) | |
download | strace-c9d0fc0a63d5b425d6a4e9fedb4cb7a8e3129d6c.tar.gz strace-c9d0fc0a63d5b425d6a4e9fedb4cb7a8e3129d6c.tar.bz2 strace-c9d0fc0a63d5b425d6a4e9fedb4cb7a8e3129d6c.tar.xz |
Remove broken HAVE_LONG_LONG conditionals
We use printllval without HAVE_LONG_LONG guards in many places,
but define it only if HAVE_LONG_LONG. This means that
on !HAVE_LONG_LONG systems we won't build for some time now.
* defs.h: Remove HAVE_LONG_LONG guard around LONG_LONG() macro
and printllval() function declaration.
* util.c: Remove HAVE_LONG_LONG guard around printllval()
function definition.
(printllval): Add compile-time error check for using wrong
if branch. Explain places where we deliberately use mismatched
types for printf formats.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 27 |
1 files changed, 18 insertions, 9 deletions
@@ -178,7 +178,6 @@ printxval(const struct xlat *xlat, int val, const char *dflt) tprintf("%#x /* %s */", val, dflt); } -#if HAVE_LONG_LONG /* * Print 64bit argument at position llarg and return the index of the next * argument. @@ -186,31 +185,41 @@ printxval(const struct xlat *xlat, int val, const char *dflt) int printllval(struct tcb *tcp, const char *format, int llarg) { -# if defined(X86_64) || defined(POWERPC64) +#if defined(X86_64) || defined(POWERPC64) if (current_personality == 0) { + /* Technically, format expects "long long", + * but we supply "long". We expect that + * on this arch, they are the same. + */ tprintf(format, tcp->u_arg[llarg]); llarg++; } else { -# ifdef POWERPC64 +# ifdef POWERPC64 /* Align 64bit argument to 64bit boundary. */ llarg = (llarg + 1) & 0x1e; -# endif +# endif tprintf(format, LONG_LONG(tcp->u_arg[llarg], tcp->u_arg[llarg + 1])); llarg += 2; } -# elif defined IA64 || defined ALPHA +#elif defined IA64 || defined ALPHA + /* Technically, format expects "long long", + * but we supply "long". We expect that + * on this arch, they are the same. + */ tprintf(format, tcp->u_arg[llarg]); llarg++; -# elif defined LINUX_MIPSN32 || defined X32 +#elif defined LINUX_MIPSN32 || defined X32 tprintf(format, tcp->ext_arg[llarg]); llarg++; -# else +#else +# if SIZEOF_LONG > 4 +# error BUG: must not combine two args for long long on this arch +# endif tprintf(format, LONG_LONG(tcp->u_arg[llarg], tcp->u_arg[llarg + 1])); llarg += 2; -# endif +#endif return llarg; } -#endif /* * Interpret `xlat' as an array of flags |