[Issue 21596] New: Header generation should NOT touch the existing identical header file, if any

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jan 30 20:49:39 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=21596

          Issue ID: 21596
           Summary: Header generation should NOT touch the existing
                    identical header file, if any
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: andrei at erdani.com

In a traditional build system using D "header" files generated with -H,
dependency information is propagated by means of timestamp.

Most of the time, a D file is touched in the implementation only, leaving the
interface intact. However, the header generation invocation will overwrite the
file, tricking the build system into thinking the interface has changed as
well. As a consequence, the build results in cascaded unnecessary compilations.

This can be addressed manually at the build system level, and indeed people
have done so for years. However, the right way to go is address the problem at
the source.

The D compiler should NOT touch in any way a header file identical to the one
it would generate with -H.

The drawback is that next build will not figure that the header file has been
generated and will generate it again; however, header generation is massively
cheaper than recompiling transitive dependents.

Note that this is distinct from https://issues.dlang.org/show_bug.cgi?id=21593;
there, updating the timestamp is necessary because otherwise the next build
will recompile the file, which is expensive.

--


More information about the Digitalmars-d-bugs mailing list