This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH RFA: Avoid enum bitfield in C++ frontend


Jason Merrill <jason@redhat.com> writes:

> Ian Lance Taylor wrote:
>> This is how I think the code looks best--I don't see a need for a
>> special type to hold this combination of bitfields.  However, it would
>> be a smaller change to let the C++ frontend continue to use
>> tsubst_flags_t, and simply do "typedef int tsubst_flags_t".  If the C++
>> frontend maintainers would prefer that patch, I can do that instead.
>
> I think I would prefer that; the typedef provides documentation about
> what the complain parameter means.  If it goes away we'd need to add a
> note to the comments before all the functions.

OK, how about this patch?

This is bootstrapped on i686-pc-linux-gnu, and I'm running the testsuite
now.

Ian


2009-04-15  Ian Lance Taylor  <iant@google.com>

	* cp-tree.h (enum tsubst_flags): Rename from enum tsubst_flags_t.
	(tsubst_flags_t): Change typedef from enum type to int.


Index: cp/cp-tree.h
===================================================================
--- cp/cp-tree.h	(revision 146131)
+++ cp/cp-tree.h	(working copy)
@@ -3566,7 +3566,7 @@ typedef enum linkage_kind {
 } linkage_kind;
 
 /* Bitmask flags to control type substitution.  */
-typedef enum tsubst_flags_t {
+enum tsubst_flags {
   tf_none = 0,			 /* nothing special */
   tf_error = 1 << 0,		 /* give error messages  */
   tf_warning = 1 << 1,	 	 /* give warnings too  */
@@ -3585,7 +3585,11 @@ typedef enum tsubst_flags_t {
 				    when issuing other errors.   */
   /* Convenient substitution flags combinations.  */
   tf_warning_or_error = tf_warning | tf_error
-} tsubst_flags_t;
+};
+
+/* This type is used for parameters and variables which hold
+   combinations of the flags in enum tsubst_flags.  */
+typedef int tsubst_flags_t;
 
 /* The kind of checking we can do looking in a class hierarchy.  */
 typedef enum base_access {

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]