diff options
author | Zack Weinberg <zack@codesourcery.com> | 2002-05-30 18:39:02 +0000 |
---|---|---|
committer | Zack Weinberg <zack@gcc.gnu.org> | 2002-05-30 18:39:02 +0000 |
commit | b1c12c4ba10fc0ee9c8eea601790e2e33290aa44 (patch) | |
tree | 2ecd37b52f1371cd813d01791c8b01cfb6988617 /gcc/ada/ada.h | |
parent | c8ea9a0f1d8b83b4e8692f450df9da5de0714118 (diff) | |
download | gcc-b1c12c4ba10fc0ee9c8eea601790e2e33290aa44.zip gcc-b1c12c4ba10fc0ee9c8eea601790e2e33290aa44.tar.gz gcc-b1c12c4ba10fc0ee9c8eea601790e2e33290aa44.tar.bz2 |
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
Diffstat (limited to 'gcc/ada/ada.h')
-rw-r--r-- | gcc/ada/ada.h | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/gcc/ada/ada.h b/gcc/ada/ada.h index 4393b22..422cb4c 100644 --- a/gcc/ada/ada.h +++ b/gcc/ada/ada.h @@ -7,7 +7,7 @@ * 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 * * terms of the GNU General Public License as published by the Free Soft- * @@ -34,6 +34,9 @@ /* This file contains some standard macros for performing Ada-like 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 to extern inline for GCC, but may be set to static for use in standard ANSI-C. */ @@ -62,14 +65,17 @@ effect is to compile a typedef defining the subtype as a synonym for the type, together with two constants defining the end points. */ -#define SUBTYPE(SUBTYPE,TYPE,FIRST,LAST) \ - typedef TYPE SUBTYPE; \ - static const SUBTYPE CAT (SUBTYPE,__First) = FIRST; \ - static const SUBTYPE CAT (SUBTYPE,__Last) = LAST; +#define SUBTYPE(SUBTYPE,TYPE,FIRST,LAST) \ + typedef TYPE SUBTYPE; \ + enum { CAT (SUBTYPE,__First) = FIRST, \ + CAT (SUBTYPE,__Last) = LAST }; /* The following definitions provide the equivalent of the Ada IN and NOT IN operators, assuming that the subtype involved has been defined using the SUBTYPE macro defined above. */ #define IN(VALUE,SUBTYPE) \ - (((VALUE) >= CAT (SUBTYPE,__First)) && ((VALUE) <= CAT (SUBTYPE,__Last))) + (((VALUE) >= (SUBTYPE) CAT (SUBTYPE,__First)) && \ + ((VALUE) <= (SUBTYPE) CAT (SUBTYPE,__Last))) + +#endif |