diff options
author | Douglas Gregor <doug.gregor@gmail.com> | 2007-07-11 13:50:13 +0000 |
---|---|---|
committer | Doug Gregor <dgregor@gcc.gnu.org> | 2007-07-11 13:50:13 +0000 |
commit | 7313518b90b280e75d32a647b3d9f6ad5e0b0150 (patch) | |
tree | 1f482a01f0df0a7fe6691efc8bb9d3348de39c45 | |
parent | 039cb258334f8c69acd5de99c33f781cff49c535 (diff) | |
download | gcc-7313518b90b280e75d32a647b3d9f6ad5e0b0150.tar.gz |
params.def (PARAM_VERIFY_CANONICAL_TYPES): Remove.
2007-07-11 Douglas Gregor <doug.gregor@gmail.com>
* params.def (PARAM_VERIFY_CANONICAL_TYPES): Remove.
(PARAM_USE_CANONICAL_TYPES): New; decides whether to use canonical
types or not.
* params.h (VERIFY_CANONICAL_TYPES): Remove.
(USE_CANONICAL_TYPES): New.
* doc/invoke.texi (verify-canonical-types): Remove.
(use-canonical-types): Add.
2007-07-11 Douglas Gregor <doug.gregor@gmail.com>
* typeck.c (comptypes): When USE_CANONICAL_TYPES, use the
canonical types; otherwise, fall back to structural type
comparisons. If ENABLE_CHECKING and USE_CANONICAL_TYPES, give an
internal compiler error if the canonical types are wrong.
From-SVN: r126550
-rw-r--r-- | gcc/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 47 | ||||
-rw-r--r-- | gcc/doc/invoke.texi | 12 | ||||
-rw-r--r-- | gcc/params.def | 23 | ||||
-rw-r--r-- | gcc/params.h | 4 |
6 files changed, 56 insertions, 47 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a90b025e2d8..4a01bbe04c8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2007-07-11 Douglas Gregor <doug.gregor@gmail.com> + + * params.def (PARAM_VERIFY_CANONICAL_TYPES): Remove. + (PARAM_USE_CANONICAL_TYPES): New; decides whether to use canonical + types or not. + * params.h (VERIFY_CANONICAL_TYPES): Remove. + (USE_CANONICAL_TYPES): New. + * doc/invoke.texi (verify-canonical-types): Remove. + (use-canonical-types): Add. + 2007-07-11 Ulrich Weigand <uweigand@de.ibm.com> * config/spu/spu.c (spu_optimization_options): Remove setting of diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3ffc400c1cb..8165176ae5e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2007-07-11 Douglas Gregor <doug.gregor@gmail.com> + + * typeck.c (comptypes): When USE_CANONICAL_TYPES, use the + canonical types; otherwise, fall back to structural type + comparisons. If ENABLE_CHECKING and USE_CANONICAL_TYPES, give an + internal compiler error if the canonical types are wrong. + 2007-07-11 Paolo Carlini <pcarlini@suse.de> PR c++/32560 diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 3b8b914864e..4f08c8e9aa7 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -1108,8 +1108,6 @@ comptypes (tree t1, tree t2, int strict) { if (strict == COMPARE_STRICT) { - bool result; - if (t1 == t2) return true; @@ -1121,37 +1119,34 @@ comptypes (tree t1, tree t2, int strict) perform a deep check. */ return structural_comptypes (t1, t2, strict); - if (VERIFY_CANONICAL_TYPES) +#ifdef ENABLE_CHECKING + if (USE_CANONICAL_TYPES) { - result = structural_comptypes (t1, t2, strict); - + bool result = structural_comptypes (t1, t2, strict); + if (result && TYPE_CANONICAL (t1) != TYPE_CANONICAL (t2)) - { - /* The two types are structurally equivalent, but their - canonical types were different. This is a failure of the - canonical type propagation code.*/ - warning(0, - "canonical types differ for identical types %T and %T", - t1, t2); - debug_tree (t1); - debug_tree (t2); - } + /* The two types are structurally equivalent, but their + canonical types were different. This is a failure of the + canonical type propagation code.*/ + internal_error + ("canonical types differ for identical types %T and %T", + t1, t2); else if (!result && TYPE_CANONICAL (t1) == TYPE_CANONICAL (t2)) - { - /* Two types are structurally different, but the canonical - types are the same. This means we were over-eager in - assigning canonical types. */ - warning (0, - "same canonical type node for different types %T and %T", - t1, t2); - debug_tree (t1); - debug_tree (t2); - } + /* Two types are structurally different, but the canonical + types are the same. This means we were over-eager in + assigning canonical types. */ + internal_error + ("same canonical type node for different types %T and %T", + t1, t2); return result; } - else +#else + if (USE_CANONICAL_TYPES) return TYPE_CANONICAL (t1) == TYPE_CANONICAL (t2); +#endif + else + return structural_comptypes (t1, t2, strict); } else if (strict == COMPARE_STRUCTURAL) return structural_comptypes (t1, t2, COMPARE_STRICT); diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 6a4bc299c2a..c954b9fe9d5 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -6960,12 +6960,12 @@ The size of cache line in L1 cache, in bytes. @item l1-cache-size The number of cache lines in L1 cache. -@item verify-canonical-types -Whether the compiler should verify the ``canonical'' types used for -type equality comparisons within the C++ and Objective-C++ front -ends. Set to 1 (the default when GCC is configured with ---enable-checking) to enable verification, 0 to disable verification -(the default when GCC is configured with --disable-checking). +@item use-canonical-types +Whether the compiler should use the ``canonical'' type system. By +default, this should always be 1, which uses a more efficient internal +mechanism for comparing types in C++ and Objective-C++. However, if +bugs in the canonical type system are causing compilation failures, +set this value to 0 to disable canonical types. @end table @end table diff --git a/gcc/params.def b/gcc/params.def index 70ca3ad00c1..c9d5b8084dd 100644 --- a/gcc/params.def +++ b/gcc/params.def @@ -673,19 +673,16 @@ DEFPARAM (PARAM_L1_CACHE_LINE_SIZE, "The size of L1 cache line", 32, 0, 0) -#ifdef ENABLE_CHECKING -# define GCC_CANONICAL_TYPES_DEFAULT 1 -#else -# define GCC_CANONICAL_TYPES_DEFAULT 0 -#endif - -/* Whether we should verify that the canonical types in the system are - consistent with the "structural" typing. */ - -DEFPARAM (PARAM_VERIFY_CANONICAL_TYPES, - "verify-canonical-types", - "Whether to verify canonical types", - GCC_CANONICAL_TYPES_DEFAULT, 0, 1) +/* Whether we should use canonical types rather than deep "structural" + type checking. Setting this value to 1 (the default) improves + compilation performance in the C++ and Objective-C++ front end; + this value should only be set to zero to work around bugs in the + canonical type system by disabling it. */ + +DEFPARAM (PARAM_USE_CANONICAL_TYPES, + "use-canonical-types", + "Whether to use canonical types", + 1, 0, 1) /* Local variables: mode:c diff --git a/gcc/params.h b/gcc/params.h index 386e781c26a..410ae335fe4 100644 --- a/gcc/params.h +++ b/gcc/params.h @@ -168,6 +168,6 @@ typedef enum compiler_param PARAM_VALUE (PARAM_L1_CACHE_SIZE) #define L1_CACHE_LINE_SIZE \ PARAM_VALUE (PARAM_L1_CACHE_LINE_SIZE) -#define VERIFY_CANONICAL_TYPES \ - PARAM_VALUE (PARAM_VERIFY_CANONICAL_TYPES) +#define USE_CANONICAL_TYPES \ + PARAM_VALUE (PARAM_USE_CANONICAL_TYPES) #endif /* ! GCC_PARAMS_H */ |