]> gcc.gnu.org Git - gcc.git/commitdiff
c-decl.c (finish_decl): Don't call get_pending_sizes.
authorJoseph Myers <joseph@codesourcery.com>
Thu, 5 May 2011 10:20:31 +0000 (11:20 +0100)
committerJoseph Myers <jsm28@gcc.gnu.org>
Thu, 5 May 2011 10:20:31 +0000 (11:20 +0100)
* c-decl.c (finish_decl): Don't call get_pending_sizes.
(grokparm): Add parameter expr.  Pass it to grokdeclarator.
(push_parm_decl): Add parameter expr.  Pass it to grokdeclarator.
(c_variable_size): Remove.
(grokdeclarator): Use save_expr instead of c_variable_size.  Don't
call put_pending_sizes.
(get_parm_info): Add parameter expr.  Use it to set
arg_info->pending_sizes.
(store_parm_decls): Use arg_info->pending_sizes instead or calling
get_pending_sizes.
* c-parser.c (c_parser_parms_declarator): Update call to
c_parser_parms_list_declarator.
(c_parser_parms_list_declarator): Take parameter expr.  Update
call to push_parm_decl.  Update recursive call.  Don't call
get_pending_sizes.  Update calls to get_parm_info.
(c_parser_objc_method_definition): Update calls to
c_parser_objc_method_decl and objc_start_method_definition.
(c_parser_objc_methodproto): Update call to
c_parser_objc_method_decl.
(c_parser_objc_method_decl): Add parameter expr.  Update call to
grokparm.
(c_parser_objc_try_catch_finally_statement): Update call to
grokparm.
* c-tree.h (struct c_arg_info.pending_sizes): Change to a tree.
(get_parm_info, grokparm, push_parm_decl): Update prototypes.

c-family:
* c-objc.h (objc_start_method_definition): Update prototype.
* stub-objc.c (objc_start_method_definition): Add extra parameter.

cp:
* parser.c (cp_parser_objc_method_definition_list): Update call to
objc_start_method_definition.

objc:
* objc-act.c (objc_start_method_definition): Add parameter expr.
Update call to start_method_def.
(objc_generate_cxx_ctor_or_dtor, objc_synthesize_getter,
objc_synthesize_setter) Update calls to
objc_start_method_definition.
(objc_get_parm_info): Add parameter expr.  Update call to
get_parm_info.
(start_method_def): Add parameter expr.  Update call to
objc_get_parm_info.
* objc-gnu-runtime-abi-01.c (build_module_initializer_routine):
Update call to objc_get_parm_info.
* objc-runtime-shared-support.h (objc_get_parm_info): Add extra
parameter.

From-SVN: r173422

13 files changed:
gcc/ChangeLog
gcc/c-decl.c
gcc/c-family/ChangeLog
gcc/c-family/c-objc.h
gcc/c-family/stub-objc.c
gcc/c-parser.c
gcc/c-tree.h
gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/objc/ChangeLog
gcc/objc/objc-act.c
gcc/objc/objc-gnu-runtime-abi-01.c
gcc/objc/objc-runtime-shared-support.h

index 8ca49a51ae5fe5ef229a8786e75991ed97a48163..e127a736e55f0326a58fce944dfabedd118015de 100644 (file)
@@ -1,3 +1,31 @@
+2011-05-05  Joseph Myers  <joseph@codesourcery.com>
+
+       * c-decl.c (finish_decl): Don't call get_pending_sizes.
+       (grokparm): Add parameter expr.  Pass it to grokdeclarator.
+       (push_parm_decl): Add parameter expr.  Pass it to grokdeclarator.
+       (c_variable_size): Remove.
+       (grokdeclarator): Use save_expr instead of c_variable_size.  Don't
+       call put_pending_sizes.
+       (get_parm_info): Add parameter expr.  Use it to set
+       arg_info->pending_sizes.
+       (store_parm_decls): Use arg_info->pending_sizes instead or calling
+       get_pending_sizes.
+       * c-parser.c (c_parser_parms_declarator): Update call to
+       c_parser_parms_list_declarator.
+       (c_parser_parms_list_declarator): Take parameter expr.  Update
+       call to push_parm_decl.  Update recursive call.  Don't call
+       get_pending_sizes.  Update calls to get_parm_info.
+       (c_parser_objc_method_definition): Update calls to
+       c_parser_objc_method_decl and objc_start_method_definition.
+       (c_parser_objc_methodproto): Update call to
+       c_parser_objc_method_decl.
+       (c_parser_objc_method_decl): Add parameter expr.  Update call to
+       grokparm.
+       (c_parser_objc_try_catch_finally_statement): Update call to
+       grokparm.
+       * c-tree.h (struct c_arg_info.pending_sizes): Change to a tree.
+       (get_parm_info, grokparm, push_parm_decl): Update prototypes.
+
 2011-05-05  Michael Hope  <michael.hope@linaro.org>
 
        PR pch/45979
index 9b217d26de5eb79128f89ce7dacddb784a52e6df..6bc094892146b8149ef30bdd5ed47670eba5385f 100644 (file)
@@ -1,6 +1,6 @@
 /* Process declarations and variables for C compiler.
    Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
    Free Software Foundation, Inc.
 
 This file is part of GCC.
@@ -4428,12 +4428,6 @@ finish_decl (tree decl, location_t init_loc, tree init,
       rest_of_decl_compilation (decl, DECL_FILE_SCOPE_P (decl), 0);
     }
 
-  /* At the end of a declaration, throw away any variable type sizes
-     of types defined inside that declaration.  There is no use
-     computing them in the following function definition.  */
-  if (current_scope == file_scope)
-    get_pending_sizes ();
-
   /* Install a cleanup (aka destructor) if one was given.  */
   if (TREE_CODE (decl) == VAR_DECL && !TREE_STATIC (decl))
     {
@@ -4478,14 +4472,17 @@ finish_decl (tree decl, location_t init_loc, tree init,
     }
 }
 
-/* Given a parsed parameter declaration, decode it into a PARM_DECL.  */
+/* Given a parsed parameter declaration, decode it into a PARM_DECL.
+   EXPR is NULL or a pointer to an expression that needs to be
+   evaluated for the side effects of array size expressions in the
+   parameters.  */
 
 tree
-grokparm (const struct c_parm *parm)
+grokparm (const struct c_parm *parm, tree *expr)
 {
   tree attrs = parm->attrs;
   tree decl = grokdeclarator (parm->declarator, parm->specs, PARM, false,
-                             NULL, &attrs, NULL, NULL, DEPRECATED_NORMAL);
+                             NULL, &attrs, expr, NULL, DEPRECATED_NORMAL);
 
   decl_attributes (&decl, attrs, 0);
 
@@ -4493,16 +4490,18 @@ grokparm (const struct c_parm *parm)
 }
 
 /* Given a parsed parameter declaration, decode it into a PARM_DECL
-   and push that on the current scope.  */
+   and push that on the current scope.  EXPR is a pointer to an
+   expression that needs to be evaluated for the side effects of array
+   size expressions in the parameters.  */
 
 void
-push_parm_decl (const struct c_parm *parm)
+push_parm_decl (const struct c_parm *parm, tree *expr)
 {
   tree attrs = parm->attrs;
   tree decl;
 
   decl = grokdeclarator (parm->declarator, parm->specs, PARM, false, NULL,
-                        &attrs, NULL, NULL, DEPRECATED_NORMAL);
+                        &attrs, expr, NULL, DEPRECATED_NORMAL);
   decl_attributes (&decl, attrs, 0);
 
   decl = pushdecl (decl);
@@ -4789,34 +4788,6 @@ warn_variable_length_array (tree name, tree size)
     }
 }
 
-/* Given a size SIZE that may not be a constant, return a SAVE_EXPR to
-   serve as the actual size-expression for a type or decl.  This is
-   like variable_size in stor-layout.c, but we make global_bindings_p
-   return negative to avoid calls to that function from outside the
-   front end resulting in errors at file scope, then call this version
-   instead from front-end code.  */
-
-static tree
-c_variable_size (tree size)
-{
-  tree save;
-
-  if (TREE_CONSTANT (size))
-    return size;
-
-  size = save_expr (size);
-
-  save = skip_simple_arithmetic (size);
-
-  if (cfun && cfun->dont_save_pending_sizes_p)
-    return size;
-
-  if (!global_bindings_p ())
-    put_pending_size (save);
-
-  return size;
-}
-
 /* Given declspecs and a declarator,
    determine the name and type of the object declared
    and construct a ..._DECL node for it.
@@ -5354,7 +5325,7 @@ grokdeclarator (const struct c_declarator *declarator,
                       MINUS_EXPR, which allows the -1 to get folded
                       with the +1 that happens when building TYPE_SIZE.  */
                    if (size_varies)
-                     size = c_variable_size (size);
+                     size = save_expr (size);
                    if (this_size_varies && TREE_CODE (size) == INTEGER_CST)
                      size = build2 (COMPOUND_EXPR, TREE_TYPE (size),
                                     integer_zero_node, size);
@@ -5573,8 +5544,6 @@ grokdeclarator (const struct c_declarator *declarator,
               inner layer of declarator.  */
            arg_info = declarator->u.arg_info;
            arg_types = grokparms (arg_info, really_funcdef);
-           if (really_funcdef)
-             put_pending_sizes (arg_info->pending_sizes);
 
            /* Type qualifiers before the return type of the function
               qualify the return type, not the function type.  */
@@ -6265,10 +6234,13 @@ build_arg_info (void)
    This structure is later fed to 'grokparms' and 'store_parm_decls'.
 
    ELLIPSIS being true means the argument list ended in '...' so don't
-   append a sentinel (void_list_node) to the end of the type-list.  */
+   append a sentinel (void_list_node) to the end of the type-list.
+
+   EXPR is NULL or an expression that needs to be evaluated for the
+   side effects of array size expressions in the parameters.  */
 
 struct c_arg_info *
-get_parm_info (bool ellipsis)
+get_parm_info (bool ellipsis, tree expr)
 {
   struct c_binding *b = current_scope->bindings;
   struct c_arg_info *arg_info = build_arg_info ();
@@ -6444,7 +6416,7 @@ get_parm_info (bool ellipsis)
   arg_info->tags = tags;
   arg_info->types = types;
   arg_info->others = others;
-  arg_info->pending_sizes = get_pending_sizes ();
+  arg_info->pending_sizes = expr;
   return arg_info;
 }
 \f
@@ -8199,14 +8171,8 @@ store_parm_decls (void)
      because we throw away the array type in favor of a pointer type, and
      thus won't naturally see the SAVE_EXPR containing the increment.  All
      other pending sizes would be handled by gimplify_parameters.  */
-  {
-    VEC(tree,gc) *pending_sizes = get_pending_sizes ();
-    tree t;
-    int i;
-
-    FOR_EACH_VEC_ELT (tree, pending_sizes, i, t)
-      add_stmt (t);
-  }
+  if (arg_info->pending_sizes)
+    add_stmt (arg_info->pending_sizes);
 
   /* Even though we're inside a function body, we still don't want to
      call expand_expr to calculate the size of a variable-sized array.
index 55c03b30ddfae1d71de1948bdb98b5f949a42e14..d3edc6cdd742e6c096a78d6695358eaa714985d3 100644 (file)
@@ -1,3 +1,8 @@
+2011-05-05  Joseph Myers  <joseph@codesourcery.com>
+
+       * c-objc.h (objc_start_method_definition): Update prototype.
+       * stub-objc.c (objc_start_method_definition): Add extra parameter.
+
 2011-05-04  Nathan Froyd  <froydnj@codesourcery.com>
 
        * c-common.c (check_main_parameter_types): Reindent.  Don't use
index 33e9f9d66f1a5d38c4b272622a6f39bc5d76bfa9..b32c5962a059b6b7adb18dbc8f9cb46b45c800bb 100644 (file)
@@ -1,6 +1,6 @@
 /* Definitions of Objective-C front-end entry points used for C and C++.
    Copyright (C) 1987, 1993, 1994, 1995, 1997, 1998,
-   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
+   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
    Free Software Foundation, Inc.
 
 This file is part of GCC.
@@ -75,7 +75,7 @@ extern void objc_finish_implementation (void);
 extern void objc_set_visibility (objc_ivar_visibility_kind);
 extern tree objc_build_method_signature (bool, tree, tree, tree, bool);
 extern void objc_add_method_declaration (bool, tree, tree);
-extern bool objc_start_method_definition (bool, tree, tree);
+extern bool objc_start_method_definition (bool, tree, tree, tree);
 extern void objc_finish_method_definition (tree);
 extern void objc_add_instance_variable (tree);
 extern tree objc_build_keyword_decl (tree, tree, tree, tree);
index 26ea3c87dab6ac5a9eb577877e809a532ac8a02b..3dacac5b0e25310aec95d282d0c72cc52ba8747c 100644 (file)
@@ -2,7 +2,7 @@
    that are called from within the C and C++ front-ends,
    respectively.
    Copyright (C) 1991, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-   2004, 2005, 2007, 2009, 2010 Free Software Foundation, Inc.
+   2004, 2005, 2007, 2009, 2010, 2011 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -204,7 +204,8 @@ objc_add_method_declaration (bool ARG_UNUSED (is_class_method),
 bool
 objc_start_method_definition (bool ARG_UNUSED (is_class_method),
                              tree ARG_UNUSED (signature),
-                             tree ARG_UNUSED (attributes))
+                             tree ARG_UNUSED (attributes),
+                             tree ARG_UNUSED (expr))
 {
   return true;
 }
index 698a080d4527d52bf57b5c587653eb8055cdc2fe..241bc38167558ee582c5f94716bd33c54ca4e768 100644 (file)
@@ -1110,7 +1110,8 @@ static struct c_declarator *c_parser_direct_declarator_inner (c_parser *,
                                                              bool,
                                                              struct c_declarator *);
 static struct c_arg_info *c_parser_parms_declarator (c_parser *, bool, tree);
-static struct c_arg_info *c_parser_parms_list_declarator (c_parser *, tree);
+static struct c_arg_info *c_parser_parms_list_declarator (c_parser *, tree,
+                                                         tree);
 static struct c_parm *c_parser_parameter_declaration (c_parser *, tree);
 static tree c_parser_simple_asm_expr (c_parser *);
 static tree c_parser_attributes (c_parser *);
@@ -1173,7 +1174,7 @@ static bool c_parser_objc_method_type (c_parser *);
 static void c_parser_objc_method_definition (c_parser *);
 static void c_parser_objc_methodprotolist (c_parser *);
 static void c_parser_objc_methodproto (c_parser *);
-static tree c_parser_objc_method_decl (c_parser *, bool, tree *);
+static tree c_parser_objc_method_decl (c_parser *, bool, tree *, tree *);
 static tree c_parser_objc_type_name (c_parser *);
 static tree c_parser_objc_protocol_refs (c_parser *);
 static void c_parser_objc_try_catch_finally_statement (c_parser *);
@@ -3101,7 +3102,8 @@ c_parser_parms_declarator (c_parser *parser, bool id_list_ok, tree attrs)
     }
   else
     {
-      struct c_arg_info *ret = c_parser_parms_list_declarator (parser, attrs);
+      struct c_arg_info *ret = c_parser_parms_list_declarator (parser, attrs,
+                                                              NULL);
       pop_scope ();
       return ret;
     }
@@ -3109,12 +3111,15 @@ c_parser_parms_declarator (c_parser *parser, bool id_list_ok, tree attrs)
 
 /* Parse a parameter list (possibly empty), including the closing
    parenthesis but not the opening one.  ATTRS are the attributes at
-   the start of the list.  */
+   the start of the list.  EXPR is NULL or an expression that needs to
+   be evaluated for the side effects of array size expressions in the
+   parameters.  */
 
 static struct c_arg_info *
-c_parser_parms_list_declarator (c_parser *parser, tree attrs)
+c_parser_parms_list_declarator (c_parser *parser, tree attrs, tree expr)
 {
   bool bad_parm = false;
+
   /* ??? Following the old parser, forward parameter declarations may
      use abstract declarators, and if no real parameter declarations
      follow the forward declarations then this is not diagnosed.  Also
@@ -3158,31 +3163,27 @@ c_parser_parms_list_declarator (c_parser *parser, tree attrs)
       if (parm == NULL)
        bad_parm = true;
       else
-       push_parm_decl (parm);
+       push_parm_decl (parm, &expr);
       if (c_parser_next_token_is (parser, CPP_SEMICOLON))
        {
          tree new_attrs;
          c_parser_consume_token (parser);
          mark_forward_parm_decls ();
          new_attrs = c_parser_attributes (parser);
-         return c_parser_parms_list_declarator (parser, new_attrs);
+         return c_parser_parms_list_declarator (parser, new_attrs, expr);
        }
       if (c_parser_next_token_is (parser, CPP_CLOSE_PAREN))
        {
          c_parser_consume_token (parser);
          if (bad_parm)
-           {
-             get_pending_sizes ();
-             return NULL;
-           }
+           return NULL;
          else
-           return get_parm_info (false);
+           return get_parm_info (false, expr);
        }
       if (!c_parser_require (parser, CPP_COMMA,
                             "expected %<;%>, %<,%> or %<)%>"))
        {
          c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, NULL);
-         get_pending_sizes ();
          return NULL;
        }
       if (c_parser_next_token_is (parser, CPP_ELLIPSIS))
@@ -3192,18 +3193,14 @@ c_parser_parms_list_declarator (c_parser *parser, tree attrs)
            {
              c_parser_consume_token (parser);
              if (bad_parm)
-               {
-                 get_pending_sizes ();
-                 return NULL;
-               }
+               return NULL;
              else
-               return get_parm_info (true);
+               return get_parm_info (true, expr);
            }
          else
            {
              c_parser_skip_until_found (parser, CPP_CLOSE_PAREN,
                                         "expected %<)%>");
-             get_pending_sizes ();
              return NULL;
            }
        }
@@ -7164,9 +7161,10 @@ static void
 c_parser_objc_method_definition (c_parser *parser)
 {
   bool is_class_method = c_parser_objc_method_type (parser);
-  tree decl, attributes = NULL_TREE;
+  tree decl, attributes = NULL_TREE, expr = NULL_TREE;
   parser->objc_pq_context = true;
-  decl = c_parser_objc_method_decl (parser, is_class_method, &attributes);
+  decl = c_parser_objc_method_decl (parser, is_class_method, &attributes,
+                                   &expr);
   if (decl == error_mark_node)
     return;  /* Bail here. */
 
@@ -7184,7 +7182,7 @@ c_parser_objc_method_definition (c_parser *parser)
     }
 
   parser->objc_pq_context = false;
-  if (objc_start_method_definition (is_class_method, decl, attributes))
+  if (objc_start_method_definition (is_class_method, decl, attributes, expr))
     {
       add_stmt (c_parser_compound_statement (parser));
       objc_finish_method_definition (current_function_decl);
@@ -7275,7 +7273,8 @@ c_parser_objc_methodproto (c_parser *parser)
 
   /* Remember protocol qualifiers in prototypes.  */
   parser->objc_pq_context = true;
-  decl = c_parser_objc_method_decl (parser, is_class_method, &attributes);
+  decl = c_parser_objc_method_decl (parser, is_class_method, &attributes,
+                                   NULL);
   /* Forget protocol qualifiers now.  */
   parser->objc_pq_context = false;
 
@@ -7361,7 +7360,8 @@ c_parser_objc_maybe_method_attributes (c_parser* parser, tree* attributes)
 */
 
 static tree
-c_parser_objc_method_decl (c_parser *parser, bool is_class_method, tree *attributes)
+c_parser_objc_method_decl (c_parser *parser, bool is_class_method,
+                          tree *attributes, tree *expr)
 {
   tree type = NULL_TREE;
   tree sel;
@@ -7436,7 +7436,7 @@ c_parser_objc_method_decl (c_parser *parser, bool is_class_method, tree *attribu
          if (parm == NULL)
            break;
          parms = chainon (parms,
-                          build_tree_list (NULL_TREE, grokparm (parm)));
+                          build_tree_list (NULL_TREE, grokparm (parm, expr)));
        }
       sel = list;
     }
@@ -7600,7 +7600,7 @@ c_parser_objc_try_catch_finally_statement (c_parser *parser)
          if (parm == NULL)
            parameter_declaration = error_mark_node;
          else
-           parameter_declaration = grokparm (parm);
+           parameter_declaration = grokparm (parm, NULL);
        }
       if (seen_open_paren)
        c_parser_require (parser, CPP_CLOSE_PAREN, "expected %<)%>");
index 8e8836242708e497dce05454b1a65adb2565548c..97a4e55cd12af4d7800a81c7028df8f6aa3219a2 100644 (file)
@@ -1,6 +1,6 @@
 /* Definitions for C parsing and type checking.
    Copyright (C) 1987, 1993, 1994, 1995, 1997, 1998,
-   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
+   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
    Free Software Foundation, Inc.
 
 This file is part of GCC.
@@ -315,11 +315,12 @@ struct c_arg_info {
   /* A list of non-parameter decls (notably enumeration constants)
      defined with the parameters.  */
   tree others;
-  /* A VEC of VLA sizes from the parameters.  In a function
-     definition, these are used to ensure that side-effects in sizes
-     of arrays converted to pointers (such as a parameter int i[n++])
-     take place; otherwise, they are ignored.  */
-  VEC(tree,gc) *pending_sizes;
+  /* A compound expression of VLA sizes from the parameters, or NULL.
+     In a function definition, these are used to ensure that
+     side-effects in sizes of arrays converted to pointers (such as a
+     parameter int i[n++]) take place; otherwise, they are
+     ignored.  */
+  tree pending_sizes;
   /* True when these arguments had [*].  */
   BOOL_BITFIELD had_vla_unspec : 1;
 };
@@ -445,17 +446,17 @@ extern void finish_function (void);
 extern tree finish_struct (location_t, tree, tree, tree,
                           struct c_struct_parse_info *);
 extern struct c_arg_info *build_arg_info (void);
-extern struct c_arg_info *get_parm_info (bool);
+extern struct c_arg_info *get_parm_info (bool, tree);
 extern tree grokfield (location_t, struct c_declarator *,
                       struct c_declspecs *, tree, tree *);
 extern tree groktypename (struct c_type_name *, tree *, bool *);
-extern tree grokparm (const struct c_parm *);
+extern tree grokparm (const struct c_parm *, tree *);
 extern tree implicitly_declare (location_t, tree);
 extern void keep_next_level (void);
 extern void pending_xref_error (void);
 extern void c_push_function_context (void);
 extern void c_pop_function_context (void);
-extern void push_parm_decl (const struct c_parm *);
+extern void push_parm_decl (const struct c_parm *, tree *);
 extern struct c_declarator *set_array_declarator_inner (struct c_declarator *,
                                                        struct c_declarator *);
 extern tree c_builtin_function (tree);
index ae3ac934fa064d9e33734a6f1546dd1e503c8738..7586ea61b39bc3b8eefbbd23012d3d0075243b24 100644 (file)
@@ -1,3 +1,8 @@
+2011-05-05  Joseph Myers  <joseph@codesourcery.com>
+
+       * parser.c (cp_parser_objc_method_definition_list): Update call to
+       objc_start_method_definition.
+
 2011-05-04  Jason Merrill  <jason@redhat.com>
 
        PR c++/48749
index 9ec571e793c59eb473a807c617f5d64ec3b7b6ea..82495b65c0a25f12996780d7eee52d1556277988 100644 (file)
@@ -22256,7 +22256,8 @@ cp_parser_objc_method_definition_list (cp_parser* parser)
              token = cp_lexer_peek_token (parser->lexer);
              continue;
            }
-         objc_start_method_definition (is_class_method, sig, attribute);
+         objc_start_method_definition (is_class_method, sig, attribute,
+                                       NULL_TREE);
 
          /* For historical reasons, we accept an optional semicolon.  */
          if (cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON))
index f31a75419a9b6c7235070d2a8702dfb4bb15d5a6..8706175d2779272d03ec09a82a06d8c830b91905 100644 (file)
@@ -1,3 +1,19 @@
+2011-05-05  Joseph Myers  <joseph@codesourcery.com>
+
+       * objc-act.c (objc_start_method_definition): Add parameter expr.
+       Update call to start_method_def.
+       (objc_generate_cxx_ctor_or_dtor, objc_synthesize_getter,
+       objc_synthesize_setter) Update calls to
+       objc_start_method_definition.
+       (objc_get_parm_info): Add parameter expr.  Update call to
+       get_parm_info.
+       (start_method_def): Add parameter expr.  Update call to
+       objc_get_parm_info.
+       * objc-gnu-runtime-abi-01.c (build_module_initializer_routine):
+       Update call to objc_get_parm_info.
+       * objc-runtime-shared-support.h (objc_get_parm_info): Add extra
+       parameter.
+
 2011-04-26  Jason Merrill  <jason@redhat.com>
 
        * objc-act.c (objc_fold_objc_type_ref): Remove.
index 025f37544f9ec637208611fa4899d4f46072e591..46cfc554b61443bbcd27285b4c823af016c0c235 100644 (file)
@@ -126,7 +126,7 @@ static void synth_module_prologue (void);
 static tree start_class (enum tree_code, tree, tree, tree, tree);
 static tree continue_class (tree);
 static void finish_class (tree);
-static void start_method_def (tree);
+static void start_method_def (tree, tree);
 
 static tree start_protocol (enum tree_code, tree, tree, tree);
 static tree build_method_decl (enum tree_code, tree, tree, tree, bool);
@@ -2041,9 +2041,12 @@ objc_add_method_declaration (bool is_class_method, tree decl, tree attributes)
 
 /* Return 'true' if the method definition could be started, and
    'false' if not (because we are outside an @implementation context).
+   EXPR is NULL or an expression that needs to be evaluated for the
+   side effects of array size expressions in the parameters.
 */
 bool
-objc_start_method_definition (bool is_class_method, tree decl, tree attributes)
+objc_start_method_definition (bool is_class_method, tree decl, tree attributes,
+                             tree expr)
 {
   if (!objc_implementation_context)
     {
@@ -2070,7 +2073,7 @@ objc_start_method_definition (bool is_class_method, tree decl, tree attributes)
                   decl,
                   is_class_method,
                   /* is optional */ false);
-  start_method_def (decl);
+  start_method_def (decl, expr);
   return true;
 }
 
@@ -4557,7 +4560,7 @@ objc_generate_cxx_ctor_or_dtor (bool dtor)
                                                  ? TAG_CXX_DESTRUCT
                                                  : TAG_CXX_CONSTRUCT),
                                  make_node (TREE_LIST),
-                                 false), NULL);
+                                 false), NULL, NULL_TREE);
   body = begin_function_body ();
   compound_stmt = begin_compound_stmt (0);
 
@@ -7214,7 +7217,8 @@ objc_synthesize_getter (tree klass, tree class_methods ATTRIBUTE_UNUSED, tree pr
   decl = copy_node (decl);
   DECL_SOURCE_LOCATION (decl) = location;
 
-  objc_start_method_definition (false /* is_class_method */, decl, NULL_TREE);
+  objc_start_method_definition (false /* is_class_method */, decl, NULL_TREE,
+                               NULL_TREE);
   body = c_begin_compound_stmt (true);
 
   /* Now we need to decide how we build the getter.  There are three
@@ -7393,7 +7397,8 @@ objc_synthesize_setter (tree klass, tree class_methods ATTRIBUTE_UNUSED, tree pr
   decl = copy_node (decl);
   DECL_SOURCE_LOCATION (decl) = DECL_SOURCE_LOCATION (property);
 
-  objc_start_method_definition (false /* is_class_method */, decl, NULL_TREE);
+  objc_start_method_definition (false /* is_class_method */, decl, NULL_TREE,
+                               NULL_TREE);
 
   body = c_begin_compound_stmt (true);
 
@@ -8287,7 +8292,8 @@ objc_push_parm (tree parm)
 
 #ifdef OBJCPLUS
 tree
-objc_get_parm_info (int have_ellipsis ATTRIBUTE_UNUSED)
+objc_get_parm_info (int have_ellipsis ATTRIBUTE_UNUSED,
+                   tree expr ATTRIBUTE_UNUSED)
 {
   tree parm_info = objc_parmlist;
   objc_parmlist = NULL_TREE;
@@ -8296,7 +8302,7 @@ objc_get_parm_info (int have_ellipsis ATTRIBUTE_UNUSED)
 }
 #else
 struct c_arg_info *
-objc_get_parm_info (int have_ellipsis)
+objc_get_parm_info (int have_ellipsis, tree expr)
 {
   tree parm_info = objc_parmlist;
   struct c_arg_info *arg_info;
@@ -8313,7 +8319,7 @@ objc_get_parm_info (int have_ellipsis)
       finish_decl (parm_info, input_location, NULL_TREE, NULL_TREE, NULL_TREE);
       parm_info = next;
     }
-  arg_info = get_parm_info (have_ellipsis);
+  arg_info = get_parm_info (have_ellipsis, expr);
   pop_scope ();
   objc_parmlist = NULL_TREE;
   return arg_info;
@@ -8348,10 +8354,12 @@ synth_self_and_ucmd_args (void)
 
 /* Transform an Objective-C method definition into a static C function
    definition, synthesizing the first two arguments, "self" and "_cmd",
-   in the process.  */
+   in the process.  EXPR is NULL or an expression that needs to be
+   evaluated for the side effects of array size expressions in the
+   parameters.  */
 
 static void
-start_method_def (tree method)
+start_method_def (tree method, tree expr)
 {
   tree parmlist;
 #ifdef OBJCPLUS
@@ -8406,7 +8414,7 @@ start_method_def (tree method)
        have_ellipsis = 1;
     }
 
-  parm_info = objc_get_parm_info (have_ellipsis);
+  parm_info = objc_get_parm_info (have_ellipsis, expr);
 
   really_start_method (objc_method_context, parm_info);
 }
index fdeebea18c43d42c1c9c62eff1f00d77bd037fb0..863f7d66cdf0e2e917902edf92a0891f6a05877f 100644 (file)
@@ -948,7 +948,7 @@ build_module_initializer_routine (void)
 #else
   objc_start_function (get_identifier (TAG_GNUINIT),
                       build_function_type_list (void_type_node, NULL_TREE),
-                      NULL_TREE, objc_get_parm_info (0));
+                      NULL_TREE, objc_get_parm_info (0, NULL_TREE));
 #endif
   body = c_begin_compound_stmt (true);
   add_stmt (build_function_call
index ace9039552a912e377fb236195dc6d649386923b..c948cfdba989ed90ec930e68f445e64c4aa2de7a 100644 (file)
@@ -43,10 +43,10 @@ extern void add_class_reference (tree);
 
 #ifdef OBJCPLUS
 extern void objc_start_function (tree, tree, tree, tree);
-extern tree objc_get_parm_info (int);
+extern tree objc_get_parm_info (int, tree);
 #else
 extern void objc_start_function (tree, tree, tree, struct c_arg_info *);
-extern struct c_arg_info *objc_get_parm_info (int);
+extern struct c_arg_info *objc_get_parm_info (int, tree);
 #endif
 extern void objc_push_parm (tree);
 extern tree get_arg_type_list (tree, int, int);
This page took 0.126992 seconds and 5 git commands to generate.