diff options
author | Jason Merrill <jason@redhat.com> | 2001-08-24 08:07:46 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2001-08-24 08:07:46 -0400 |
commit | 0213a355281c1ce387d9fae4061d18f6b9bcd54e (patch) | |
tree | adef91f04544976faec6a008d13e5bd087582d2d /gcc/cp/semantics.c | |
parent | 2dc8352c90590135507210ce0638d31eaec88d0e (diff) | |
download | gcc-0213a355281c1ce387d9fae4061d18f6b9bcd54e.zip gcc-0213a355281c1ce387d9fae4061d18f6b9bcd54e.tar.gz gcc-0213a355281c1ce387d9fae4061d18f6b9bcd54e.tar.bz2 |
c-common.c (c_alignof, [...]): Move here...
* c-common.c (c_alignof, c_alignof_expr): Move here...
* c-typeck.c: ...from here.
* c-tree.h, c-common.h: Adjust.
* tree.c (cp_build_qualified_type_real): Use get_qualified_type.
(build_cplus_array_type): Use cp_build_qualified_type, not
TYPE_MAIN_VARIANT, to get an unqualified version.
* decl2.c (grok_alignof): Lose.
(build_expr_from_tree): Use expr_sizeof and c_alignof_expr.
* typeck.c (c_alignof): Lose.
* semantics.c (finish_sizeof, finish_alignof): New.
* parse.y: Use them.
* cp-tree.h: Declare them.
From-SVN: r45145
Diffstat (limited to 'gcc/cp/semantics.c')
-rw-r--r-- | gcc/cp/semantics.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index c295bde..fbfd756 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -2165,6 +2165,9 @@ check_multiple_declarators () cp_error ("multiple declarators in template declaration"); } +/* Implement the __typeof keyword: Return the type of EXPR, suitable for + use as a type-specifier. */ + tree finish_typeof (expr) tree expr; @@ -2185,6 +2188,31 @@ finish_typeof (expr) return TREE_TYPE (expr); } +/* Compute the value of the `sizeof' operator. */ + +tree +finish_sizeof (t) + tree t; +{ + if (processing_template_decl) + return build_min (SIZEOF_EXPR, sizetype, t); + + return TYPE_P (t) ? c_sizeof (t) : expr_sizeof (t); +} + +/* Implement the __alignof keyword: Return the minimum required + alignment of T, measured in bytes. */ + +tree +finish_alignof (t) + tree t; +{ + if (processing_template_decl) + return build_min (ALIGNOF_EXPR, sizetype, t); + + return TYPE_P (t) ? c_alignof (t) : c_alignof_expr (t); +} + /* Generate RTL for the statement T, and its substatements, and any other statements at its nesting level. */ |