summaryrefslogtreecommitdiffstats
path: root/tests/libc_logging_test.cpp
diff options
context:
space:
mode:
authorStephen Hines <srhines@google.com>2013-10-11 16:03:21 -0700
committerStephen Hines <srhines@google.com>2013-10-11 16:20:08 -0700
commit6c7b3cb056509fd8756bc012878a499f6f102114 (patch)
tree1a3c40a59049e259c3c5c226d4f1359089f6f8ca /tests/libc_logging_test.cpp
parenteda2679e30b997d036e0ec572cda054adc2ac3a6 (diff)
downloadbionic-6c7b3cb056509fd8756bc012878a499f6f102114.zip
bionic-6c7b3cb056509fd8756bc012878a499f6f102114.tar.gz
bionic-6c7b3cb056509fd8756bc012878a499f6f102114.tar.bz2
Fix clang warnings in bionic.
This fixes a few diverse issues that clang warns on in bionic. First, it specifies the appropriate converted types for format specifiers. The "h" and "hh" modifiers specify that the user is passing a short or char respectively. We were passing int deliberately in both cases and relying on the compiler to implicitly downcast to the smaller type. We also remove the non-standard "d" suffix from our double-precision floating point constant. This is an extension for gcc that clang does not implement. The third fix is to mark the c1 variable as unused, since it truly is neither read nor written. Change-Id: I4793352b9d3e58f1f4cac9e7581ef4b2a70b43c7
Diffstat (limited to 'tests/libc_logging_test.cpp')
-rw-r--r--tests/libc_logging_test.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/libc_logging_test.cpp b/tests/libc_logging_test.cpp
index d9c615e..5b10ce3 100644
--- a/tests/libc_logging_test.cpp
+++ b/tests/libc_logging_test.cpp
@@ -53,10 +53,10 @@ TEST(libc_logging, smoke) {
__libc_format_buffer(buf, sizeof(buf), "a%db", -8123);
EXPECT_STREQ("a-8123b", buf);
- __libc_format_buffer(buf, sizeof(buf), "a%hdb", 0x7fff0010);
+ __libc_format_buffer(buf, sizeof(buf), "a%hdb", static_cast<short>(0x7fff0010));
EXPECT_STREQ("a16b", buf);
- __libc_format_buffer(buf, sizeof(buf), "a%hhdb", 0x7fffff10);
+ __libc_format_buffer(buf, sizeof(buf), "a%hhdb", static_cast<char>(0x7fffff10));
EXPECT_STREQ("a16b", buf);
__libc_format_buffer(buf, sizeof(buf), "a%lldb", 0x1000000000LL);