libc fortify: warn on open() with useless mode bits

Bug: 64132680
Test: checkbuild on bullhead internal master; no new CtsBionicTestCases
fail.

Change-Id: I98762bbee0ecdd7b4ffc21135992f2eed320317f
diff --git a/tests/fortify_compilation_test.cpp b/tests/fortify_compilation_test.cpp
index bf577f6..aff587a 100644
--- a/tests/fortify_compilation_test.cpp
+++ b/tests/fortify_compilation_test.cpp
@@ -222,6 +222,12 @@
   // GCC: error: call to '__creat_too_many_args' declared with attribute error: too many arguments
   // CLANG: error: call to unavailable function 'open': too many arguments
   open("/dev/null", O_CREAT, 0, 0);
+
+  // CLANG: warning: 'open' has superfluous mode bits; missing O_CREAT?
+  open("/dev/null", O_RDONLY, 0644);
+
+  // CLANG: warning: 'open' has superfluous mode bits; missing O_CREAT?
+  open("/dev/null", O_DIRECTORY, 0644);
 }
 
 void test_poll() {