Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-06-02 Thread Christophe Lyon
On 2 June 2016 at 17:04, Jakub Jelinek wrote: > On Thu, Jun 02, 2016 at 04:49:59PM +0200, Christophe Lyon wrote: >> I'm also seeing that the new gcc.dg/cpp/source_date_epoch-1.c fails because >> the output pattern finishes with '\n' instead of the usual '(\n|\r\n|\r)' >> >> Can

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-06-02 Thread Bernd Schmidt
On 06/02/2016 05:04 PM, Jakub Jelinek wrote: Isn't following just better? Tested on x86_64-linux, ok for trunk? 2016-06-02 Jakub Jelinek * gcc.dg/cpp/source_date_epoch-1.c (main): Test __DATE__ and __TIME__ strings with __builtin_strcmp instead of printf

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-06-02 Thread Jakub Jelinek
On Thu, Jun 02, 2016 at 04:49:59PM +0200, Christophe Lyon wrote: > I'm also seeing that the new gcc.dg/cpp/source_date_epoch-1.c fails because > the output pattern finishes with '\n' instead of the usual '(\n|\r\n|\r)' > > Can I add this as obvious? Some remote test invocations even eat the

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-06-02 Thread Christophe Lyon
On 2 June 2016 at 15:01, Christophe Lyon wrote: > On 1 June 2016 at 18:59, Matthias Klose wrote: >> On 01.06.2016 18:29, Bernd Schmidt wrote: >>> On 05/13/2016 07:09 PM, Dhole wrote: +pfile->source_date_epoch =

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-06-02 Thread Jakub Jelinek
On Thu, Jun 02, 2016 at 03:21:03PM +0200, Christophe Lyon wrote: > Ha, thanks, I had missed it. > > But why do I see "random" failures? > Looking at your patch, I have the impression that the test should always fail? Only with make -j1 -k check it should always FAIL. With -j2 and above, it

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-06-02 Thread Christophe Lyon
On 2 June 2016 at 15:05, Jakub Jelinek wrote: > On Thu, Jun 02, 2016 at 03:01:07PM +0200, Christophe Lyon wrote: >> On 1 June 2016 at 18:59, Matthias Klose wrote: >> > On 01.06.2016 18:29, Bernd Schmidt wrote: >> >> On 05/13/2016 07:09 PM, Dhole wrote: >> >>> +

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-06-02 Thread Jakub Jelinek
On Thu, Jun 02, 2016 at 03:01:07PM +0200, Christophe Lyon wrote: > On 1 June 2016 at 18:59, Matthias Klose wrote: > > On 01.06.2016 18:29, Bernd Schmidt wrote: > >> On 05/13/2016 07:09 PM, Dhole wrote: > >>> +pfile->source_date_epoch = > >>>

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-06-02 Thread Christophe Lyon
On 1 June 2016 at 18:59, Matthias Klose wrote: > On 01.06.2016 18:29, Bernd Schmidt wrote: >> On 05/13/2016 07:09 PM, Dhole wrote: >>> +pfile->source_date_epoch = pfile->cb.get_source_date_epoch(pfile); >> >> Space before paren. Ok with that change. >> >>> *

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-06-01 Thread Matthias Klose
On 01.06.2016 18:29, Bernd Schmidt wrote: > On 05/13/2016 07:09 PM, Dhole wrote: >> +pfile->source_date_epoch = pfile->cb.get_source_date_epoch(pfile); > > Space before paren. Ok with that change. > >> * c-common.h (c_omp_region_type): Remove trailing coma. > > Also, comma.

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-06-01 Thread Bernd Schmidt
On 05/13/2016 07:09 PM, Dhole wrote: + pfile->source_date_epoch = pfile->cb.get_source_date_epoch(pfile); Space before paren. Ok with that change. * c-common.h (c_omp_region_type): Remove trailing coma. Also, comma. Bernd

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-05-24 Thread Jeff Law
On 05/23/2016 04:59 PM, Dhole wrote: PING Note Bernd is on PTO for another week or so. jeff

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-05-23 Thread Dhole
PING -- Dhole signature.asc Description: PGP signature

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-05-13 Thread Dhole
On 16-05-12 11:16:57, Bernd Schmidt wrote: > On 05/12/2016 02:36 AM, Dhole wrote: > >+ error_at (input_location, "environment variable SOURCE_DATE_EPOCH > >must " > >+"expand to a non-negative integer less than or equal to %wd", > >+MAX_SOURCE_DATE_EPOCH); > > >+/*

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-05-12 Thread Bernd Schmidt
On 05/12/2016 02:36 AM, Dhole wrote: + error_at (input_location, "environment variable SOURCE_DATE_EPOCH must " + "expand to a non-negative integer less than or equal to %wd", + MAX_SOURCE_DATE_EPOCH); +/* The value (as a unix timestamp) corresponds to date +

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-05-11 Thread Dhole
Attaching the patch with all the issues addressed. On 16-05-10 13:32:03, Bernd Schmidt wrote: > Not sure %ld is always correct here. See below. Using %wd now > >diff --git a/gcc/gcc.c b/gcc/gcc.c > >index 1af5920..0b11cb5 100644 > >--- a/gcc/gcc.c > >+++ b/gcc/gcc.c > >@@ -403,6 +403,7 @@

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-05-10 Thread Joseph Myers
On Tue, 10 May 2016, Bernd Schmidt wrote: > I think Andreas' concern is that this might need to have a "ll" suffix. The > simplest option might be to use the HOST_WIDE_INT_C macro, and then > HOST_WIDE_INT_PRINT_DEC for the error message. HOST_WIDE_INT_PRINT_DEC is a host printf format, not a

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-05-10 Thread Bernd Schmidt
On 05/06/2016 01:26 AM, Eduard Sanou wrote: errno = 0; epoch = strtoll (source_date_epoch, , 10); - if ((errno == ERANGE && (epoch == LLONG_MAX || epoch == LLONG_MIN)) - || (errno != 0 && epoch == 0)) -fatal_error (UNKNOWN_LOCATION, "environment variable $SOURCE_DATE_EPOCH: "

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-05-10 Thread Andreas Schwab
Dhole writes: > On 16-05-06 08:26:07, Andreas Schwab wrote: >> Eduard Sanou writes: >> >> > diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h >> > index 1714284..dea2900 100644 >> > --- a/gcc/c-family/c-common.h >> > +++

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-05-10 Thread Dhole
On 16-05-09 13:01:12, Bernd Schmidt wrote: > >Wouldn't it be better to add a more general directive, e.g. one that would > >allow setting any env var for the compiler, rather than one specific, > >similarly to how dg-set-target-env-var allows any env var to be set for the > >execution?

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-05-10 Thread Dhole
On 16-05-06 08:26:07, Andreas Schwab wrote: > Eduard Sanou writes: > > > diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h > > index 1714284..dea2900 100644 > > --- a/gcc/c-family/c-common.h > > +++ b/gcc/c-family/c-common.h > > @@ -1086,6 +1086,16 @@

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-05-09 Thread Bernd Schmidt
On 05/09/2016 12:42 PM, Jakub Jelinek wrote: On Mon, May 09, 2016 at 12:38:14PM +0200, Bernd Schmidt wrote: On 05/09/2016 12:23 PM, Bernd Schmidt wrote: On 05/06/2016 01:38 AM, Dhole wrote: I've wrote a test case which fails (when it shouldn't) and I don't see why. I think it's setting the

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-05-09 Thread Jakub Jelinek
On Mon, May 09, 2016 at 12:38:14PM +0200, Bernd Schmidt wrote: > On 05/09/2016 12:23 PM, Bernd Schmidt wrote: > >On 05/06/2016 01:38 AM, Dhole wrote: > >>I've wrote a test case which fails (when it shouldn't) and I don't see > >>why. > > > >I think it's setting the env var when executing the test,

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-05-09 Thread Bernd Schmidt
On 05/09/2016 12:23 PM, Bernd Schmidt wrote: On 05/06/2016 01:38 AM, Dhole wrote: I've wrote a test case which fails (when it shouldn't) and I don't see why. I think it's setting the env var when executing the test, not when executing the compiler. Here's something that seems to work (with

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-05-09 Thread Bernd Schmidt
On 05/06/2016 01:38 AM, Dhole wrote: On 16-04-29 09:17:44, Jakub Jelinek wrote: Bernd: I'll see if I can prepare a testcase; first I need to get familiar with the testing framework and learn how to set environment variables in tests. Any tips on that will be really welcome! grep for

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-05-06 Thread Andreas Schwab
Eduard Sanou writes: > diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h > index 1714284..dea2900 100644 > --- a/gcc/c-family/c-common.h > +++ b/gcc/c-family/c-common.h > @@ -1086,6 +1086,16 @@ extern vec *make_tree_vector_copy (const >

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-05-05 Thread Dhole
On 16-04-29 09:17:44, Jakub Jelinek wrote: > > Bernd: I'll see if I can prepare a testcase; first I need to get > > familiar with the testing framework and learn how to set environment > > variables in tests. Any tips on that will be really welcome! > > grep for dg-set-target-env-var in various

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-05-05 Thread Eduard Sanou
Hi, I've worked on applying the changes that have been commented in several messages from this thread. Find the patch and changelog attached. On 16-04-29 09:17:44, Jakub Jelinek wrote: > First of all, using error instead of fatal_error achieves just that too, > except that it allows also

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-05-03 Thread Markus Trippelsdorf
On 2016.05.03 at 16:42 +0200, Dhole wrote: > On 16-04-18 15:04:58, Markus Trippelsdorf wrote: > > A nice follow-up patch would be to set SOURCE_DATE_EPOCH to the current > > time during -fcompare-debug. This would avoid false positives like: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70679 >

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-05-03 Thread Dhole
On 16-04-18 15:04:58, Markus Trippelsdorf wrote: > A nice follow-up patch would be to set SOURCE_DATE_EPOCH to the current > time during -fcompare-debug. This would avoid false positives like: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70679 I've been working on a patch to implement that, but

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-04-29 Thread Jakub Jelinek
On Thu, Apr 28, 2016 at 08:29:56PM +0200, Dhole wrote: > There is the Wdate-time flag, that warns on using __DATE__, __TIME__ and > __TIMESTAMP__. Although that alone will not make the compilation fail > unless it's used with Werror. > > The reason behind using fatal_error (rather than a

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-04-28 Thread Martin Sebor
I'm sorry I'm a little late but I have a couple of minor comments on the patch: + epoch = strtoll (source_date_epoch, , 10); + if ((errno == ERANGE && (epoch == LLONG_MAX || epoch == LLONG_MIN)) + || (errno != 0 && epoch == 0)) +fatal_error (UNKNOWN_LOCATION, "environment variable

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-04-28 Thread Dhole
On 16-04-28 15:14:20, Jakub Jelinek wrote: > On Thu, Apr 28, 2016 at 03:10:26PM +0200, Bernd Schmidt wrote: > > On 04/28/2016 12:35 PM, Jakub Jelinek wrote: > > >On Thu, Apr 28, 2016 at 12:31:40PM +0200, Bernd Schmidt wrote: > > >>I really don't see anything in that function that looks like a huge

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-04-28 Thread Jakub Jelinek
On Thu, Apr 28, 2016 at 03:10:26PM +0200, Bernd Schmidt wrote: > On 04/28/2016 12:35 PM, Jakub Jelinek wrote: > >On Thu, Apr 28, 2016 at 12:31:40PM +0200, Bernd Schmidt wrote: > >>I really don't see anything in that function that looks like a huge time > >>sink, so I'm not that worried about it. I

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-04-28 Thread Bernd Schmidt
On 04/28/2016 12:35 PM, Jakub Jelinek wrote: On Thu, Apr 28, 2016 at 12:31:40PM +0200, Bernd Schmidt wrote: I really don't see anything in that function that looks like a huge time sink, so I'm not that worried about it. I think it's likely to be buried way down in the noise. True, but the

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-04-28 Thread Jakub Jelinek
On Thu, Apr 28, 2016 at 12:31:40PM +0200, Bernd Schmidt wrote: > On 04/28/2016 12:08 PM, Jakub Jelinek wrote: > >BTW, I think fatal_error doesn't make sense, it isn't something that is not > >recoverable, normal error or just a warning would be IMHO more than > >sufficient. The fallback would be

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-04-28 Thread Bernd Schmidt
On 04/28/2016 12:08 PM, Jakub Jelinek wrote: BTW, I think fatal_error doesn't make sense, it isn't something that is not recoverable, normal error or just a warning would be IMHO more than sufficient. The fallback would be just using current time, i.e. ignoring the env var. I thought about

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-04-28 Thread Jakub Jelinek
On Thu, Apr 28, 2016 at 11:20:28AM +0200, Matthias Klose wrote: > On 27.04.2016 17:56, Dhole wrote: > >Thanks again for the review Bernd, > > > >On 16-04-27 01:33:47, Bernd Schmidt wrote: > >>>+ epoch = strtoll (source_date_epoch, , 10); > >>>+ if ((errno == ERANGE && (epoch == LLONG_MAX ||

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-04-28 Thread Bernd Schmidt
On 04/28/2016 11:20 AM, Matthias Klose wrote: On 27.04.2016 17:56, Dhole wrote: I'm attaching the updated patch with the two minor issues fixed. committed. Something else that occurred to me - could you please also work on a testcase? Bernd

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-04-28 Thread Matthias Klose
On 27.04.2016 17:56, Dhole wrote: Thanks again for the review Bernd, On 16-04-27 01:33:47, Bernd Schmidt wrote: + epoch = strtoll (source_date_epoch, , 10); + if ((errno == ERANGE && (epoch == LLONG_MAX || epoch == LLONG_MIN)) + || (errno != 0 && epoch == 0)) +fatal_error

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-04-27 Thread Dhole
Thanks again for the review Bernd, On 16-04-27 01:33:47, Bernd Schmidt wrote: > >+ epoch = strtoll (source_date_epoch, , 10); > >+ if ((errno == ERANGE && (epoch == LLONG_MAX || epoch == LLONG_MIN)) > >+ || (errno != 0 && epoch == 0)) > >+fatal_error (UNKNOWN_LOCATION, "environment

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-04-26 Thread Bernd Schmidt
On 04/26/2016 11:28 PM, Dhole wrote: I've fixed all the spaces issues. I've also changed the "unsigned long long" to "time_t" as you suggested. Also, to improve reliability I'm now using strtoll rather than strtoull, so that negative values can be detected in SOURCE_DATE_EPOCH, which are

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-04-26 Thread Dhole
Hi Bernd, On 16-04-25 12:15:50, Bernd Schmidt wrote: > 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

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-04-25 Thread Bernd Schmidt
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

Re: Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-04-18 Thread Markus Trippelsdorf
On 2016.04.18 at 14:26 +0200, Dhole wrote: > Hi! > > 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. A

Allow embedded timestamps by C/C++ macros to be set externally (3)

2016-04-18 Thread Dhole
Hi! 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. I'm quoting from the original emails: > As a reminder for