ada.h: Add MI guard macro.
authorZack Weinberg <zack@codesourcery.com>
Thu, 30 May 2002 18:39:02 +0000 (18:39 +0000)
committerZack Weinberg <zack@gcc.gnu.org>
Thu, 30 May 2002 18:39:02 +0000 (18:39 +0000)
* 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

gcc/ada/ChangeLog
gcc/ada/ada.h

index 1e086f1..bc593e3 100644 (file)
@@ -1,3 +1,10 @@
+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>
 
        * gnatvsn.ads (Gnat_Version_String): Change to "3.2 20020526
index 4393b22..422cb4c 100644 (file)
@@ -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.  */
    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