aboutsummaryrefslogtreecommitdiffstats
path: root/tests/fortify1_test_clang.cpp
diff options
context:
space:
mode:
authorNick Kralevich <nnk@google.com>2013-06-19 10:36:55 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-06-19 10:36:55 -0700
commit1d174a9c17f645a27d766a66e7477d797f955e90 (patch)
treeebbc0d1631a82affe3b4d59d00d0178d7064d8ed /tests/fortify1_test_clang.cpp
parentf4250508d5de415e200888ffdf143f870dc0f829 (diff)
parent02ca0e314219a4c7205a180a414c509651043f13 (diff)
downloadandroid_bionic-1d174a9c17f645a27d766a66e7477d797f955e90.tar.gz
android_bionic-1d174a9c17f645a27d766a66e7477d797f955e90.tar.bz2
android_bionic-1d174a9c17f645a27d766a66e7477d797f955e90.zip
am 02ca0e31: Merge "Fix FORTIFY_SOURCE unittests."
* commit '02ca0e314219a4c7205a180a414c509651043f13': Fix FORTIFY_SOURCE unittests.
Diffstat (limited to 'tests/fortify1_test_clang.cpp')
-rw-r--r--tests/fortify1_test_clang.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/fortify1_test_clang.cpp b/tests/fortify1_test_clang.cpp
index 2a1b8a7d1..0c0fb2bef 100644
--- a/tests/fortify1_test_clang.cpp
+++ b/tests/fortify1_test_clang.cpp
@@ -289,10 +289,14 @@ TEST(Fortify1_Clang, strcat2) {
__BIONIC_FORTIFY_INLINE
size_t test_fortify_inline(char* buf) {
- return __bos(buf);
+ return __bos(buf);
}
TEST(Fortify1_Clang, fortify_inline) {
char buf[1024];
- ASSERT_EQ(test_fortify_inline(buf), sizeof(buf));
+ // no-op. Prints nothing. Needed to prevent the compiler
+ // from optimizing out buf.
+ buf[0] = '\0';
+ printf("%s", buf);
+ ASSERT_EQ(sizeof(buf), test_fortify_inline(buf));
}