Merge "Remove __nonnull (in favor of _Nonnull)."
This commit is contained in:
commit
3b4e11faa8
5 changed files with 38 additions and 67 deletions
|
@ -33,8 +33,8 @@
|
|||
|
||||
__BEGIN_DECLS
|
||||
|
||||
void error(int, int, const char*, ...) __printflike(3, 4) __INTRODUCED_IN(23);
|
||||
void error_at_line(int, int, const char*, unsigned int, const char*, ...) __printflike(5, 6)
|
||||
void error(int, int, const char* _Nonnull, ...) __printflike(3, 4) __INTRODUCED_IN(23);
|
||||
void error_at_line(int, int, const char*, unsigned int, const char* _Nonnull, ...) __printflike(5, 6)
|
||||
__INTRODUCED_IN(23);
|
||||
|
||||
extern void (*error_print_progname)(void) __INTRODUCED_IN(23);
|
||||
|
|
|
@ -105,13 +105,11 @@ int ferror(FILE *);
|
|||
int fflush(FILE *);
|
||||
int fgetc(FILE *);
|
||||
char *fgets(char * __restrict, int, FILE * __restrict);
|
||||
int fprintf(FILE * __restrict , const char * __restrict, ...)
|
||||
__printflike(2, 3);
|
||||
int fprintf(FILE * __restrict , const char * __restrict _Nonnull, ...) __printflike(2, 3);
|
||||
int fputc(int, FILE *);
|
||||
int fputs(const char * __restrict, FILE * __restrict);
|
||||
size_t fread(void * __restrict, size_t, size_t, FILE * __restrict);
|
||||
int fscanf(FILE * __restrict, const char * __restrict, ...)
|
||||
__scanflike(2, 3);
|
||||
int fscanf(FILE * __restrict, const char * __restrict _Nonnull, ...) __scanflike(2, 3);
|
||||
size_t fwrite(const void * __restrict, size_t, size_t, FILE * __restrict);
|
||||
int getc(FILE *);
|
||||
int getchar(void);
|
||||
|
@ -119,35 +117,28 @@ ssize_t getdelim(char** __restrict, size_t* __restrict, int, FILE* __restrict) _
|
|||
ssize_t getline(char** __restrict, size_t* __restrict, FILE* __restrict) __INTRODUCED_IN(18);
|
||||
|
||||
void perror(const char *);
|
||||
int printf(const char * __restrict, ...)
|
||||
__printflike(1, 2);
|
||||
int printf(const char * __restrict _Nonnull, ...) __printflike(1, 2);
|
||||
int putc(int, FILE *);
|
||||
int putchar(int);
|
||||
int puts(const char *);
|
||||
int remove(const char *);
|
||||
void rewind(FILE *);
|
||||
int scanf(const char * __restrict, ...)
|
||||
__scanflike(1, 2);
|
||||
int scanf(const char * __restrict _Nonnull, ...) __scanflike(1, 2);
|
||||
void setbuf(FILE * __restrict, char * __restrict);
|
||||
int setvbuf(FILE * __restrict, char * __restrict, int, size_t);
|
||||
int sscanf(const char * __restrict, const char * __restrict, ...)
|
||||
__scanflike(2, 3);
|
||||
int sscanf(const char * __restrict, const char * __restrict _Nonnull, ...) __scanflike(2, 3);
|
||||
int ungetc(int, FILE *);
|
||||
int vfprintf(FILE * __restrict, const char * __restrict, __va_list)
|
||||
__printflike(2, 0);
|
||||
int vprintf(const char * __restrict, __va_list)
|
||||
__printflike(1, 0);
|
||||
int vfprintf(FILE * __restrict, const char * __restrict _Nonnull, __va_list) __printflike(2, 0);
|
||||
int vprintf(const char * __restrict _Nonnull, __va_list) __printflike(1, 0);
|
||||
|
||||
int dprintf(int, const char* __restrict, ...) __printflike(2, 3) __INTRODUCED_IN(21);
|
||||
int vdprintf(int, const char* __restrict, __va_list) __printflike(2, 0) __INTRODUCED_IN(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);
|
||||
|
||||
#if __STDC_VERSION__ < 201112L
|
||||
char* gets(char*) __attribute__((deprecated("gets is unsafe, use fgets instead")));
|
||||
#endif
|
||||
int sprintf(char* __restrict, const char* __restrict, ...)
|
||||
__printflike(2, 3) __warnattr("sprintf is often misused; please use snprintf");
|
||||
int vsprintf(char* __restrict, const char* __restrict, __va_list)
|
||||
__printflike(2, 0) __warnattr("vsprintf is often misused; please use vsnprintf");
|
||||
int sprintf(char* __restrict, const char* __restrict _Nonnull, ...) __printflike(2, 3) __warnattr("sprintf is often misused; please use snprintf");
|
||||
int vsprintf(char* __restrict, const char* __restrict _Nonnull, __va_list) __printflike(2, 0) __warnattr("vsprintf is often misused; please use vsnprintf");
|
||||
char* tmpnam(char*) __attribute__((deprecated("tmpnam is unsafe, use mkstemp or tmpfile instead")));
|
||||
#if defined(__USE_BSD) || defined(__USE_GNU)
|
||||
#define P_tmpdir "/tmp/" /* deprecated */
|
||||
|
@ -203,11 +194,11 @@ FILE* freopen64(const char* __restrict, const char* __restrict, FILE* __restrict
|
|||
FILE* tmpfile(void);
|
||||
FILE* tmpfile64(void) __INTRODUCED_IN(24);
|
||||
|
||||
int snprintf(char* __restrict, size_t, const char* __restrict, ...) __printflike(3, 4);
|
||||
int vfscanf(FILE* __restrict, const char* __restrict, __va_list) __scanflike(2, 0);
|
||||
int vscanf(const char*, __va_list) __scanflike(1, 0);
|
||||
int vsnprintf(char* __restrict, size_t, const char* __restrict, __va_list) __printflike(3, 0);
|
||||
int vsscanf(const char* __restrict, const char* __restrict, __va_list) __scanflike(2, 0);
|
||||
int snprintf(char* __restrict, size_t, const char* __restrict _Nonnull, ...) __printflike(3, 4);
|
||||
int vfscanf(FILE* __restrict, const char* __restrict _Nonnull, __va_list) __scanflike(2, 0);
|
||||
int vscanf(const char* _Nonnull , __va_list) __scanflike(1, 0);
|
||||
int vsnprintf(char* __restrict, size_t, const char* __restrict _Nonnull, __va_list) __printflike(3, 0);
|
||||
int vsscanf(const char* __restrict _Nonnull, const char* __restrict _Nonnull, __va_list) __scanflike(2, 0);
|
||||
|
||||
#define L_ctermid 1024 /* size for ctermid() */
|
||||
char* ctermid(char*) __INTRODUCED_IN_FUTURE;
|
||||
|
@ -228,12 +219,12 @@ FILE* fmemopen(void*, size_t, const char*) __INTRODUCED_IN(23);
|
|||
FILE* open_memstream(char**, size_t*) __INTRODUCED_IN(23);
|
||||
|
||||
#if defined(__USE_BSD) || defined(__BIONIC__) /* Historically bionic exposed these. */
|
||||
int asprintf(char** __restrict, const char* __restrict, ...) __printflike(2, 3);
|
||||
int asprintf(char** __restrict, const char* __restrict _Nonnull, ...) __printflike(2, 3);
|
||||
char* fgetln(FILE* __restrict, size_t* __restrict);
|
||||
int fpurge(FILE*);
|
||||
void setbuffer(FILE*, char*, int);
|
||||
int setlinebuf(FILE*);
|
||||
int vasprintf(char** __restrict, const char* __restrict, __va_list) __printflike(2, 0);
|
||||
int vasprintf(char** __restrict, const char* __restrict _Nonnull, __va_list) __printflike(2, 0);
|
||||
void clearerr_unlocked(FILE*) __INTRODUCED_IN(23);
|
||||
int feof_unlocked(FILE*) __INTRODUCED_IN(23);
|
||||
int ferror_unlocked(FILE*) __INTRODUCED_IN(23);
|
||||
|
@ -262,16 +253,12 @@ __errordecl(__fwrite_overflow, "fwrite called with overflowing size * count");
|
|||
#if defined(__BIONIC_FORTIFY)
|
||||
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
__printflike(3, 0)
|
||||
int vsnprintf(char *dest, size_t size, const char *format, __va_list ap)
|
||||
{
|
||||
__printflike(3, 0) int vsnprintf(char* dest, size_t size, const char* _Nonnull format, __va_list ap) {
|
||||
return __builtin___vsnprintf_chk(dest, size, 0, __bos(dest), format, ap);
|
||||
}
|
||||
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
__printflike(2, 0)
|
||||
int vsprintf(char *dest, const char *format, __va_list ap)
|
||||
{
|
||||
__printflike(2, 0) int vsprintf(char* dest, const char* _Nonnull format, __va_list ap) {
|
||||
return __builtin___vsprintf_chk(dest, 0, __bos(dest), format, ap);
|
||||
}
|
||||
|
||||
|
@ -282,11 +269,8 @@ int vsprintf(char *dest, const char *format, __va_list ap)
|
|||
#endif
|
||||
#else
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
__printflike(3, 4)
|
||||
int snprintf(char *dest, size_t size, const char *format, ...)
|
||||
{
|
||||
return __builtin___snprintf_chk(dest, size, 0,
|
||||
__bos(dest), format, __builtin_va_arg_pack());
|
||||
__printflike(3, 4) int snprintf(char* dest, size_t size, const char* _Nonnull format, ...) {
|
||||
return __builtin___snprintf_chk(dest, size, 0, __bos(dest), format, __builtin_va_arg_pack());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -297,11 +281,8 @@ int snprintf(char *dest, size_t size, const char *format, ...)
|
|||
#endif
|
||||
#else
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
__printflike(2, 3)
|
||||
int sprintf(char *dest, const char *format, ...)
|
||||
{
|
||||
return __builtin___sprintf_chk(dest, 0,
|
||||
__bos(dest), format, __builtin_va_arg_pack());
|
||||
__printflike(2, 3) int sprintf(char* dest, const char* _Nonnull format, ...) {
|
||||
return __builtin___sprintf_chk(dest, 0, __bos(dest), format, __builtin_va_arg_pack());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@
|
|||
* // 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) {
|
||||
* if (p != NULL) {
|
||||
* return *p;
|
||||
* }
|
||||
* return 0;
|
||||
|
@ -156,10 +156,8 @@
|
|||
#define _Nonnull
|
||||
#endif
|
||||
|
||||
#define __nonnull(args) __attribute__((__nonnull__ args))
|
||||
|
||||
#define __printflike(x, y) __attribute__((__format__(printf, x, y))) __nonnull((x))
|
||||
#define __scanflike(x, y) __attribute__((__format__(scanf, x, y))) __nonnull((x))
|
||||
#define __printflike(x, y) __attribute__((__format__(printf, x, y)))
|
||||
#define __scanflike(x, y) __attribute__((__format__(scanf, x, y)))
|
||||
|
||||
/*
|
||||
* GNU C version 2.96 added explicit branch prediction so that
|
||||
|
|
|
@ -88,8 +88,8 @@ __BEGIN_DECLS
|
|||
void closelog(void);
|
||||
void openlog(const char*, int, int);
|
||||
int setlogmask(int);
|
||||
void syslog(int, const char*, ...) __printflike(2, 3);
|
||||
void vsyslog(int, const char*, va_list) __printflike(2, 0);
|
||||
void syslog(int, const char* _Nonnull, ...) __printflike(2, 3);
|
||||
void vsyslog(int, const char* _Nonnull, va_list) __printflike(2, 0);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
|
|
@ -68,29 +68,21 @@ struct abort_msg_t {
|
|||
};
|
||||
|
||||
// Formats a message to the log (priority 'fatal'), then aborts.
|
||||
__LIBC_HIDDEN__ __noreturn void __libc_fatal(const char* fmt, ...) __printflike(1, 2);
|
||||
__noreturn void __libc_fatal(const char* _Nonnull, ...) __printflike(1, 2);
|
||||
|
||||
// Formats a message to the log (priority 'fatal'), prefixed by "FORTIFY: ", then aborts.
|
||||
__LIBC_HIDDEN__ __noreturn void __fortify_fatal(const char* fmt, ...) __printflike(1, 2);
|
||||
__noreturn void __fortify_fatal(const char* _Nonnull, ...) __printflike(1, 2);
|
||||
|
||||
//
|
||||
// Formatting routines for the C library's internal debugging.
|
||||
// Unlike the usual alternatives, these don't allocate, and they don't drag in all of stdio.
|
||||
//
|
||||
|
||||
__LIBC_HIDDEN__ int __libc_format_buffer(char* buffer, size_t buffer_size, const char* format, ...)
|
||||
__printflike(3, 4);
|
||||
|
||||
__LIBC_HIDDEN__ int __libc_format_fd(int fd, const char* format, ...)
|
||||
__printflike(2, 3);
|
||||
|
||||
__LIBC_HIDDEN__ int __libc_format_log(int priority, const char* tag, const char* format, ...)
|
||||
__printflike(3, 4);
|
||||
|
||||
__LIBC_HIDDEN__ int __libc_format_log_va_list(int priority, const char* tag, const char* format,
|
||||
va_list ap);
|
||||
|
||||
__LIBC_HIDDEN__ int __libc_write_log(int priority, const char* tag, const char* msg);
|
||||
int __libc_format_buffer(char* _Nonnull buf, size_t size, const char* _Nonnull fmt, ...) __printflike(3, 4);
|
||||
int __libc_format_fd(int fd, const char* _Nonnull format , ...) __printflike(2, 3);
|
||||
int __libc_format_log(int pri, const char* _Nonnull tag, const char* _Nonnull fmt, ...) __printflike(3, 4);
|
||||
int __libc_format_log_va_list(int pri, const char* _Nonnull tag, const char* _Nonnull fmt, va_list ap);
|
||||
int __libc_write_log(int pri, const char* _Nonnull tag, const char* _Nonnull msg);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
|
Loading…
Reference in a new issue