versioner: replace availability attributes with annotate.

Major refactor to use __attribute__((annotate)) to be able to keep
track of the semantic differences between __INTRODUCED_IN(x) and
__INTRODUCED_IN_X86(x), for use in the upcoming preprocessor.

Bug: http://b/30170081
Change-Id: I6496a8c40ba7f4553de9a2be0bbddcf37c813937
diff --git a/libc/include/android/versioning.h b/libc/include/android/versioning.h
new file mode 100644
index 0000000..3686261
--- /dev/null
+++ b/libc/include/android/versioning.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_VERSIONING_H
+#define ANDROID_VERSIONING_H
+
+#define __INTRODUCED_IN(api_level) __attribute__((annotate("introduced_in=" #api_level)))
+#define __INTRODUCED_IN_FUTURE __attribute__((annotate("introduced_in_future")))
+#define __DEPRECATED_IN(api_level) __attribute__((annotate("deprecated_in=" #api_level)))
+#define __REMOVED_IN(api_level) __attribute__((annotate("obsoleted_in=" #api_level)))
+#define __INTRODUCED_IN_32(api_level) __attribute__((annotate("introduced_in_32=" #api_level)))
+#define __INTRODUCED_IN_64(api_level) __attribute__((annotate("introduced_in_64=" #api_level)))
+#define __INTRODUCED_IN_ARM(api_level) __attribute__((annotate("introduced_in_arm=" #api_level)))
+#define __INTRODUCED_IN_X86(api_level) __attribute__((annotate("introduced_in_x86=" #api_level)))
+#define __INTRODUCED_IN_MIPS(api_level) __attribute__((annotate("introduced_in_mips=" #api_level)))
+
+#endif /* ANDROID_VERSIONING_H */
diff --git a/libc/include/sys/cdefs.h b/libc/include/sys/cdefs.h
index 4d1e34c..1174e79 100644
--- a/libc/include/sys/cdefs.h
+++ b/libc/include/sys/cdefs.h
@@ -279,43 +279,7 @@
 /* Used to rename functions so that the compiler emits a call to 'x' rather than the function this was applied to. */
 #define __RENAME(x) __asm__(#x)
 
-#ifdef __clang__
-#define __AVAILABILITY(...) __attribute__((availability(android,__VA_ARGS__)))
-#else
-#define __AVAILABILITY(...)
-#endif
-
-#define __INTRODUCED_IN(api_level) __AVAILABILITY(introduced=api_level)
-#define __DEPRECATED_IN(api_level) __AVAILABILITY(deprecated=api_level)
-#define __REMOVED_IN(api_level) __AVAILABILITY(obsoleted=api_level)
-
-#define __INTRODUCED_IN_FUTURE __INTRODUCED_IN(10000)
-
-#if __LP64__
-#define __INTRODUCED_IN_32(api_level)
-#define __INTRODUCED_IN_64 __INTRODUCED_IN
-#else
-#define __INTRODUCED_IN_32 __INTRODUCED_IN
-#define __INTRODUCED_IN_64(api_level)
-#endif
-
-#if defined(__arm__)
-#define __INTRODUCED_IN_ARM __INTRODUCED_IN
-#else
-#define __INTRODUCED_IN_ARM(x)
-#endif
-
-#if defined(__i386__)
-#define __INTRODUCED_IN_X86 __INTRODUCED_IN
-#else
-#define __INTRODUCED_IN_X86(x)
-#endif
-
-#if defined(__mips__)
-#define __INTRODUCED_IN_MIPS __INTRODUCED_IN
-#else
-#define __INTRODUCED_IN_MIPS(x)
-#endif
+#include <android/versioning.h>
 
 #if __has_builtin(__builtin_umul_overflow) || __GNUC__ >= 5
 #if __LP64__