Commit b1c12c4b by Zack Weinberg Committed by Zack Weinberg

ada.h: Add MI guard macro.

	* ada.h: Add MI guard macro.
	(SUBTYPE): Define constants with an anonymous enum, not static
	const variables.
	(IN): Cast constants to appropriate type before use.

From-SVN: r54063
parent c8ea9a0f
2002-05-30 Zack Weinberg <zack@codesourcery.com>
* ada.h: Add MI guard macro.
(SUBTYPE): Define constants with an anonymous enum, not static
const variables.
(IN): Cast constants to appropriate type before use.
2002-05-26 Joseph S. Myers <jsm28@cam.ac.uk> 2002-05-26 Joseph S. Myers <jsm28@cam.ac.uk>
* gnatvsn.ads (Gnat_Version_String): Change to "3.2 20020526 * gnatvsn.ads (Gnat_Version_String): Change to "3.2 20020526
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* C Header File * * C Header File *
* * * *
* * * *
* Copyright (C) 1992-2001 Free Software Foundation, Inc. * * Copyright (C) 1992-2002 Free Software Foundation, Inc. *
* * * *
* GNAT is free software; you can redistribute it and/or modify it under * * GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- * * terms of the GNU General Public License as published by the Free Soft- *
...@@ -34,6 +34,9 @@ ...@@ -34,6 +34,9 @@
/* This file contains some standard macros for performing Ada-like /* This file contains some standard macros for performing Ada-like
operations. These are used to aid in the translation of other headers. */ operations. These are used to aid in the translation of other headers. */
#ifndef GCC_ADA_H
#define GCC_ADA_H
/* Inlined functions in header are preceded by INLINE, which is normally set /* Inlined functions in header are preceded by INLINE, which is normally set
to extern inline for GCC, but may be set to static for use in standard to extern inline for GCC, but may be set to static for use in standard
ANSI-C. */ ANSI-C. */
...@@ -62,14 +65,17 @@ ...@@ -62,14 +65,17 @@
effect is to compile a typedef defining the subtype as a synonym for the effect is to compile a typedef defining the subtype as a synonym for the
type, together with two constants defining the end points. */ type, together with two constants defining the end points. */
#define SUBTYPE(SUBTYPE,TYPE,FIRST,LAST) \ #define SUBTYPE(SUBTYPE,TYPE,FIRST,LAST) \
typedef TYPE SUBTYPE; \ typedef TYPE SUBTYPE; \
static const SUBTYPE CAT (SUBTYPE,__First) = FIRST; \ enum { CAT (SUBTYPE,__First) = FIRST, \
static const SUBTYPE CAT (SUBTYPE,__Last) = LAST; CAT (SUBTYPE,__Last) = LAST };
/* The following definitions provide the equivalent of the Ada IN and NOT IN /* The following definitions provide the equivalent of the Ada IN and NOT IN
operators, assuming that the subtype involved has been defined using the operators, assuming that the subtype involved has been defined using the
SUBTYPE macro defined above. */ SUBTYPE macro defined above. */
#define IN(VALUE,SUBTYPE) \ #define IN(VALUE,SUBTYPE) \
(((VALUE) >= CAT (SUBTYPE,__First)) && ((VALUE) <= CAT (SUBTYPE,__Last))) (((VALUE) >= (SUBTYPE) CAT (SUBTYPE,__First)) && \
((VALUE) <= (SUBTYPE) CAT (SUBTYPE,__Last)))
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment