+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
* 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- *
/* 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