[PPL-devel] [GIT] ppl/ppl(master): Avoid use of anonymous enum.

Abramo Bagnara abramo.bagnara at gmail.com
Thu Apr 23 12:27:57 CEST 2009


Module: ppl/ppl
Branch: master
Commit: ececf3c3476d18d1a87795e3334f9b372ea658cb
URL:    http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=ececf3c3476d18d1a87795e3334f9b372ea658cb

Author: Abramo Bagnara <abramo.bagnara at gmail.com>
Date:   Thu Apr 23 12:23:41 2009 +0200

Avoid use of anonymous enum.

---

 src/C_Integer.hh        |   20 ++++++++++----------
 src/checked.cc          |    2 +-
 src/meta_programming.hh |   10 +++++-----
 3 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/src/C_Integer.hh b/src/C_Integer.hh
index 86df040..1687382 100644
--- a/src/C_Integer.hh
+++ b/src/C_Integer.hh
@@ -62,7 +62,7 @@ struct C_Integer : public False { };
 
 template <>
 struct C_Integer<signed char> : public True {
-  enum { is_signed = true };
+  enum anonymous_enum { is_signed = true };
   typedef void smaller_type;
   typedef void smaller_signed_type;
   typedef void smaller_unsigned_type;
@@ -73,7 +73,7 @@ struct C_Integer<signed char> : public True {
 
 template <>
 struct C_Integer<signed short> : public True {
-  enum { is_signed = true };
+  enum anonymous_enum { is_signed = true };
   typedef signed char smaller_type;
   typedef signed char smaller_signed_type;
   typedef unsigned char smaller_unsigned_type;
@@ -84,7 +84,7 @@ struct C_Integer<signed short> : public True {
 
 template <>
 struct C_Integer<signed int> : public True {
-  enum { is_signed = true };
+  enum anonymous_enum { is_signed = true };
   typedef signed short smaller_type;
   typedef signed short smaller_signed_type;
   typedef unsigned short smaller_unsigned_type;
@@ -95,7 +95,7 @@ struct C_Integer<signed int> : public True {
 
 template <>
 struct C_Integer<signed long> : public True {
-  enum { is_signed = true };
+  enum anonymous_enum { is_signed = true };
   typedef signed int smaller_type;
   typedef signed int smaller_signed_type;
   typedef unsigned int smaller_unsigned_type;
@@ -106,7 +106,7 @@ struct C_Integer<signed long> : public True {
 
 template <>
 struct C_Integer<signed long long> : public True {
-  enum { is_signed = true };
+  enum anonymous_enum { is_signed = true };
   typedef signed long smaller_type;
   typedef signed long smaller_signed_type;
   typedef unsigned long smaller_unsigned_type;
@@ -117,7 +117,7 @@ struct C_Integer<signed long long> : public True {
 
 template <>
 struct C_Integer<unsigned char> : public True {
-  enum { is_signed = false };
+  enum anonymous_enum { is_signed = false };
   typedef void smaller_type;
   typedef void smaller_signed_type;
   typedef void smaller_unsigned_type;
@@ -128,7 +128,7 @@ struct C_Integer<unsigned char> : public True {
 
 template <>
 struct C_Integer<unsigned short> : public True {
-  enum { is_signed = false };
+  enum anonymous_enum { is_signed = false };
   typedef unsigned char smaller_type;
   typedef signed char smaller_signed_type;
   typedef unsigned char smaller_unsigned_type;
@@ -139,7 +139,7 @@ struct C_Integer<unsigned short> : public True {
 
 template <>
 struct C_Integer<unsigned int> : public True {
-  enum { is_signed = false };
+  enum anonymous_enum { is_signed = false };
   typedef unsigned short smaller_type;
   typedef signed short smaller_signed_type;
   typedef unsigned short smaller_unsigned_type;
@@ -150,7 +150,7 @@ struct C_Integer<unsigned int> : public True {
 
 template <>
 struct C_Integer<unsigned long> : public True {
-  enum { is_signed = false };
+  enum anonymous_enum { is_signed = false };
   typedef unsigned int smaller_type;
   typedef signed int smaller_signed_type;
   typedef unsigned int smaller_unsigned_type;
@@ -161,7 +161,7 @@ struct C_Integer<unsigned long> : public True {
 
 template <>
 struct C_Integer<unsigned long long> : public True {
-  enum { is_signed = false };
+  enum anonymous_enum { is_signed = false };
   typedef unsigned long smaller_type;
   typedef signed long smaller_signed_type;
   typedef unsigned long smaller_unsigned_type;
diff --git a/src/checked.cc b/src/checked.cc
index bd19e2b..e21c25d 100644
--- a/src/checked.cc
+++ b/src/checked.cc
@@ -90,7 +90,7 @@ sum_sign(bool& a_neg, unsigned long& a_mod,
 */
 Result
 parse_number_part(std::istream& is, number_struct& num) {
-  enum { BASE, INTEGER, FRACTIONAL, EXPONENT } state = BASE;
+  enum anonymous_enum { BASE, INTEGER, FRACTIONAL, EXPONENT } state = BASE;
   PPL_UNINITIALIZED(unsigned long, max_exp_div);
   PPL_UNINITIALIZED(int, max_exp_rem);
   bool empty_exponent = true;
diff --git a/src/meta_programming.hh b/src/meta_programming.hh
index 83c29fb..a28f659 100644
--- a/src/meta_programming.hh
+++ b/src/meta_programming.hh
@@ -39,7 +39,7 @@ namespace Parma_Polyhedra_Library {
 */
 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
 #define const_bool_nodef(name, value)		\
-  enum { name = (value) }
+  enum anonymous_enum_ ## name { name = (value) }
 
 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
 /*! \brief
@@ -53,7 +53,7 @@ namespace Parma_Polyhedra_Library {
 */
 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
 #define const_int_nodef(name, value) \
-  enum { name = (value) }
+  enum anonymous_enum_ ## name { name = (value) }
 
 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
 /*! \brief
@@ -116,7 +116,7 @@ struct Compile_Time_Check<true> {
 
 #define PPL_COMPILE_TIME_CHECK_NAME(suffix) compile_time_check_ ## suffix
 #define PPL_COMPILE_TIME_CHECK_AUX(e, suffix)				\
-  enum {								\
+  enum anonymous_enum_compile_time_check_ ## suffix {			\
     /* If e evaluates to false, then the sizeof cannot be compiled. */  \
     PPL_COMPILE_TIME_CHECK_NAME(suffix)					\
     = sizeof(Parma_Polyhedra_Library::					\
@@ -141,7 +141,7 @@ struct Compile_Time_Check<true> {
 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
 template <bool b>
 struct Bool {
-  enum {
+  enum anonymous_enum {
     value = b
   };
 };
@@ -244,7 +244,7 @@ struct Is_Same_Or_Derived {
                          "architecture with sizeof(char) == sizeof(double)"
                          " (!?)");
 
-  enum {
+  enum anonymous_enum {
     /*!
       Assuming <CODE>sizeof(char) != sizeof(double)</CODE>, the C++
       overload resolution mechanism guarantees that \p value evaluates




More information about the PPL-devel mailing list