From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 59449 invoked by alias); 25 Apr 2016 10:16:05 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 59430 invoked by uid 89); 25 Apr 2016 10:16:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Prototype, Matthias, unreliable X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 25 Apr 2016 10:15:54 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7020B6316D; Mon, 25 Apr 2016 10:15:53 +0000 (UTC) Received: from localhost.localdomain (vpn1-4-136.ams2.redhat.com [10.36.4.136]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u3PAFpcC020344; Mon, 25 Apr 2016 06:15:52 -0400 Subject: Re: Allow embedded timestamps by C/C++ macros to be set externally (3) To: Dhole , gcc-patches@gcc.gnu.org References: <20160418122636.GR3248@panther> From: Bernd Schmidt Message-ID: <571DEE56.6090406@redhat.com> Date: Mon, 25 Apr 2016 10:16:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <20160418122636.GR3248@panther> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2016-04/txt/msg01347.txt.bz2 On 04/18/2016 02:26 PM, Dhole wrote: > A few months ago I submited a patch to allow the embedded timestamps by > C/C++ macros to be set externally [2], which was already an improvement > over [1]. I was told to wait until the GCC 7 stage 1 started to send > this patch again. > +/* Read SOURCE_DATE_EPOCH from environment to have a deterministic > + timestamp to replace embedded current dates to get reproducible > + results. Returns -1 if SOURCE_DATE_EPOCH is not defined. */ > +long long > +get_source_date_epoch() Always have a space before open-paren. Maybe this should return time_t. See below. > +/* Read SOURCE_DATE_EPOCH from environment to have a deterministic > + timestamp to replace embedded current dates to get reproducible > + results. Returns -1 if SOURCE_DATE_EPOCH is not defined. */ > +extern long long get_source_date_epoch(); Double space after the end of a sentence. Space before open paren. > + source_date_epoch = get_source_date_epoch(); > + cpp_init_source_date_epoch(parse_in, source_date_epoch); Spaces. > +/* Initialize the source_date_epoch value. */ > +extern void cpp_init_source_date_epoch (cpp_reader *, long long); Also thinking we should be using time_t here. > /* Sanity-checks are dependent on command-line options, so it is > called as a subroutine of cpp_read_main_file (). */ We don't write () to mark function names. > + tb = gmtime ((time_t*) &pfile->source_date_epoch); Space before the "*". But this cast looks ugly and unreliable (think big-endian). This is why I would prefer to move to a time_t representation sooner. > 2016-04-18 Eduard Sanou > Matthias Klose > * c-common.c (get_source_date_epoch): New function, gets the environment > variable SOURCE_DATE_EPOCH and parses it as long long with error > handling. > * c-common.h (get_source_date_epoch): Prototype. > * c-lex.c (c_lex_with_flags): set parse_in->source_date_epoch. Add blank lines after the end of the names in ChangeLogs. Bernd