NetBSD/sys/arch/sh3/include/stdarg.h
bjh21 4be7a2dcf3 Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
  can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
  various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
  !defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them.  In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
2003-04-28 23:16:11 +00:00

37 lines
735 B
C

/* $NetBSD: stdarg.h,v 1.6 2003/04/28 23:16:23 bjh21 Exp $ */
#ifndef _SH3_STDARG_H_
#define _SH3_STDARG_H_
#ifdef __lint__
#include <machine/ansi.h>
typedef _BSD_VA_LIST_ va_list; /* XXX */
#define va_start(a, l) ((a) = ((l) ? 0 : 0))
#define va_arg(a, t) ((a) ? (t)0 : (t)0)
#define va_end(a) /* nothing */
#define __va_copy(d, s) ((d) = (s))
#else /* ! __lint__ */
#ifndef _VARARGS_H
#define _STDARG_H
#endif
#include <sh3/va-sh.h>
#include <sys/featuretest.h>
typedef __gnuc_va_list va_list;
#endif /* __lint__ */
#if !defined(_ANSI_SOURCE) && \
(defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) >= 199901L || \
defined(_NETBSD_SOURCE))
#define va_copy __va_copy
#endif
#endif /* _SH3_STDARG_H_ */