diff options
author | obrien <obrien@FreeBSD.org> | 1999-11-01 18:41:09 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 1999-11-01 18:41:09 +0000 |
commit | 69611a5db3223d9294c23921a01217c613130b9d (patch) | |
tree | 2c6461abec5d94717bcee808b3e04b8cb4eff3f8 /contrib/gcc | |
parent | 43c3eb51c43e073f288448137fdeaf14641a757d (diff) | |
download | FreeBSD-src-69611a5db3223d9294c23921a01217c613130b9d.zip FreeBSD-src-69611a5db3223d9294c23921a01217c613130b9d.tar.gz |
Merge our -fformat-extensions and printf0() into GCC 2.95.2.
Diffstat (limited to 'contrib/gcc')
-rw-r--r-- | contrib/gcc/c-common.c | 52 |
1 files changed, 48 insertions, 4 deletions
diff --git a/contrib/gcc/c-common.c b/contrib/gcc/c-common.c index 789b7eb..9ab5c5f 100644 --- a/contrib/gcc/c-common.c +++ b/contrib/gcc/c-common.c @@ -332,7 +332,8 @@ combine_strings (strings) = build_array_type (wide_flag ? wchar_type_node : char_type_node, build_index_type (build_int_2 (nchars - 1, 0))); - TREE_READONLY (value) = TREE_CONSTANT (value) = ! flag_writable_strings; + TREE_CONSTANT (value) = 1; + TREE_READONLY (value) = ! flag_writable_strings; TREE_STATIC (value) = 1; return value; } @@ -3282,11 +3283,54 @@ c_get_alias_set (t) whose type is the same as one of the fields, recursively, but we don't yet make any use of that information.) */ TYPE_ALIAS_SET (type) = 0; + else if (TREE_CODE (type) == POINTER_TYPE + || TREE_CODE (type) == REFERENCE_TYPE) + { + tree t; + + /* Unfortunately, there is no canonical form of a pointer type. + In particular, if we have `typedef int I', then `int *', and + `I *' are different types. So, we have to pick a canonical + representative. We do this below. + + Technically, this approach is actually more conservative that + it needs to be. In particular, `const int *' and `int *' + chould be in different alias sets, according to the C and C++ + standard, since their types are not the same, and so, + technically, an `int **' and `const int **' cannot point at + the same thing. + + But, the standard is wrong. In particular, this code is + legal C++: + + int *ip; + int **ipp = &ip; + const int* const* cipp = &ip; + + And, it doesn't make sense for that to be legal unless you + can dereference IPP and CIPP. So, we ignore cv-qualifiers on + the pointed-to types. This issue has been reported to the + C++ committee. */ + t = TYPE_MAIN_VARIANT (TREE_TYPE (type)); + t = ((TREE_CODE (type) == POINTER_TYPE) + ? build_pointer_type (t) : build_reference_type (t)); + if (t != type) + TYPE_ALIAS_SET (type) = c_get_alias_set (t); + } if (!TYPE_ALIAS_SET_KNOWN_P (type)) - /* TYPE is something we haven't seen before. Put it in a new - alias set. */ - TYPE_ALIAS_SET (type) = new_alias_set (); + { + /* Types that are not allocated on the permanent obstack are not + placed in the type hash table. Thus, there can be multiple + copies of identical types in local scopes. In the long run, + all types should be permanent. */ + if (! TREE_PERMANENT (type)) + TYPE_ALIAS_SET (type) = 0; + else + /* TYPE is something we haven't seen before. Put it in a new + alias set. */ + TYPE_ALIAS_SET (type) = new_alias_set (); + } return TYPE_ALIAS_SET (type); } |