libc fortify: make unistd.h use diagnose_if
Also:
- remove a NULL check. The bug that's been working around has been
fixed since clang r298431, and our compiler is built from r300080, and
- unwrap some function prototypes, per b/36984245.
If you're interested, here's what a new error versus an old one looks
like: https://drive.google.com/file/d/0B-8OBPboNJ_4MVdlYXdJbUFBYUk/view
Bug: 12231437
Test: m checkbuild on bullhead internal master; CtsBionicTestCases show
no new failures.
Change-Id: Ibafe61198988b4c8bee8391bcdf01bcbc04233de
diff --git a/tests/fortify_compilation_test.cpp b/tests/fortify_compilation_test.cpp
index 51074b2..bb2b770 100644
--- a/tests/fortify_compilation_test.cpp
+++ b/tests/fortify_compilation_test.cpp
@@ -199,7 +199,7 @@
char buf[4];
// NOLINTNEXTLINE(whitespace/line_length)
// GCC: error: call to '__read_dest_size_error' declared with attribute error: read called with size bigger than destination
- // CLANG: error: call to unavailable function 'read': 'count' bytes overflows the given object
+ // CLANG: error: in call to 'read', 'count' bytes overflows the given object
read(0, buf, 6);
}
@@ -268,7 +268,7 @@
char buf[4];
// NOLINTNEXTLINE(whitespace/line_length)
// GCC: error: call to '__getcwd_dest_size_error' declared with attribute error: getcwd called with size bigger than destination
- // CLANG: error: call to unavailable function 'getcwd': 'size' bytes overflows the given object
+ // CLANG: error: in call to 'getcwd', 'size' bytes overflows the given object
getcwd(buf, 5);
}
@@ -276,7 +276,7 @@
char buf[4] = {0};
// NOLINTNEXTLINE(whitespace/line_length)
// GCC: error: call to '__pwrite64_dest_size_error' declared with attribute error: pwrite64 called with size bigger than destination
- // CLANG: error: call to unavailable function 'pwrite64': 'count' bytes overflows the given object
+ // CLANG: error: in call to 'pwrite64', 'count' bytes overflows the given object
pwrite64(STDOUT_FILENO, buf, 5, 0);
}
@@ -292,7 +292,7 @@
char buf[4] = {0};
// NOLINTNEXTLINE(whitespace/line_length)
// GCC: error: call to '__pwrite64_count_toobig_error' declared with attribute error: pwrite64 called with count > SSIZE_MAX
- // CLANG: error: call to unavailable function 'pwrite64': count must be <= SSIZE_MAX
+ // CLANG: error: in call to 'pwrite64', 'count' must be <= SSIZE_MAX
pwrite64(STDOUT_FILENO, buf, SIZE_MAX, 0);
}
@@ -300,7 +300,7 @@
char buf[4] = {0};
// NOLINTNEXTLINE(whitespace/line_length)
// GCC: error: call to '__write_dest_size_error' declared with attribute error: write called with size bigger than destination
- // CLANG: error: call to unavailable function 'write': 'count' bytes overflows the given object
+ // CLANG: error: in call to 'write', 'count' bytes overflows the given object
write(STDOUT_FILENO, buf, 5);
}