> Well - the errors in variable_size aren't used by C any more (since 4.5), > but I don't know whether any other languages use them.
Apparently not, let's remove them. > And pending sizes are used to a limited extent for C (to handle side effects > in sizes of array parameters, as described in the comment > > /* ??? Insert the contents of the pending sizes list into the function > to be evaluated. The only reason left to have this is > void foo(int n, int array[n++]) > 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. */ > > ) although it would now be better to make use of the "expr" parameter to > grokdeclarator to replace this residual use of the pending sizes global > list. c-parser.c/c-decl.c are the only remaining users of pending sizes so it would indeed be desirable to change them so as to totally get rid of pending sizes. > Actually, it will probably be possible the eliminate the function > completely for C; there's no good reason to do more than calling save_expr > directly. > > if (TREE_CONSTANT (size)) > return size; > > Redundant, save_expr checks for constants. > > size = save_expr (size); > > The only necessary bit of c_variable_size once pending sizes are replaced > by a better scheme. > > save = skip_simple_arithmetic (size); > > Premature optimization. > > if (cfun && cfun->dont_save_pending_sizes_p) > return size; > > if (!global_bindings_p ()) > put_pending_size (save); > > No longer needed once pending sizes are replaced. > > return size; > > So this just becomes equivalent to save_expr. There is the CONTAINS_PLACEHOLDER_P check in the generic case but, yes, otherwise it's just a proxy for save_expr. -- Eric Botcazou