Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #108231

Re: How to fix warning: [-Wdate-time]

From David Brown <david.brown@hesbynett.no>
Newsgroups comp.lang.c
Subject Re: How to fix warning: [-Wdate-time]
Date 2017-04-17 20:00 +0200
Organization A noiseless patient Spider
Message-ID <od2vlm$n77$1@dont-email.me> (permalink)
References (3 earlier) <ln4lxrugws.fsf@kst-u.example.com> <ocr1he$744$2@dont-email.me> <ocr42a$i2o$1@dont-email.me> <od2j51$b8r$1@dont-email.me> <a4acb94e-d478-f453-fc6d-0b6f8683cb69@verizon.net>

Show all headers | View raw


On 17/04/17 16:52, James R. Kuyper wrote:
> On 04/17/2017 10:26 AM, David Brown wrote:
>> On 14/04/17 20:26, James Kuyper wrote:
>>> On 04/14/2017 01:42 PM, Ken Brody wrote:
> ...
>>>>   Why force an entire project to be compiled with "-Wno-date-time"
>>>> for one
>>>> macro?
>>>
>>> Because the entire project is one for which the motivations for that
>>> warning don't apply? It is really a rather obscure issue to be warning
>>> about.
>>>
>>
>> IMHO, it is a very good thing to be warning about.  If your program
>> contains the macros __DATA__ or __TIME__, then your builds are not
>> reproducible.  I cannot think of any other way to make a build
>> non-deterministic, at least on compilers I have used.
>>
>> That means that as long as you avoid these macros, you can use the
>> generated binary file as a way to check that you have exactly the same
>> build as on a previous occasion.
>
> That's not a particularly useful thing to test with most of the software
> I work on. As a general rule, if I'm compiling the code, something has
> changed: the source code, one of the libraries it's connected to, the
> compiler itself, or the operating system. The normal expectation is that
> the generated binary file is NOT the same as any previously created.
> In fact, in the past, we've used a version control system which included
> a specialized variant of "make" which automatically checked whether all
> files opened during a previous build of an object file (including all
> #include files (recursively) and the compiler itself) still have the
> same version they had during that build, and that all environment
> variables have the same values they had during the previous build. If
> so, it would restore a copy of the object file created by that previous
> build, rather than rebuilding it. The object files themselves had
> versions, and the same logic was used when linking them together in an
> executable. We're not using that system anymore, but not because of that
> feature - we found it rather convenient
>
> One of the first things several of my programs do when executed is put a
> message in the status log containing the version number of the file that
> contains the code which caused that message to be printed, along with
> the current values of __DATE__ and __TIME__. I've found that information
> to be fairly useful; more useful than knowing whether the object files
> were identical to those created by a previous build.

The requirements for this sort of thing vary greatly - for some kinds of 
development work, __DATE__ and __TIME__ are /exactly/ what you need. 
For others, they are exactly what you /don't/ need.

So it is good for a compiler to have such a warning - and good that the 
warning is entirely optional!

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

How to fix warning: [-Wdate-time] MehdiAmini <atorrses@gmail.com> - 2017-04-13 14:44 +0430
  Re: How to fix warning: [-Wdate-time] Barry Schwarz <schwarzb@dqel.com> - 2017-04-13 05:28 -0700
    Re: How to fix warning: [-Wdate-time] MehdiAmini <atorrses@gmail.com> - 2017-04-14 12:55 +0430
      Re: How to fix warning: [-Wdate-time] Keith Thompson <kst-u@mib.org> - 2017-04-14 08:50 -0700
        Re: How to fix warning: [-Wdate-time] Ken Brody <kenbrody@spamcop.net> - 2017-04-14 13:42 -0400
          Re: How to fix warning: [-Wdate-time] James Kuyper <jameskuyper@verizon.net> - 2017-04-14 14:26 -0400
            Re: How to fix warning: [-Wdate-time] David Brown <david.brown@hesbynett.no> - 2017-04-17 16:26 +0200
              Re: How to fix warning: [-Wdate-time] "James R. Kuyper" <jameskuyper@verizon.net> - 2017-04-17 10:52 -0400
                Re: How to fix warning: [-Wdate-time] David Brown <david.brown@hesbynett.no> - 2017-04-17 20:00 +0200
              Re: How to fix warning: [-Wdate-time] Keith Thompson <kst-u@mib.org> - 2017-04-17 08:08 -0700
                Re: How to fix warning: [-Wdate-time] David Brown <david.brown@hesbynett.no> - 2017-04-17 20:04 +0200
        Re: How to fix warning: [-Wdate-time] Mehdi Amini <atorrses@gmail.com> - 2017-04-15 07:50 +0430
          Re: How to fix warning: [-Wdate-time] Keith Thompson <kst-u@mib.org> - 2017-04-15 15:05 -0700
            Re: How to fix warning: [-Wdate-time] Ken Brody <kenbrody@spamcop.net> - 2017-04-17 11:42 -0400
              Re: How to fix warning: [-Wdate-time] supercat@casperkitty.com - 2017-04-17 08:55 -0700
              Re: How to fix warning: [-Wdate-time] "James R. Kuyper" <jameskuyper@verizon.net> - 2017-04-17 11:57 -0400
  Re: How to fix warning: [-Wdate-time] gazelle@shell.xmission.com (Kenny McCormack) - 2017-04-13 13:09 +0000
    Re: How to fix warning: [-Wdate-time] jadill33@gmail.com - 2017-04-13 06:27 -0700
      Re: How to fix warning: [-Wdate-time] supercat@casperkitty.com - 2017-04-15 08:56 -0700
        Re: How to fix warning: [-Wdate-time] Keith Thompson <kst-u@mib.org> - 2017-04-15 15:01 -0700
          Re: How to fix warning: [-Wdate-time] supercat@casperkitty.com - 2017-04-16 11:44 -0700
            Re: How to fix warning: [-Wdate-time] Keith Thompson <kst-u@mib.org> - 2017-04-16 13:45 -0700
              Re: How to fix warning: [-Wdate-time] Ken Brody <kenbrody@spamcop.net> - 2017-04-17 12:14 -0400
            Re: How to fix warning: [-Wdate-time] Ken Brody <kenbrody@spamcop.net> - 2017-04-17 12:06 -0400
              Re: How to fix warning: [-Wdate-time] Keith Thompson <kst-u@mib.org> - 2017-04-17 09:25 -0700
              Re: How to fix warning: [-Wdate-time] "James R. Kuyper" <jameskuyper@verizon.net> - 2017-04-17 12:45 -0400
                Re: How to fix warning: [-Wdate-time] Keith Thompson <kst-u@mib.org> - 2017-04-17 12:02 -0700
                Re: How to fix warning: [-Wdate-time] "James R. Kuyper" <jameskuyper@verizon.net> - 2017-04-17 15:23 -0400
                Re: How to fix warning: [-Wdate-time] Lowell Gilbert <lgusenet@be-well.ilk.org> - 2017-04-18 13:27 -0400
                Re: How to fix warning: [-Wdate-time] Ken Brody <kenbrody@spamcop.net> - 2017-04-18 14:23 -0400
                Re: How to fix warning: [-Wdate-time] Keith Thompson <kst-u@mib.org> - 2017-04-18 12:10 -0700
                Re: How to fix warning: [-Wdate-time] raltbos@xs4all.nl (Richard Bos) - 2017-04-22 21:20 +0000
                Re: How to fix warning: [-Wdate-time] James Kuyper <jameskuyper@verizon.net> - 2017-04-22 22:45 -0400
          Re: How to fix warning: [-Wdate-time] Tim Rentsch <txr@alumni.caltech.edu> - 2017-04-17 11:30 -0700
            Re: How to fix warning: [-Wdate-time] Keith Thompson <kst-u@mib.org> - 2017-04-17 12:30 -0700
              Re: How to fix warning: [-Wdate-time] raltbos@xs4all.nl (Richard Bos) - 2017-04-22 21:24 +0000
                Re: How to fix warning: [-Wdate-time] Tim Rentsch <txr@alumni.caltech.edu> - 2017-04-27 13:33 -0700
              Re: How to fix warning: [-Wdate-time] Tim Rentsch <txr@alumni.caltech.edu> - 2017-04-27 13:26 -0700
    Re: How to fix warning: [-Wdate-time] gordonb.5zr1e@burditt.org (Gordon Burditt) - 2017-04-14 13:35 -0500
      Re: How to fix warning: [-Wdate-time] supercat@casperkitty.com - 2017-04-14 12:17 -0700
        Re: How to fix warning: [-Wdate-time] gordonb.k4gmo@burditt.org (Gordon Burditt) - 2017-04-16 00:04 -0500
        Re: How to fix warning: [-Wdate-time] Noob <root@127.0.0.1> - 2017-04-16 11:04 +0200
          Re: How to fix warning: [-Wdate-time] supercat@casperkitty.com - 2017-04-16 11:52 -0700
          Re: How to fix warning: [-Wdate-time] raltbos@xs4all.nl (Richard Bos) - 2017-04-22 21:28 +0000
    Re: How to fix warning: [-Wdate-time] Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2017-04-18 21:34 -0600
  Re: How to fix warning: [-Wdate-time] Keith Thompson <kst-u@mib.org> - 2017-04-17 08:09 -0700

csiph-web