diff options
| author | joerg <joerg@NetBSD.org> | 2011-07-17 20:54:30 +0000 |
|---|---|---|
| committer | joerg <joerg@NetBSD.org> | 2011-07-17 20:54:30 +0000 |
| commit | 9f2c6cd595b50ba277a217ee608a101d3d113d35 (patch) | |
| tree | 48bfa748b8ec36787ffe9f9263fe65c2e1f9d796 /include | |
| parent | f5afb0db64b387453210f49892276268e8002bea (diff) | |
Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
Diffstat (limited to 'include')
| -rw-r--r-- | include/Makefile | 4 | ||||
| -rw-r--r-- | include/err.h | 19 | ||||
| -rw-r--r-- | include/nsswitch.h | 13 | ||||
| -rw-r--r-- | include/ssp/stdio.h | 6 | ||||
| -rw-r--r-- | include/stdio.h | 28 | ||||
| -rw-r--r-- | include/util.h | 8 | ||||
| -rw-r--r-- | include/varargs.h | 45 | ||||
| -rw-r--r-- | include/wchar.h | 21 |
8 files changed, 49 insertions, 95 deletions
diff --git a/include/Makefile b/include/Makefile index dd9ee69cab5..bc865ff3e3f 100644 --- a/include/Makefile +++ b/include/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.134 2011/03/24 17:05:42 bouyer Exp $ +# $NetBSD: Makefile,v 1.135 2011/07/17 20:54:34 joerg Exp $ # @(#)Makefile 8.2 (Berkeley) 1/4/94 # Doing a make includes builds /usr/include @@ -21,7 +21,7 @@ INCS= a.out.h aio.h ar.h assert.h atomic.h \ sgtty.h signal.h stab.h stdbool.h stddef.h stdio.h stdlib.h string.h \ strings.h stringlist.h struct.h sysexits.h tar.h time.h \ ttyent.h tzfile.h ucontext.h ulimit.h unistd.h util.h utime.h utmp.h \ - utmpx.h uuid.h varargs.h vis.h wchar.h wctype.h wordexp.h + utmpx.h uuid.h vis.h wchar.h wctype.h wordexp.h INCS+= arpa/ftp.h arpa/inet.h arpa/nameser.h arpa/nameser_compat.h \ arpa/telnet.h arpa/tftp.h INCS+= protocols/dumprestore.h protocols/routed.h protocols/rwhod.h \ diff --git a/include/err.h b/include/err.h index b29a9713d3c..7d6c8bf4bc2 100644 --- a/include/err.h +++ b/include/err.h @@ -1,4 +1,4 @@ -/* $NetBSD: err.h,v 1.15 2010/02/25 18:37:12 joerg Exp $ */ +/* $NetBSD: err.h,v 1.16 2011/07/17 20:54:34 joerg Exp $ */ /*- * Copyright (c) 1993 @@ -34,32 +34,25 @@ #ifndef _ERR_H_ #define _ERR_H_ -/* - * Don't use va_list in the err/warn prototypes. Va_list is typedef'd in two - * places (<machine/varargs.h> and <machine/stdarg.h>), so if we include one - * of them here we may collide with the utility's includes. It's unreasonable - * for utilities to have to include one of them to include err.h, so we get - * _BSD_VA_LIST_ from <machine/ansi.h> and use it. - */ -#include <machine/ansi.h> #include <sys/cdefs.h> +#include <stdarg.h> __BEGIN_DECLS __dead void err(int, const char *, ...) __printflike(2, 3) __dead; -__dead void verr(int, const char *, _BSD_VA_LIST_) +__dead void verr(int, const char *, va_list) __printflike(2, 0) __dead; __dead void errx(int, const char *, ...) __printflike(2, 3) __dead; -__dead void verrx(int, const char *, _BSD_VA_LIST_) +__dead void verrx(int, const char *, va_list) __printflike(2, 0) __dead; void warn(const char *, ...) __printflike(1, 2); -void vwarn(const char *, _BSD_VA_LIST_) +void vwarn(const char *, va_list) __printflike(1, 0); void warnx(const char *, ...) __printflike(1, 2); -void vwarnx(const char *, _BSD_VA_LIST_) +void vwarnx(const char *, va_list) __printflike(1, 0); __END_DECLS diff --git a/include/nsswitch.h b/include/nsswitch.h index d429b930602..405e097951b 100644 --- a/include/nsswitch.h +++ b/include/nsswitch.h @@ -1,4 +1,4 @@ -/* $NetBSD: nsswitch.h,v 1.20 2008/04/28 20:22:54 martin Exp $ */ +/* $NetBSD: nsswitch.h,v 1.21 2011/07/17 20:54:34 joerg Exp $ */ /*- * Copyright (c) 1997, 1998, 1999, 2004 The NetBSD Foundation, Inc. @@ -32,15 +32,8 @@ #ifndef _NSSWITCH_H #define _NSSWITCH_H 1 -/* - * Don't use va_list in prototypes. va_list is typedef'd in two places - * (<machine/varargs.h> and <machine/stdarg.h>), so if we include one of - * them here we may collide with the utility's includes. It's unreasonable - * for utilities to have to include one of them to include nsswitch.h, so - * we get _BSD_VA_LIST_ from <machine/ansi.h> and use it. - */ -#include <machine/ansi.h> #include <sys/types.h> +#include <stdarg.h> #define NSS_MODULE_INTERFACE_VERSION 0 @@ -108,7 +101,7 @@ /* * ns_dtab `callback' function signature. */ -typedef int (*nss_method)(void *, void *, _BSD_VA_LIST_); +typedef int (*nss_method)(void *, void *, va_list); /* * ns_dtab - `nsswitch dispatch table' diff --git a/include/ssp/stdio.h b/include/ssp/stdio.h index 28d8ace58de..b03bccaaf0b 100644 --- a/include/ssp/stdio.h +++ b/include/ssp/stdio.h @@ -1,4 +1,4 @@ -/* $NetBSD: stdio.h,v 1.4 2010/02/25 18:37:13 joerg Exp $ */ +/* $NetBSD: stdio.h,v 1.5 2011/07/17 20:54:34 joerg Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -37,13 +37,13 @@ __BEGIN_DECLS int __sprintf_chk(char *__restrict, int, size_t, const char *__restrict, ...) __printflike(4, 5); int __vsprintf_chk(char *__restrict, int, size_t, const char *__restrict, - _BSD_VA_LIST_) + __va_list) __printflike(4, 0); int __snprintf_chk(char *__restrict, size_t, int, size_t, const char *__restrict, ...) __printflike(5, 6); int __vsnprintf_chk(char *__restrict, size_t, int, size_t, - const char *__restrict, _BSD_VA_LIST_) + const char *__restrict, __va_list) __printflike(5, 0); char *__gets_chk(char *, size_t); char *__fgets_chk(char *, int, size_t, FILE *); diff --git a/include/stdio.h b/include/stdio.h index 31bdb049717..470070fdd04 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -1,4 +1,4 @@ -/* $NetBSD: stdio.h,v 1.78 2010/09/24 09:21:53 tnozaki Exp $ */ +/* $NetBSD: stdio.h,v 1.79 2011/07/17 20:54:34 joerg Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -41,7 +41,6 @@ #include <sys/featuretest.h> #include <sys/ansi.h> -#include <machine/ansi.h> #ifdef _BSD_SIZE_T_ typedef _BSD_SIZE_T_ size_t; #undef _BSD_SIZE_T_ @@ -51,6 +50,13 @@ typedef _BSD_SSIZE_T_ ssize_t; #undef _BSD_SSIZE_T_ #endif +#if defined(_POSIX_C_SOURCE) +#ifndef __VA_LIST_DECLARED +typedef __va_list va_list; +#define __VA_LIST_DECLARED +#endif +#endif + #include <sys/null.h> /* @@ -259,9 +265,9 @@ int sscanf(const char * __restrict, const char * __restrict, ...) __scanflike(2, 3); FILE *tmpfile(void); int ungetc(int, FILE *); -int vfprintf(FILE * __restrict, const char * __restrict, _BSD_VA_LIST_) +int vfprintf(FILE * __restrict, const char * __restrict, __va_list) __printflike(2, 0); -int vprintf(const char * __restrict, _BSD_VA_LIST_) +int vprintf(const char * __restrict, __va_list) __printflike(1, 0); #ifndef __AUDIT__ @@ -270,7 +276,7 @@ int sprintf(char * __restrict, const char * __restrict, ...) __printflike(2, 3); char *tmpnam(char *); int vsprintf(char * __restrict, const char * __restrict, - _BSD_VA_LIST_) + __va_list) __printflike(2, 0); #endif @@ -340,7 +346,7 @@ __BEGIN_DECLS int snprintf(char * __restrict, size_t, const char * __restrict, ...) __printflike(3, 4); int vsnprintf(char * __restrict, size_t, const char * __restrict, - _BSD_VA_LIST_) + __va_list) __printflike(3, 0); __END_DECLS #endif @@ -381,12 +387,12 @@ __END_DECLS */ #if defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE) __BEGIN_DECLS -int vscanf(const char * __restrict, _BSD_VA_LIST_) +int vscanf(const char * __restrict, __va_list) __scanflike(1, 0); -int vfscanf(FILE * __restrict, const char * __restrict, _BSD_VA_LIST_) +int vfscanf(FILE * __restrict, const char * __restrict, __va_list) __scanflike(2, 0); int vsscanf(const char * __restrict, const char * __restrict, - _BSD_VA_LIST_) + __va_list) __scanflike(2, 0); __END_DECLS #endif /* _ISOC99_SOURCE || _NETBSD_SOURCE */ @@ -411,7 +417,7 @@ int fpurge(FILE *); void setbuffer(FILE *, char *, int); int setlinebuf(FILE *); int vasprintf(char ** __restrict, const char * __restrict, - _BSD_VA_LIST_) + __va_list) __printflike(2, 0); const char *fmtcheck(const char *, const char *) __format_arg(2); @@ -493,7 +499,7 @@ static __inline int __sputc(int _c, FILE *_p) { #endif /* !_ANSI_SOURCE */ #if (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE) -int vdprintf(int, const char * __restrict, _BSD_VA_LIST_) +int vdprintf(int, const char * __restrict, __va_list) __printflike(2, 0); int dprintf(int, const char * __restrict, ...) __printflike(2, 3); diff --git a/include/util.h b/include/util.h index 34252cca494..f2e4fd4449d 100644 --- a/include/util.h +++ b/include/util.h @@ -1,4 +1,4 @@ -/* $NetBSD: util.h,v 1.55 2010/02/25 18:37:12 joerg Exp $ */ +/* $NetBSD: util.h,v 1.56 2011/07/17 20:54:34 joerg Exp $ */ /*- * Copyright (c) 1995 @@ -35,8 +35,9 @@ #include <sys/cdefs.h> #include <sys/ttycom.h> #include <sys/types.h> -#include <stdio.h> #include <pwd.h> +#include <stdarg.h> +#include <stdio.h> #include <termios.h> #include <utmp.h> #include <utmpx.h> @@ -138,8 +139,7 @@ void *erealloc(void *, size_t); struct __sFILE *efopen(const char *, const char *); int easprintf(char ** __restrict, const char * __restrict, ...) __printflike(2, 3); -int evasprintf(char ** __restrict, const char * __restrict, - _BSD_VA_LIST_) +int evasprintf(char ** __restrict, const char * __restrict, va_list) __printflike(2, 0); __END_DECLS diff --git a/include/varargs.h b/include/varargs.h deleted file mode 100644 index 8d33ca0608f..00000000000 --- a/include/varargs.h +++ /dev/null @@ -1,45 +0,0 @@ -/* $NetBSD: varargs.h,v 1.3 2008/04/28 20:22:54 martin Exp $ */ - -/*- - * Copyright (c) 2003 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matthias Scheler. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _VARARGS_H_ -#define _VARARGS_H_ - -#include <sys/cdefs.h> - -#if __GNUC_PREREQ__(3, 3) -#error "GCC 3.3 and newer no longer implements <varargs.h>." -#error "Revise your code to use <stdarg.h>." -#else -#include <machine/varargs.h> -#endif - -#endif /* !_VARARGS_H_ */ - diff --git a/include/wchar.h b/include/wchar.h index e7fc28349a6..68670429867 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -1,4 +1,4 @@ -/* $NetBSD: wchar.h,v 1.29 2010/03/27 22:14:09 tnozaki Exp $ */ +/* $NetBSD: wchar.h,v 1.30 2011/07/17 20:54:34 joerg Exp $ */ /*- * Copyright (c)1999 Citrus Project, @@ -86,6 +86,13 @@ typedef _BSD_SIZE_T_ size_t; #undef _BSD_SIZE_T_ #endif +#if defined(_POSIX_C_SOURCE) +#ifndef __VA_LIST_DECLARED +typedef __va_list va_list; +#define __VA_LIST_DECLARED +#endif +#endif + struct tm; __BEGIN_DECLS @@ -167,18 +174,18 @@ int fwprintf(FILE * __restrict, const wchar_t * __restrict, ...); int fwscanf(FILE * __restrict, const wchar_t * __restrict, ...); int swprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict, ...); int swscanf(const wchar_t * __restrict, const wchar_t * __restrict, ...); -int vfwprintf(FILE * __restrict, const wchar_t * __restrict, _BSD_VA_LIST_); +int vfwprintf(FILE * __restrict, const wchar_t * __restrict, __va_list); int vswprintf(wchar_t * __restrict, size_t, const wchar_t * __restrict, - _BSD_VA_LIST_); -int vwprintf(const wchar_t * __restrict, _BSD_VA_LIST_); + __va_list); +int vwprintf(const wchar_t * __restrict, __va_list); int wprintf(const wchar_t * __restrict, ...); int wscanf(const wchar_t * __restrict, ...); #if defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) > 199901L || \ defined(_NETBSD_SOURCE) -int vfwscanf(FILE * __restrict, const wchar_t * __restrict, _BSD_VA_LIST_); +int vfwscanf(FILE * __restrict, const wchar_t * __restrict, __va_list); int vswscanf(const wchar_t * __restrict, const wchar_t * __restrict, - _BSD_VA_LIST_); -int vwscanf(const wchar_t * __restrict, _BSD_VA_LIST_); + __va_list); +int vwscanf(const wchar_t * __restrict, __va_list); #endif #if defined(_NETBSD_SOURCE) struct tinfo; |
