From patchwork Mon Aug 4 18:41:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramsay Jones X-Patchwork-Id: 4673141 Return-Path: X-Original-To: patchwork-linux-sparse@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8A7069F3B4 for ; Mon, 4 Aug 2014 18:47:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C54C720149 for ; Mon, 4 Aug 2014 18:47:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EC8722013D for ; Mon, 4 Aug 2014 18:47:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751212AbaHDSrQ (ORCPT ); Mon, 4 Aug 2014 14:47:16 -0400 Received: from mdfmta010.mxout.tch.inty.net ([91.221.169.51]:52922 "EHLO smtp.demon.co.uk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751071AbaHDSrP (ORCPT ); Mon, 4 Aug 2014 14:47:15 -0400 Received: from mdfmta010.tch.inty.net (unknown [127.0.0.1]) by mdfmta010.tch.inty.net (Postfix) with ESMTP id 3C9AE400A48; Mon, 4 Aug 2014 19:41:14 +0100 (BST) Received: from mdfmta010.tch.inty.net (unknown [127.0.0.1]) by mdfmta010.tch.inty.net (Postfix) with ESMTP id F1D4B400622; Mon, 4 Aug 2014 19:41:13 +0100 (BST) Received: from [192.168.254.10] (unknown [80.176.147.220]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mdfmta010.tch.inty.net (Postfix) with ESMTP; Mon, 4 Aug 2014 19:41:13 +0100 (BST) Message-ID: <53DFD3CB.8050607@ramsay1.demon.co.uk> Date: Mon, 04 Aug 2014 19:41:15 +0100 From: Ramsay Jones User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-Version: 1.0 To: Christopher Li CC: Sparse Mailing-list Subject: [PATCH/RFC 10/10] cgcc: add a configuration file for cgcc X-MDF-HostID: 19 Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The configuration file, ~/.cgccrc, allows a user to use perl syntax to set the $gcc_base_dir and $multiarch_dir variables, which would then suppress two compiler invocations. This can result in a marked performance boost on platforms for which the fork/exec costs are high (e.g. cygwin). For example, on a multiarch system the file might look like: $ cat ~/.cgccrc $gcc_base_dir = "/usr/lib/gcc/x86_64-linux-gnu/4.8/"; $multiarch_dir = "x86_64-linux-gnu"; $ whereas for a non-multiarch system (e.g. cygwin): $ cat ~/.cgccrc $gcc_base_dir = "/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/"; $multiarch_dir = ""; $ For me, on linux the difference in performance measured between 3-4% (e.g. 17.053s -> 16.379s to run sparse over the git sources), whereas on cygwin it measured about 20% (94.890s -> 76.207s). Signed-off-by: Ramsay Jones --- cgcc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cgcc b/cgcc index d7daa99..9d65438 100755 --- a/cgcc +++ b/cgcc @@ -11,10 +11,16 @@ my $has_specs = 0; my $gendeps = 0; my $do_check = 0; my $do_compile = 1; -my $gcc_base_dir; -my $multiarch_dir; +our $gcc_base_dir; +our $multiarch_dir; my $verbose = 0; +my $cgccrc_file = $ENV{'HOME'}."/.cgccrc" if $ENV{'HOME'}; +if (-e $cgccrc_file) { + do $cgccrc_file; + die $@ if $@; +} + while (@ARGV) { $_ = shift(@ARGV); # Look for a .c file. We don't want to run the checker on .o or .so files