From patchwork Fri Jul 13 19:30:49 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Bosscher X-Patchwork-Id: 170948 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 565F02C030E for ; Sat, 14 Jul 2012 05:31:28 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1342812689; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: MIME-Version:Received:From:Date:Message-ID:Subject:To: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=L5GKhQF MHOo2CrNo9jmGaRm7MXI=; b=mwqaiV+aVly5s5IjCVEPva85UKPw3eHxhERsXSZ 0N/ev0uN82ibBFaKMCIAyEzRIxBlBDVyI2FIEf61kM6YLXQjhEwV/mA7qRVvpyR/ rL3OF9VQG0sV31+36DwEdmF61hJCdJ6DXZas545q4TwAahso2O2Yj050MAJcQmNU kj1o= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:MIME-Version:Received:From:Date:Message-ID:Subject:To:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=ETE5FIt0HxNUmkQFy0HRDr9mq/RfwKvK+nREvdzJWGumu40jLB/9f8PuAkEf7Y GCJszOOlUtbYG/60uDb1diTmu7t3v++At+OXyJnOmdegklKVAYaIznJGBoWj6kAm 2v07sfjRzxgQ7ZS81OzRzYIrQgilCHTWcTI9Rck7YQLLk=; Received: (qmail 1340 invoked by alias); 13 Jul 2012 19:31:25 -0000 Received: (qmail 1329 invoked by uid 22791); 13 Jul 2012 19:31:24 -0000 X-SWARE-Spam-Status: No, hits=-4.2 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-bk0-f47.google.com (HELO mail-bk0-f47.google.com) (209.85.214.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 13 Jul 2012 19:31:11 +0000 Received: by bkcik5 with SMTP id ik5so3281700bkc.20 for ; Fri, 13 Jul 2012 12:31:09 -0700 (PDT) Received: by 10.152.132.233 with SMTP id ox9mr2590030lab.25.1342207869521; Fri, 13 Jul 2012 12:31:09 -0700 (PDT) MIME-Version: 1.0 Received: by 10.112.4.229 with HTTP; Fri, 13 Jul 2012 12:30:49 -0700 (PDT) From: Steven Bosscher Date: Fri, 13 Jul 2012 21:30:49 +0200 Message-ID: Subject: [patch] Make asm_out_file a text write-only file again To: GCC Patches X-IsSubscribed: yes 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 Hello, Geoff had to make asm_out_file read-write for PCH [1], because at the time it was necessary to read back anything written to asm_out_file and store it in the PCH. This didn't work on mingw32 so Danny Smith made the file binary [2] with the b modifier (but according to 'man fopen', only for non-POSIX). This is not necessary anymore. The attached patch changes things back to the pre-r61136 state of things. Bootstrapped&tested on x86_64-unknown-linux-gnu. OK for trunk? Ciao! Steven [1] http://gcc.gnu.org/viewcvs/trunk/gcc/toplev.c?limit_changes=0&r1=61136&r2=61135&pathrev=61136) [2] http://gcc.gnu.org/viewcvs/trunk/gcc/toplev.c?r1=82643&r2=82642&pathrev=82643 gcc/ * toplev.c (init_asm_output): Open asm_out_file in 'w' mode. c-family/ * c-pch.c (CHECK_NO_ASM_OUT_DURING_PCH): Do not define. Remove code conditional on it. Index: toplev.c =================================================================== --- toplev.c (revision 189469) +++ toplev.c (working copy) @@ -908,7 +908,7 @@ init_asm_output (const char *name) if (!strcmp (asm_file_name, "-")) asm_out_file = stdout; else - asm_out_file = fopen (asm_file_name, "w+b"); + asm_out_file = fopen (asm_file_name, "w"); if (asm_out_file == 0) fatal_error ("can%'t open %s for writing: %m", asm_file_name); } Index: c-family/c-pch.c =================================================================== --- c-family/c-pch.c (revision 189469) +++ c-family/c-pch.c (working copy) @@ -35,24 +35,6 @@ along with GCC; see the file COPYING3. #include "opts.h" #include "timevar.h" -/* PCH was introduced before unit-at-a-time became the only supported - compilation mode. To exactly replay the content parsed at PCH generate - time, anything written to asm_out_file was read back in and stored in - the PCH, and written back out to asm_out_file while reading a PCH. - - Nowadays, ideally no action by a front end should never result in output - to asm_out_file, and front-end files should not include output.h. For - now assert that nothing is written to asm_out_file while a PCH is being - generated. Before GCC 4.8 is released, this code should be removed. - FIXME. */ -#define CHECK_NO_ASM_OUT_DURING_PCH -#ifdef CHECK_NO_ASM_OUT_DURING_PCH -extern FILE *asm_out_file; - -/* The position in the assembler output file when pch_init was called. */ -static long asm_file_startpos; -#endif - /* This is a list of flag variables that must match exactly, and their names for the error message. The possible values for *flag_var must fit in a 'signed char'. */ @@ -112,9 +94,7 @@ get_ident (void) } /* Prepare to write a PCH file, if one is being written. This is - called at the start of compilation. - - Also, print out the executable checksum if -fverbose-asm is in effect. */ + called at the start of compilation. */ void pch_init (void) @@ -153,10 +133,6 @@ pch_init (void) || fwrite (target_validity, v.target_data_length, 1, f) != 1) fatal_error ("can%'t write to %s: %m", pch_file); -#ifdef CHECK_NO_ASM_OUT_DURING_PCH - asm_file_startpos = ftell (asm_out_file); -#endif - /* Let the debugging format deal with the PCHness. */ (*debug_hooks->handle_pch) (0); @@ -177,10 +153,6 @@ c_common_write_pch (void) cpp_write_pch_deps (parse_in, pch_outfile); -#ifdef CHECK_NO_ASM_OUT_DURING_PCH - gcc_assert (ftell (asm_out_file) - asm_file_startpos == 0); -#endif - gt_pch_save (pch_outfile); timevar_push (TV_PCH_CPP_SAVE);