/*----------------------------------------------------------------------*
 * Bounds Checking for GCC.						*
 * Copyright (C) 1995 Richard W.M. Jones <rwmj@doc.ic.ac.uk>.		*
 *----------------------------------------------------------------------*
 * This program is free software; you can redistribute it and/or modify	*
 * it under the terms of the GNU General Public License as published by	*
 * the Free Software Foundation; either version 2 of the License, or	*
 * (at your option) any later version.					*
 *									*
 * This program is distributed in the hope that it will be useful,	*
 * but WITHOUT ANY WARRANTY; without even the implied warranty of	*
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the	*
 * GNU General Public License for more details.				*
 *									*
 * You should have received a copy of the GNU General Public License	*
 * along with this program; if not, write to the Free Software		*
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.		*
 *----------------------------------------------------------------------*
 * File:
 *	run-includes/fix-args.h.in
 *	run-includes/fix-args.h (** generated automatically by make **)
 * Summary:
 *	Fix the definition of `va_arg' macro used both by <stdarg.h> and
 *	<varargs.h>. You should include this file _after_ one of these
 *	standard header files.
 * Other notes:
 *	Possibly this should be fixed automatically in `ginclude/'
 *	files?
 *	Because it seems to be impossible to redefine a macro in terms
 *	of its old definition, I've done it in the Makefile that you will
 *	find in this directory.
 * Author      	Date		Notes
 * RWMJ		6/6/95		Initial implementation.
 * RWMJ		12/1/96		Fixed to use fix-args.h.in
 *----------------------------------------------------------------------*/

#ifndef _FIX_ARGS_H_
#define _FIX_ARGS_H_

#ifdef __BOUNDS_CHECKING_ON

#undef va_arg

/* This is the definition of `__old_va_arg' copied from <stdarg.h>. It is
 * identical to the one in <varargs.h> too.
 */
#define __old_va_arg(AP,TYPE) @@@@

#define va_arg(AP,TYPE) \
  ({extern int __bounds_debug_no_checking; \
  int __t = __bounds_debug_no_checking; \
  TYPE __r; \
  __bounds_debug_no_checking = 1; \
  __r = __old_va_arg(AP,TYPE); \
  __bounds_debug_no_checking = __t; \
  __r;})

#endif /* __BOUNDS_CHECKING_ON */
#endif /* _FIX_ARGS_H_ */
