From patchwork Thu Mar 3 02:44:07 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 85212 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 96B99B70DB for ; Thu, 3 Mar 2011 13:44:20 +1100 (EST) Received: (qmail 32194 invoked by alias); 3 Mar 2011 02:44:17 -0000 Received: (qmail 32134 invoked by uid 22791); 3 Mar 2011 02:44:16 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, TW_XG, 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; Thu, 03 Mar 2011 02:44:11 +0000 Received: (qmail 5106 invoked from network); 3 Mar 2011 02:44:09 -0000 Received: from unknown (HELO digraph.polyomino.org.uk) (joseph@127.0.0.2) by mail.codesourcery.com with ESMTPA; 3 Mar 2011 02:44:09 -0000 Received: from jsm28 (helo=localhost) by digraph.polyomino.org.uk with local-esmtp (Exim 4.72) (envelope-from ) id 1PuyWN-00073s-Uc; Thu, 03 Mar 2011 02:44:07 +0000 Date: Thu, 3 Mar 2011 02:44:07 +0000 (UTC) From: "Joseph S. Myers" To: gcc-patches@gcc.gnu.org cc: hp@axis.com Subject: [4.7] Avoid global state in cris_handle_option 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, for 4.7 and relative to a tree with applied, stops the CRIS handle_option hook from using global state. There was a macro CRIS_SUBTARGET_HANDLE_OPTION that did not have any parameters for state pointers, and whose only definition was empty; since the only definition was empty, I just removed the macro as useless rather than changing its interface to add more unused parameters. Tested building cc1 and xgcc for cross to cris-elf. Will commit to trunk for 4.7 in the absence of target maintainer objections. 2011-03-02 Joseph Myers * config/cris/cris.c (cris_handle_option): Access target_flags via opts pointer. Don't assert that global structures are in use. Don't call CRIS_SUBTARGET_HANDLE_OPTION. * config/cris/cris.h (CRIS_SUBTARGET_HANDLE_OPTION): Don't define. diff -rupN --exclude=.svn gcc-mainline-1/gcc/config/cris/cris.c gcc-mainline/gcc/config/cris/cris.c --- gcc-mainline-1/gcc/config/cris/cris.c 2011-02-23 14:14:58.000000000 -0800 +++ gcc-mainline/gcc/config/cris/cris.c 2011-03-02 12:45:53.000000000 -0800 @@ -2340,28 +2340,24 @@ cris_asm_output_case_end (FILE *stream, cris_option_override. */ static bool -cris_handle_option (struct gcc_options *opts, struct gcc_options *opts_set, +cris_handle_option (struct gcc_options *opts, + struct gcc_options *opts_set ATTRIBUTE_UNUSED, const struct cl_decoded_option *decoded, location_t loc ATTRIBUTE_UNUSED) { size_t code = decoded->opt_index; - const char *arg ATTRIBUTE_UNUSED = decoded->arg; - int value ATTRIBUTE_UNUSED = decoded->value; - - gcc_assert (opts == &global_options); - gcc_assert (opts_set == &global_options_set); switch (code) { case OPT_metrax100: - target_flags + opts->x_target_flags |= (MASK_SVINTO + MASK_ETRAX4_ADD + MASK_ALIGN_BY_32); break; case OPT_mno_etrax100: - target_flags + opts->x_target_flags &= ~(MASK_SVINTO + MASK_ETRAX4_ADD + MASK_ALIGN_BY_32); @@ -2369,7 +2365,7 @@ cris_handle_option (struct gcc_options * case OPT_m32_bit: case OPT_m32bit: - target_flags + opts->x_target_flags |= (MASK_STACK_ALIGN + MASK_CONST_ALIGN + MASK_DATA_ALIGN @@ -2378,7 +2374,7 @@ cris_handle_option (struct gcc_options * case OPT_m16_bit: case OPT_m16bit: - target_flags + opts->x_target_flags |= (MASK_STACK_ALIGN + MASK_CONST_ALIGN + MASK_DATA_ALIGN); @@ -2386,7 +2382,7 @@ cris_handle_option (struct gcc_options * case OPT_m8_bit: case OPT_m8bit: - target_flags + opts->x_target_flags &= ~(MASK_STACK_ALIGN + MASK_CONST_ALIGN + MASK_DATA_ALIGN); @@ -2396,8 +2392,6 @@ cris_handle_option (struct gcc_options * break; } - CRIS_SUBTARGET_HANDLE_OPTION(code, arg, value); - return true; } diff -rupN --exclude=.svn gcc-mainline-1/gcc/config/cris/cris.h gcc-mainline/gcc/config/cris/cris.h --- gcc-mainline-1/gcc/config/cris/cris.h 2011-01-26 16:28:19.000000000 -0800 +++ gcc-mainline/gcc/config/cris/cris.h 2011-03-02 12:43:09.000000000 -0800 @@ -309,8 +309,6 @@ extern int cris_cpu_version; #define TARGET_HAS_SWAP (cris_cpu_version >= CRIS_CPU_SVINTO) #define TARGET_V32 (cris_cpu_version >= CRIS_CPU_V32) -#define CRIS_SUBTARGET_HANDLE_OPTION(x, y, z) - /* Node: Storage Layout */ #define BITS_BIG_ENDIAN 0