diff options
author | Rafael Ávila de Espíndola <espindola@google.com> | 2009-04-01 15:10:46 +0000 |
---|---|---|
committer | Rafael Ávila de Espíndola <espindola@google.com> | 2009-04-01 15:10:46 +0000 |
commit | 8aea7e9519bda2c43e022a2eac13470aaf3495cc (patch) | |
tree | e17e9b334355c563db3b5597aafdf30f3dee478e /gcc | |
parent | 04ca5878b01f2d7e0b335311b9b6d8fe8a3bd04c (diff) |
2009-04-01 Rafael Avila de Espindola <espindola@google.com>
Revert
2007-11-16 Nathan Froyd <froydnj@codesourcery.com>
* c-common.c (c_build_bitfield_integer_type): Rename this...
* stor-layout.c (make_bitfield_integer_type): ...to this.
* c-decl.c (finish_struct): Use new name.
* c-common.h (c_build_bitfield_integer_type): Move declaration...
* tree.h (make_bitfield_integer_type): ...here.
2007-11-16 Nathan Froyd <froydnj@codesourcery.com>
* class.c (layout_class_type): Use make_bitfield_integer_type.
2007-11-16 Nathan Froyd <froydnj@codesourcery.com>
* lto.c (lto_read_base_type_DIE): Use make_bitfield_integer_type to
construct the integer type for bitfields.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/lto@145406 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog.lto | 21 | ||||
-rw-r--r-- | gcc/c-common.c | 25 | ||||
-rw-r--r-- | gcc/c-common.h | 1 | ||||
-rw-r--r-- | gcc/c-decl.c | 2 | ||||
-rw-r--r-- | gcc/cp/class.c | 4 | ||||
-rw-r--r-- | gcc/stor-layout.c | 25 | ||||
-rw-r--r-- | gcc/tree.h | 1 |
7 files changed, 50 insertions, 29 deletions
diff --git a/gcc/ChangeLog.lto b/gcc/ChangeLog.lto index dbb161e7385..9a4c350771e 100644 --- a/gcc/ChangeLog.lto +++ b/gcc/ChangeLog.lto @@ -1,5 +1,26 @@ 2009-04-01 Rafael Avila de Espindola <espindola@google.com> + Revert + + 2007-11-16 Nathan Froyd <froydnj@codesourcery.com> + + * c-common.c (c_build_bitfield_integer_type): Rename this... + * stor-layout.c (make_bitfield_integer_type): ...to this. + * c-decl.c (finish_struct): Use new name. + * c-common.h (c_build_bitfield_integer_type): Move declaration... + * tree.h (make_bitfield_integer_type): ...here. + + 2007-11-16 Nathan Froyd <froydnj@codesourcery.com> + + * class.c (layout_class_type): Use make_bitfield_integer_type. + + 2007-11-16 Nathan Froyd <froydnj@codesourcery.com> + + * lto.c (lto_read_base_type_DIE): Use make_bitfield_integer_type to + construct the integer type for bitfields. + +2009-04-01 Rafael Avila de Espindola <espindola@google.com> + * gcc.c (lto_single): Remove. (lto_single_spec_function): Remove. Update all uses. (The Specs Language): Remove support for calling functions. diff --git a/gcc/c-common.c b/gcc/c-common.c index 2a19f49b6fb..cd51b01f783 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -2754,6 +2754,31 @@ c_common_signed_or_unsigned_type (int unsignedp, tree type) return build_nonstandard_integer_type (TYPE_PRECISION (type), unsignedp); } +/* Build a bit-field integer type for the given WIDTH and UNSIGNEDP. */ + +tree +c_build_bitfield_integer_type (unsigned HOST_WIDE_INT width, int unsignedp) +{ + /* Extended integer types of the same width as a standard type have + lesser rank, so those of the same width as int promote to int or + unsigned int and are valid for printf formats expecting int or + unsigned int. To avoid such special cases, avoid creating + extended integer types for bit-fields if a standard integer type + is available. */ + if (width == TYPE_PRECISION (integer_type_node)) + return unsignedp ? unsigned_type_node : integer_type_node; + if (width == TYPE_PRECISION (signed_char_type_node)) + return unsignedp ? unsigned_char_type_node : signed_char_type_node; + if (width == TYPE_PRECISION (short_integer_type_node)) + return unsignedp ? short_unsigned_type_node : short_integer_type_node; + if (width == TYPE_PRECISION (long_integer_type_node)) + return unsignedp ? long_unsigned_type_node : long_integer_type_node; + if (width == TYPE_PRECISION (long_long_integer_type_node)) + return (unsignedp ? long_long_unsigned_type_node + : long_long_integer_type_node); + return build_nonstandard_integer_type (width, unsignedp); +} + /* The C version of the register_builtin_type langhook. */ void diff --git a/gcc/c-common.h b/gcc/c-common.h index 9301f26aa0d..73ee101b621 100644 --- a/gcc/c-common.h +++ b/gcc/c-common.h @@ -713,6 +713,7 @@ extern tree c_common_fixed_point_type_for_size (unsigned int, unsigned int, extern tree c_common_unsigned_type (tree); extern tree c_common_signed_type (tree); extern tree c_common_signed_or_unsigned_type (int, tree); +extern tree c_build_bitfield_integer_type (unsigned HOST_WIDE_INT, int); extern bool decl_with_nonnull_addr_p (const_tree); extern tree c_common_truthvalue_conversion (location_t, tree); extern void c_apply_type_quals_to_decl (int, tree); diff --git a/gcc/c-decl.c b/gcc/c-decl.c index bad30b0c410..081e7c4da8e 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -5643,7 +5643,7 @@ finish_struct (tree t, tree fieldlist, tree attributes) if (width != TYPE_PRECISION (type)) { TREE_TYPE (*fieldlistp) - = make_bitfield_integer_type (width, TYPE_UNSIGNED (type)); + = c_build_bitfield_integer_type (width, TYPE_UNSIGNED (type)); DECL_MODE (*fieldlistp) = TYPE_MODE (TREE_TYPE (*fieldlistp)); } DECL_INITIAL (*fieldlistp) = 0; diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 620814bb229..cf105602c43 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -4981,8 +4981,8 @@ layout_class_type (tree t, tree *virtuals_p) if (width != TYPE_PRECISION (ftype)) { TREE_TYPE (field) - = make_bitfield_integer_type (width, - TYPE_UNSIGNED (ftype)); + = c_build_bitfield_integer_type (width, + TYPE_UNSIGNED (ftype)); TREE_TYPE (field) = cp_build_qualified_type (TREE_TYPE (field), TYPE_QUALS (ftype)); diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index 48969ae3e61..581cb89d3c6 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -1959,31 +1959,6 @@ make_unsigned_type (int precision) fixup_unsigned_type (type); return type; } - -/* Build a bit-field integer type for the given WIDTH and UNSIGNEDP. */ - -tree -make_bitfield_integer_type (unsigned HOST_WIDE_INT width, int unsignedp) -{ - /* Extended integer types of the same width as a standard type have - lesser rank, so those of the same width as int promote to int or - unsigned int and are valid for printf formats expecting int or - unsigned int. To avoid such special cases, avoid creating - extended integer types for bit-fields if a standard integer type - is available. */ - if (width == TYPE_PRECISION (integer_type_node)) - return unsignedp ? unsigned_type_node : integer_type_node; - if (width == TYPE_PRECISION (signed_char_type_node)) - return unsignedp ? unsigned_char_type_node : signed_char_type_node; - if (width == TYPE_PRECISION (short_integer_type_node)) - return unsignedp ? short_unsigned_type_node : short_integer_type_node; - if (width == TYPE_PRECISION (long_integer_type_node)) - return unsignedp ? long_unsigned_type_node : long_integer_type_node; - if (width == TYPE_PRECISION (long_long_integer_type_node)) - return (unsignedp ? long_long_unsigned_type_node - : long_long_integer_type_node); - return build_nonstandard_integer_type (width, unsignedp); -} /* Create and return a type for fract of PRECISION bits, UNSIGNEDP, and SATP. */ diff --git a/gcc/tree.h b/gcc/tree.h index 8b8d8f27082..6cac393a5d2 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -4020,7 +4020,6 @@ extern tree build_call_array (tree, tree, int, tree*); extern tree make_signed_type (int); extern tree make_unsigned_type (int); -extern tree make_bitfield_integer_type (unsigned HOST_WIDE_INT, int); extern tree signed_or_unsigned_type_for (int, tree); extern tree signed_type_for (tree); extern tree unsigned_type_for (tree); |