From patchwork Wed May 11 11:12:06 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 95139 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id A82561007D9 for ; Wed, 11 May 2011 21:12:27 +1000 (EST) Received: (qmail 18421 invoked by alias); 11 May 2011 11:12:23 -0000 Received: (qmail 18390 invoked by uid 22791); 11 May 2011 11:12:22 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 11 May 2011 11:12:08 +0000 Received: (qmail 2706 invoked from network); 11 May 2011 11:12:07 -0000 Received: from unknown (HELO digraph.polyomino.org.uk) (joseph@127.0.0.2) by mail.codesourcery.com with ESMTPA; 11 May 2011 11:12:07 -0000 Received: from jsm28 (helo=localhost) by digraph.polyomino.org.uk with local-esmtp (Exim 4.72) (envelope-from ) id 1QK7Ko-0007au-0u for gcc-patches@gcc.gnu.org; Wed, 11 May 2011 11:12:06 +0000 Date: Wed, 11 May 2011 11:12:06 +0000 (UTC) From: "Joseph S. Myers" To: gcc-patches@gcc.gnu.org Subject: Move some option settings to finish_options Message-ID: MIME-Version: 1.0 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org This patch moves some option settings from process_options to finish_options, making them avoid global state in the process, in preparation for moving parts of the target option override hook to be called from finish_options as well. (The idea is to minimize the amount of code in process_options above the call to targetm.target_option.override. Reordering code in the course of splitting the struct-based code from the global-state code is unavoidable, but moving this code now reduces the amount of reordering involved. I've checked the lang_hooks.post_options implementations and believe moving the target code past them should be safe.) Bootstrapped with no regressions on x86_64-unknown-linux-gnu. Applied to mainline. 2011-05-11 Joseph Myers * opts.c (finish_options): Move warning settings from process_options. * toplev.c (process_options): Move warning settings to finish_options. Index: gcc/toplev.c =================================================================== --- gcc/toplev.c (revision 173620) +++ gcc/toplev.c (working copy) @@ -1253,29 +1253,6 @@ process_options (void) maximum_field_alignment = initial_max_fld_align * BITS_PER_UNIT; - /* This replaces set_Wunused. */ - if (warn_unused_function == -1) - warn_unused_function = warn_unused; - if (warn_unused_label == -1) - warn_unused_label = warn_unused; - /* Wunused-parameter is enabled if both -Wunused -Wextra are enabled. */ - if (warn_unused_parameter == -1) - warn_unused_parameter = (warn_unused && extra_warnings); - if (warn_unused_variable == -1) - warn_unused_variable = warn_unused; - /* Wunused-but-set-parameter is enabled if both -Wunused -Wextra are - enabled. */ - if (warn_unused_but_set_parameter == -1) - warn_unused_but_set_parameter = (warn_unused && extra_warnings); - if (warn_unused_but_set_variable == -1) - warn_unused_but_set_variable = warn_unused; - if (warn_unused_value == -1) - warn_unused_value = warn_unused; - - /* This replaces set_Wextra. */ - if (warn_uninitialized == -1) - warn_uninitialized = extra_warnings; - /* Allow the front end to perform consistency checks and do further initialization based on the command line options. This hook also sets the original filename if appropriate (e.g. foo.i -> foo.c) Index: gcc/opts.c =================================================================== --- gcc/opts.c (revision 173620) +++ gcc/opts.c (working copy) @@ -807,6 +807,31 @@ finish_options (struct gcc_options *opts if (!opts->x_flag_tree_vectorize || !opts->x_flag_tree_loop_if_convert) maybe_set_param_value (PARAM_MAX_STORES_TO_SINK, 0, opts->x_param_values, opts_set->x_param_values); + + /* This replaces set_Wunused. */ + if (opts->x_warn_unused_function == -1) + opts->x_warn_unused_function = opts->x_warn_unused; + if (opts->x_warn_unused_label == -1) + opts->x_warn_unused_label = opts->x_warn_unused; + /* Wunused-parameter is enabled if both -Wunused -Wextra are enabled. */ + if (opts->x_warn_unused_parameter == -1) + opts->x_warn_unused_parameter = (opts->x_warn_unused + && opts->x_extra_warnings); + if (opts->x_warn_unused_variable == -1) + opts->x_warn_unused_variable = opts->x_warn_unused; + /* Wunused-but-set-parameter is enabled if both -Wunused -Wextra are + enabled. */ + if (opts->x_warn_unused_but_set_parameter == -1) + opts->x_warn_unused_but_set_parameter = (opts->x_warn_unused + && opts->x_extra_warnings); + if (opts->x_warn_unused_but_set_variable == -1) + opts->x_warn_unused_but_set_variable = opts->x_warn_unused; + if (opts->x_warn_unused_value == -1) + opts->x_warn_unused_value = opts->x_warn_unused; + + /* This replaces set_Wextra. */ + if (opts->x_warn_uninitialized == -1) + opts->x_warn_uninitialized = opts->x_extra_warnings; } #define LEFT_COLUMN 27