]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c-decl.c (add_stmt): Add C frontend specific version.
authorIan Lance Taylor <ian@airs.com>
Sat, 28 May 2005 01:38:11 +0000 (01:38 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Sat, 28 May 2005 01:38:11 +0000 (01:38 +0000)
./: * c-decl.c (add_stmt): Add C frontend specific version.
(stmts_are_full_exprs_p): Remove.
* c-common.h (STMT_IS_FULL_EXPR_P): Remove.
(stmts_are_full_exprs_p): Don't declare.
* c-semantics.c (add_stmt): Remove.
cp/:
* semantics.c (add_stmt): Add C++ frontend specific version.
* cp-tree.h (STMT_IS_FULL_EXPR_P): Define.
(stmts_are_full_exprs_p): Declare.

From-SVN: r100289

gcc/ChangeLog
gcc/c-common.h
gcc/c-decl.c
gcc/c-semantics.c
gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/semantics.c

index 586f7626fb5d2db39765a8dde550feb796b64121..5530706a50b081f208b961cb0e789dcb51b74fc5 100644 (file)
@@ -1,3 +1,11 @@
+2005-05-27  Ian Lance Taylor  <ian@airs.com>
+
+       * c-decl.c (add_stmt): Add C frontend specific version.
+       (stmts_are_full_exprs_p): Remove.
+       * c-common.h (STMT_IS_FULL_EXPR_P): Remove.
+       (stmts_are_full_exprs_p): Don't declare.
+       * c-semantics.c (add_stmt): Remove.
+
 2005-05-27  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * config/mips/mips-protos.h (mips_declare_object): Add printf
index 4b860e2adeda0a16656ac13d7939f463ee4a0263..04b434616b222f044356633aba36562e958fd1fd 100644 (file)
@@ -31,7 +31,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
       IDENTIFIER_MARKED (used by search routines).
       DECL_PRETTY_FUNCTION_P (in VAR_DECL)
    1: C_DECLARED_LABEL_FLAG (in LABEL_DECL)
-      STMT_IS_FULL_EXPR_P (in _STMT)
       STATEMENT_LIST_STMT_EXPR (in STATEMENT_LIST)
    2: unused
    3: STATEMENT_LIST_HAS_LABEL (in STATEMENT_LIST)
@@ -704,12 +703,6 @@ extern void finish_file    (void);
 
 /* These macros provide convenient access to the various _STMT nodes.  */
 
-/* Nonzero if this statement should be considered a full-expression,
-   i.e., if temporaries created during this statement should have
-   their destructors run at the end of this statement.  (In C, this
-   will always be false, since there are no destructors.)  */
-#define STMT_IS_FULL_EXPR_P(NODE) TREE_LANG_FLAG_1 ((NODE))
-
 /* Nonzero if a given STATEMENT_LIST represents the outermost binding
    if a statement expression.  */
 #define STATEMENT_LIST_STMT_EXPR(NODE) \
@@ -735,7 +728,6 @@ enum c_tree_code {
 
 #undef DEFTREECODE
 
-extern int stmts_are_full_exprs_p (void);
 extern int anon_aggr_type_p (tree);
 
 /* For a VAR_DECL that is an anonymous union, these are the various
index d5e13abca878df88290857ae7c07b3a2df86447a..d36ceb563d2a706779794405493a886e460d58b7 100644 (file)
@@ -418,6 +418,31 @@ static tree grokdeclarator (const struct c_declarator *,
 static tree grokparms (struct c_arg_info *, bool);
 static void layout_array_type (tree);
 \f
+/* T is a statement.  Add it to the statement-tree.  This is the
+   C/ObjC version--C++ has a slightly different version of this
+   function.  */
+
+tree
+add_stmt (tree t)
+{
+  enum tree_code code = TREE_CODE (t);
+
+  if (EXPR_P (t) && code != LABEL_EXPR)
+    {
+      if (!EXPR_HAS_LOCATION (t))
+       SET_EXPR_LOCATION (t, input_location);
+    }
+
+  if (code == LABEL_EXPR || code == CASE_LABEL_EXPR)
+    STATEMENT_LIST_HAS_LABEL (cur_stmt_list) = 1;
+
+  /* Add T to the statement-tree.  Non-side-effect statements need to be
+     recorded during statement expressions.  */
+  append_to_statement_list_force (t, &cur_stmt_list);
+
+  return t;
+}
+\f
 /* States indicating how grokdeclarator() should handle declspecs marked
    with __attribute__((deprecated)).  An object declared as
    __attribute__((deprecated)) suppresses warnings of uses of other
@@ -6717,16 +6742,6 @@ c_dup_lang_specific_decl (tree decl)
    functions are not called from anywhere in the C front end, but as
    these changes continue, that will change.  */
 
-/* Returns nonzero if the current statement is a full expression,
-   i.e. temporaries created during that statement should be destroyed
-   at the end of the statement.  */
-
-int
-stmts_are_full_exprs_p (void)
-{
-  return 0;
-}
-
 /* Returns the stmt_tree (if any) to which statements are currently
    being added.  If there is no active statement-tree, NULL is
    returned.  */
index f7757c6ff82b73278fc66ac1fc4ddf719f99d67e..d2f9650a957aa7d88b3728cf7845d41157d8de8f 100644 (file)
@@ -101,33 +101,6 @@ pop_stmt_list (tree t)
   return t;
 }
 
-/* T is a statement.  Add it to the statement-tree.  */
-
-tree
-add_stmt (tree t)
-{
-  enum tree_code code = TREE_CODE (t);
-
-  if (EXPR_P (t) && code != LABEL_EXPR)
-    {
-      if (!EXPR_HAS_LOCATION (t))
-       SET_EXPR_LOCATION (t, input_location);
-
-      /* When we expand a statement-tree, we must know whether or not the
-        statements are full-expressions.  We record that fact here.  */
-      STMT_IS_FULL_EXPR_P (t) = stmts_are_full_exprs_p ();
-    }
-
-  if (code == LABEL_EXPR || code == CASE_LABEL_EXPR)
-    STATEMENT_LIST_HAS_LABEL (cur_stmt_list) = 1;
-
-  /* Add T to the statement-tree.  Non-side-effect statements need to be
-     recorded during statement expressions.  */
-  append_to_statement_list_force (t, &cur_stmt_list);
-
-  return t;
-}
-
 /* Build a generic statement based on the given type of node and
    arguments. Similar to `build_nt', except that we set
    EXPR_LOCATION to be the current source location.  */
index 29bd60037f501ffab3deeae7701596c550f60f88..2a9b21681226b2559277e3f48561ed184e9281ff 100644 (file)
@@ -1,3 +1,9 @@
+2005-05-27  Ian Lance Taylor  <ian@airs.com>
+
+       * semantics.c (add_stmt): Add C++ frontend specific version.
+       * cp-tree.h (STMT_IS_FULL_EXPR_P): Define.
+       (stmts_are_full_exprs_p): Declare.
+
 2005-05-27  Roger Sayle  <roger@eyesopen.com>
            Giovanni Bajo  <giovannibajo@gcc.gnu.org>
 
index fc0e20ce37c1eed539a9d9f71ef911b08f6fe7d1..f4f5a12c79bb753f03f2e54b639a72be847d88c9 100644 (file)
@@ -59,6 +59,7 @@ struct diagnostic_context;
       ICS_ELLIPSIS_FLAG (in _CONV)
       DECL_INITIALIZED_P (in VAR_DECL)
       TYPENAME_IS_CLASS_P (in TYPENAME_TYPE)
+      STMT_IS_FULL_EXPR_P (in _STMT)
    2: IDENTIFIER_OPNAME_P (in IDENTIFIER_NODE)
       ICS_THIS_FLAG (in _CONV)
       DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (in VAR_DECL)
@@ -259,6 +260,11 @@ typedef struct ptrmem_cst * ptrmem_cst_t;
 #define STATEMENT_LIST_TRY_BLOCK(NODE) \
   TREE_LANG_FLAG_2 (STATEMENT_LIST_CHECK (NODE))
 
+/* Nonzero if this statement should be considered a full-expression,
+   i.e., if temporaries created during this statement should have
+   their destructors run at the end of this statement.  */
+#define STMT_IS_FULL_EXPR_P(NODE) TREE_LANG_FLAG_1 ((NODE))
+
 /* Marks the result of a statement expression.  */
 #define EXPR_STMT_STMT_EXPR_RESULT(NODE) \
   TREE_LANG_FLAG_0 (EXPR_STMT_CHECK (NODE))
@@ -4063,6 +4069,7 @@ extern tree get_deferred_access_checks            (void);
 extern void pop_to_parent_deferring_access_checks      (void);
 extern void perform_deferred_access_checks     (void);
 extern void perform_or_defer_access_check      (tree, tree);
+extern int stmts_are_full_exprs_p              (void);
 extern void init_cp_semantics                   (void);
 extern tree do_poplevel                                (tree);
 extern void add_decl_expr                      (tree);
index 1316ef348888b126576bba6fffb6cb8549457cd1..d969a2463791bb072f9bd01dc3e60cf769267915 100644 (file)
@@ -340,6 +340,32 @@ stmts_are_full_exprs_p (void)
   return current_stmt_tree ()->stmts_are_full_exprs_p;
 }
 
+/* T is a statement.  Add it to the statement-tree.  This is the C++
+   version.  The C/ObjC frontends have a slightly different version of
+   this function.  */
+
+tree
+add_stmt (tree t)
+{
+  enum tree_code code = TREE_CODE (t);
+
+  if (EXPR_P (t) && code != LABEL_EXPR)
+    {
+      if (!EXPR_HAS_LOCATION (t))
+       SET_EXPR_LOCATION (t, input_location);
+
+      /* When we expand a statement-tree, we must know whether or not the
+        statements are full-expressions.  We record that fact here.  */
+      STMT_IS_FULL_EXPR_P (t) = stmts_are_full_exprs_p ();
+    }
+
+  /* Add T to the statement-tree.  Non-side-effect statements need to be
+     recorded during statement expressions.  */
+  append_to_statement_list_force (t, &cur_stmt_list);
+
+  return t;
+}
+
 /* Returns the stmt_tree (if any) to which statements are currently
    being added.  If there is no active statement-tree, NULL is
    returned.  */