OSDN Git Service

Fix test compile errors after LLVM rebase
authorYi Kong <yikong@google.com>
Sun, 30 Apr 2017 22:08:05 +0000 (15:08 -0700)
committerYi Kong <yikong@google.com>
Tue, 2 May 2017 21:14:42 +0000 (21:14 +0000)
After the new rebase of Clang, we now support the alloc_size attribute,
so we can remove the warning about switching to alloc_size once Clang
has support.

Also fix an issue where 'false' is returned in a main method.

Test: make cts
Bug: 37752547
Change-Id: I32ee814aaa0338567cb8174a68d7ee1bfece2f75

tests/fortify_test.cpp
tests/libs/bionic_tests_zipalign.cpp

index 67103e1..2835f1d 100644 (file)
@@ -407,11 +407,8 @@ TEST_F(DEATHTEST, sprintf_fortified) {
   ASSERT_FORTIFY(sprintf(buf, "%s", source_buf));
 }
 
-#ifdef __clang__
-// Exists upstream, but hasn't been pulled in yet.
-#if __has_attribute(alloc_size)
-#error "Reenable this test"
-#endif
+#ifdef __clang__ && !__has_attribute(alloc_size)
+// TODO: remove this after Clang prebuilt rebase.
 #else
 // This test is disabled in clang because clang doesn't properly detect
 // this buffer overflow. TODO: Fix clang.
index 8e31474..56183ba 100644 (file)
@@ -142,7 +142,7 @@ int main(int argc, char* argv[]) {
   if (return_value != 0) {
     CloseArchive(handle);
     fprintf(stderr, "Unable to open '%s': %s\n", argv[2], ErrorCodeString(return_value));
-    return false;
+    return 1;
   }
 
   FILE* zip_dst = fopen(argv[3], "we");