summaryrefslogtreecommitdiff
path: root/libc/malloc_hooks/tests/malloc_hooks_tests.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2017-09-08 16:52:59 -0700
committerElliott Hughes <enh@google.com>2017-09-11 13:21:35 -0700
commit4c0803d16504079f58c85f88f376c0d3842004c5 (patch)
tree82867b5f77ff846ec863f388c908898b8c0577ee /libc/malloc_hooks/tests/malloc_hooks_tests.cpp
parent60103831eb96217983e9e98fc4ec88ae9f48a7c6 (diff)
Cast __builtin_swap64 to uint64_t.
strace 4.19 causes clang to emit a questionable warning: external/strace/nlattr.c:254:35: error: format specifies type 'unsigned long' but the argument has type 'unsigned long long' [-Werror,-Wformat] tprintf("htobe64(%" PRIu64 ")", be64toh(num)); ~~~ ^~~~~~~~~~~~ bionic/libc/include/sys/endian.h:100:20: note: expanded from macro 'be64toh' #define be64toh(x) htobe64(x) ^~~~~~~~~~ bionic/libc/include/sys/endian.h:80:17: note: expanded from macro 'htobe64' #define htobe64 __swap64 ^ bionic/libc/include/sys/endian.h:48:18: note: expanded from macro '__swap64' #define __swap64 __builtin_bswap64 ^ What's happened here is: * be64toh is __builtin_bswap64 * PRIu64 is "lu" * __builtin_bswap64 is internally declared a "ULLiULLi" All of which leads to the `unsigned long` != `unsigned long long` complaint. It seems like __builtin_bswap64 should be ULiULi on 64-bit architectures, where `long` rather than `long long` is the natural way to refer to 64-bit types, as evidenced by the "lu" for PRIu64. As long as clang behaves like this, though, we can work around it with a cast. Also clean up the other casts in the file, be more consistent about whether these function-like macros are defined with an argument, and remove an incorrect comment. Bug: http://b/65495954 Test: ran tests, built strace 4.19 without warnings Change-Id: I8e06d4bf71e95d62f556eab8661033e04d487e0d
Diffstat (limited to 'libc/malloc_hooks/tests/malloc_hooks_tests.cpp')
0 files changed, 0 insertions, 0 deletions