diff options
author | Dan Albert <danalbert@google.com> | 2017-07-26 14:09:45 -0700 |
---|---|---|
committer | Dan Albert <danalbert@google.com> | 2017-07-27 16:32:01 -0700 |
commit | 5f7135eddd40d290d2bc4d0e819a6276bc4b8a24 (patch) | |
tree | a082dbb4c6fe86b4f10f67f4f01a1b407fbe50bf /libc/include/stdio.h | |
parent | 93068895091ee516c55a7873a4056145a7da3644 (diff) |
Allow calling v?dprintf for any target API level.
Old versions of Android called these fdprintf and vfdprintf out of
fears that the glibc names would collide with user debug printfs.
Allow users to just use dprintf and vfdprintf on any version by
renaming those calls to their legacy equivalents if needed.
Test: built trivial NDK module targeting android-14 and using dprintf
Test: make checkbuild
Bug: https://github.com/android-ndk/ndk/issues/72
Change-Id: I90de149278f931380418536abaef47c5cee5c195
Diffstat (limited to 'libc/include/stdio.h')
-rw-r--r-- | libc/include/stdio.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libc/include/stdio.h b/libc/include/stdio.h index ca5643744..b103990d6 100644 --- a/libc/include/stdio.h +++ b/libc/include/stdio.h @@ -151,8 +151,20 @@ int ungetc(int, FILE *); int vfprintf(FILE * __restrict, const char * __restrict _Nonnull, __va_list) __printflike(2, 0); int vprintf(const char * __restrict _Nonnull, __va_list) __printflike(1, 0); +#if __ANDROID_API__ >= 21 int dprintf(int, const char* __restrict _Nonnull, ...) __printflike(2, 3) __INTRODUCED_IN(21); int vdprintf(int, const char* __restrict _Nonnull, __va_list) __printflike(2, 0) __INTRODUCED_IN(21); +#else +/* + * Old versions of Android called these fdprintf and vfdprintf out of fears that the glibc names + * would collide with user debug printfs. + * + * Allow users to just use dprintf and vfdprintf on any version by renaming those calls to their + * legacy equivalents if needed. + */ +int dprintf(int, const char* __restrict _Nonnull, ...) __printflike(2, 3) __RENAME(fdprintf); +int vdprintf(int, const char* __restrict _Nonnull, __va_list) __printflike(2, 0) __RENAME(vfdprintf); +#endif #if (defined(__STDC_VERSION__) && __STDC_VERSION__ < 201112L) || \ (defined(__cplusplus) && __cplusplus <= 201103L) |