Use clang's nullability instead of nonnull.

http://clang.llvm.org/docs/AttributeReference.html#nonnull

_Nonnull is similar to the nonnull attribute in that it will instruct
compilers to warn the user if it can prove that a null argument is
being passed. Unlike the nonnull attribute, this annotation indicated
that a value *should not* be null, not that it *cannot* be null, or
even that the behavior is undefined. The important distinction is that
the optimizer will perform surprising optimizations like the
following:

    void foo(void*) __attribute__(nonnull, 1);

    int bar(int* p) {
      foo(p);

      // The following null check will be elided because nonnull
      // attribute means that, since we call foo with p, p can be
      // assumed to not be null. Thus this will crash if we are called
      // with a null pointer.
      if (src != NULL) {
        return *p;
      }
      return 0;
    }

    int main() {
      return bar(NULL);
    }

Note that by doing this we are no longer attaching any sort of
attribute for GCC (GCC doesn't support attaching nonnull directly to a
parameter, only to the function and naming the arguments
positionally). This means we won't be getting a warning for this case
from GCC any more. People that listen to warnings tend to use clang
anyway, and we're quickly moving toward that as the default, so this
seems to be an acceptable tradeoff.

Change-Id: Ie05fe7cec2f19a082c1defb303f82bcf9241b88d
diff --git a/tests/pthread_test.cpp b/tests/pthread_test.cpp
index d9b2523..52a3252 100755
--- a/tests/pthread_test.cpp
+++ b/tests/pthread_test.cpp
@@ -1780,7 +1780,14 @@
 
 TEST(pthread, pthread_mutex_lock_null_32) {
 #if defined(__BIONIC__) && !defined(__LP64__)
-  ASSERT_EQ(EINVAL, pthread_mutex_lock(NULL));
+  // For LP32, the pthread lock/unlock functions allow a NULL mutex and return
+  // EINVAL in that case: http://b/19995172.
+  //
+  // We decorate the public defintion with _Nonnull so that people recompiling
+  // their code with get a warning and might fix their bug, but need to pass
+  // NULL here to test that we remain compatible.
+  pthread_mutex_t* null_value = nullptr;
+  ASSERT_EQ(EINVAL, pthread_mutex_lock(null_value));
 #else
   GTEST_LOG_(INFO) << "This test tests bionic implementation details on 32 bit devices.";
 #endif
@@ -1788,7 +1795,14 @@
 
 TEST(pthread, pthread_mutex_unlock_null_32) {
 #if defined(__BIONIC__) && !defined(__LP64__)
-  ASSERT_EQ(EINVAL, pthread_mutex_unlock(NULL));
+  // For LP32, the pthread lock/unlock functions allow a NULL mutex and return
+  // EINVAL in that case: http://b/19995172.
+  //
+  // We decorate the public defintion with _Nonnull so that people recompiling
+  // their code with get a warning and might fix their bug, but need to pass
+  // NULL here to test that we remain compatible.
+  pthread_mutex_t* null_value = nullptr;
+  ASSERT_EQ(EINVAL, pthread_mutex_unlock(null_value));
 #else
   GTEST_LOG_(INFO) << "This test tests bionic implementation details on 32 bit devices.";
 #endif