This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Patch to comment on common_type
- From: "Joseph S. Myers" <jsm at polyomino dot org dot uk>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sat, 29 May 2004 18:40:42 +0000 (UTC)
- Subject: Patch to comment on common_type
In reviewing <http://gcc.gnu.org/ml/gcc-patches/2004-05/msg01779.html>
I noticed that the comment on c-typeck.c:common_type was inaccurate.
Fixed thus. Applied to mainline. I'll look at disentangling the two
different things common_type does (composite type of compatible types,
and usual arithmetic conversions) into two separate functions once
that patch has gone in. (The code that was losing the qualifiers
shouldn't be necessary at all for the case of composite types where
they were being lost, and the case of usual arithmetic conversions
should end up with no qualifiers on the result type (cf. bug 13519),
but that patch with testcase does fix a definite bug and ensure it
doesn't recur, and is the more conservative approach for fixing that
bug on 3.4 branch.)
2004-05-29 Joseph S. Myers <jsm@polyomino.org.uk>
* c-typeck.c (common_type): Correct comment.
--- c-typeck.c.orig 2004-05-29 09:23:35.000000000 +0000
+++ c-typeck.c 2004-05-29 16:22:16.000000000 +0000
@@ -199,10 +199,13 @@
TYPE_QUALS (type) | TYPE_QUALS (like));
}
-/* Return the common type of two types.
- We assume that comptypes has already been done and returned 1;
- if that isn't so, this may crash. In particular, we assume that qualifiers
- match.
+/* Return the composite type of two compatible types, or the common
+ type for two arithmetic types under the usual arithmetic
+ conversions.
+
+ Unless both types are arithmetic types, we assume that comptypes
+ has already been done and returned 1; if that isn't so, this may
+ crash. In particular, we assume that qualifiers match.
This is the type for the result of most arithmetic operations
if the operands have the given two types. */
--
Joseph S. Myers
jsm@polyomino.org.uk