Skip to content

remove reference frontend.h source file#11910

Closed
WalterBright wants to merge 1 commit intodlang:masterfrom
WalterBright:no-frontend.h
Closed

remove reference frontend.h source file#11910
WalterBright wants to merge 1 commit intodlang:masterfrom
WalterBright:no-frontend.h

Conversation

@WalterBright
Copy link
Member

The reason given for having frontend.h as a reference file is "to see if it changes". But the advice when it changes is "just run build to auto-generate it". Which means that it is pointless and a nuisance to have a reference file, for the same reason it is pointless and a nuisance to check in the generated object files.

frontend.h egregiously violates the DRY principle, and has wasted a great deal of my time updating it when thousands of lines of it randomly change, as just happened to my PRs.

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @WalterBright!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + dmd#11910"

@WalterBright
Copy link
Member Author

make[1]: Leaving directory '/home/circleci/druntime'
../dmd/generated/linux/debug/64/dmd  -conf= -I../druntime/import  -w -de -preview=dip1000 -preview=dtorfields -m64 -fPIC -transition=complex -g -debug -lib -ofgenerated/linux/debug/64/libphobos2.a ../druntime/generated/linux/debug/64/libdruntime.a std/array.d std/ascii.d std/base64.d std/bigint.d std/bitmanip.d std/compiler.d std/complex.d std/concurrency.d std/conv.d std/csv.d std/demangle.d std/encoding.d std/exception.d std/file.d std/format.d std/functional.d std/getopt.d std/json.d std/math.d std/mathspecial.d std/meta.d std/mmfile.d std/numeric.d std/outbuffer.d std/package.d std/parallelism.d std/path.d std/process.d std/random.d std/signals.d std/socket.d std/stdint.d std/stdio.d std/string.d std/system.d std/traits.d std/typecons.d std/uri.d std/utf.d std/uuid.d std/variant.d std/xml.d std/zip.d std/zlib.d std/algorithm/comparison.d std/algorithm/iteration.d std/algorithm/mutation.d std/algorithm/package.d std/algorithm/searching.d std/algorithm/setops.d std/algorithm/sorting.d std/container/array.d std/container/binaryheap.d std/container/dlist.d std/container/package.d std/container/rbtree.d std/container/slist.d std/container/util.d std/datetime/date.d std/datetime/interval.d std/datetime/package.d std/datetime/stopwatch.d std/datetime/systime.d std/datetime/timezone.d std/digest/crc.d std/digest/hmac.d std/digest/md.d std/digest/murmurhash.d std/digest/package.d std/digest/ripemd.d std/digest/sha.d std/experimental/allocator/common.d std/experimental/allocator/gc_allocator.d std/experimental/allocator/mallocator.d std/experimental/allocator/mmap_allocator.d std/experimental/allocator/package.d std/experimental/allocator/showcase.d std/experimental/allocator/typed.d std/experimental/allocator/building_blocks/affix_allocator.d std/experimental/allocator/building_blocks/aligned_block_list.d std/experimental/allocator/building_blocks/allocator_list.d std/experimental/allocator/building_blocks/ascending_page_allocator.d std/experimental/allocator/building_blocks/bucketizer.d std/experimental/allocator/building_blocks/fallback_allocator.d std/experimental/allocator/building_blocks/free_list.d std/experimental/allocator/building_blocks/free_tree.d std/experimental/allocator/building_blocks/bitmapped_block.d std/experimental/allocator/building_blocks/kernighan_ritchie.d std/experimental/allocator/building_blocks/null_allocator.d std/experimental/allocator/building_blocks/package.d std/experimental/allocator/building_blocks/quantizer.d std/experimental/allocator/building_blocks/region.d std/experimental/allocator/building_blocks/scoped_allocator.d std/experimental/allocator/building_blocks/segregator.d std/experimental/allocator/building_blocks/stats_collector.d std/experimental/logger/core.d std/experimental/logger/filelogger.d std/experimental/logger/nulllogger.d std/experimental/logger/multilogger.d std/experimental/logger/package.d std/net/curl.d std/net/isemail.d std/uni/package.d std/experimental/checkedint.d std/experimental/typecons.d std/range/interfaces.d std/range/package.d std/range/primitives.d std/regex/package.d std/regex/internal/generator.d std/regex/internal/ir.d std/regex/internal/parser.d std/regex/internal/backtracking.d std/regex/internal/tests.d std/regex/internal/tests2.d std/regex/internal/thompson.d std/regex/internal/kickstart.d std/windows/charset.d std/windows/registry.d std/windows/syserror.d etc/c/curl.d etc/c/odbc/sql.d etc/c/odbc/sqlext.d etc/c/odbc/sqltypes.d etc/c/odbc/sqlucode.d etc/c/sqlite3.d etc/c/zlib.d std/algorithm/internal.d std/digest/digest.d std/internal/cstring.d std/internal/digest/sha_SSSE3.d std/internal/math/biguintcore.d std/internal/math/biguintnoasm.d std/internal/math/biguintx86.d std/internal/math/errorfunction.d std/internal/math/gammafunction.d std/internal/scopebuffer.d std/internal/test/dummyrange.d std/internal/test/range.d std/internal/unicode_comp.d std/internal/unicode_decomp.d std/internal/unicode_grapheme.d std/internal/unicode_norm.d std/internal/unicode_tables.d std/internal/windows/advapi32.d std/typetuple.d generated/linux/debug/64/etc/c/zlib/adler32.o generated/linux/debug/64/etc/c/zlib/compress.o generated/linux/debug/64/etc/c/zlib/crc32.o generated/linux/debug/64/etc/c/zlib/deflate.o generated/linux/debug/64/etc/c/zlib/gzclose.o generated/linux/debug/64/etc/c/zlib/gzlib.o generated/linux/debug/64/etc/c/zlib/gzread.o generated/linux/debug/64/etc/c/zlib/gzwrite.o generated/linux/debug/64/etc/c/zlib/infback.o generated/linux/debug/64/etc/c/zlib/inffast.o generated/linux/debug/64/etc/c/zlib/inflate.o generated/linux/debug/64/etc/c/zlib/inftrees.o generated/linux/debug/64/etc/c/zlib/trees.o generated/linux/debug/64/etc/c/zlib/uncompr.o generated/linux/debug/64/etc/c/zlib/zutil.o
../dmd/generated/linux/debug/64/dmd  -conf= -I../druntime/import  -w -de -preview=dip1000 -preview=dtorfields -m64 -fPIC -transition=complex -g -debug -shared -defaultlib= -debuglib= -L-lpthread -L-lm -ofgenerated/linux/debug/64/libphobos2.so.0.94.1 -L-soname=libphobos2.so.0.94 ../druntime/generated/linux/debug/64/libdruntime.so.a -L-ldl std/array.d std/ascii.d std/base64.d std/bigint.d std/bitmanip.d std/compiler.d std/complex.d std/concurrency.d std/conv.d std/csv.d std/demangle.d std/encoding.d std/exception.d std/file.d std/format.d std/functional.d std/getopt.d std/json.d std/math.d std/mathspecial.d std/meta.d std/mmfile.d std/numeric.d std/outbuffer.d std/package.d std/parallelism.d std/path.d std/process.d std/random.d std/signals.d std/socket.d std/stdint.d std/stdio.d std/string.d std/system.d std/traits.d std/typecons.d std/uri.d std/utf.d std/uuid.d std/variant.d std/xml.d std/zip.d std/zlib.d std/algorithm/comparison.d std/algorithm/iteration.d std/algorithm/mutation.d std/algorithm/package.d std/algorithm/searching.d std/algorithm/setops.d std/algorithm/sorting.d std/container/array.d std/container/binaryheap.d std/container/dlist.d std/container/package.d std/container/rbtree.d std/container/slist.d std/container/util.d std/datetime/date.d std/datetime/interval.d std/datetime/package.d std/datetime/stopwatch.d std/datetime/systime.d std/datetime/timezone.d std/digest/crc.d std/digest/hmac.d std/digest/md.d std/digest/murmurhash.d std/digest/package.d std/digest/ripemd.d std/digest/sha.d std/experimental/allocator/common.d std/experimental/allocator/gc_allocator.d std/experimental/allocator/mallocator.d std/experimental/allocator/mmap_allocator.d std/experimental/allocator/package.d std/experimental/allocator/showcase.d std/experimental/allocator/typed.d std/experimental/allocator/building_blocks/affix_allocator.d std/experimental/allocator/building_blocks/aligned_block_list.d std/experimental/allocator/building_blocks/allocator_list.d std/experimental/allocator/building_blocks/ascending_page_allocator.d std/experimental/allocator/building_blocks/bucketizer.d std/experimental/allocator/building_blocks/fallback_allocator.d std/experimental/allocator/building_blocks/free_list.d std/experimental/allocator/building_blocks/free_tree.d std/experimental/allocator/building_blocks/bitmapped_block.d std/experimental/allocator/building_blocks/kernighan_ritchie.d std/experimental/allocator/building_blocks/null_allocator.d std/experimental/allocator/building_blocks/package.d std/experimental/allocator/building_blocks/quantizer.d std/experimental/allocator/building_blocks/region.d std/experimental/allocator/building_blocks/scoped_allocator.d std/experimental/allocator/building_blocks/segregator.d std/experimental/allocator/building_blocks/stats_collector.d std/experimental/logger/core.d std/experimental/logger/filelogger.d std/experimental/logger/nulllogger.d std/experimental/logger/multilogger.d std/experimental/logger/package.d std/net/curl.d std/net/isemail.d std/uni/package.d std/experimental/checkedint.d std/experimental/typecons.d std/range/interfaces.d std/range/package.d std/range/primitives.d std/regex/package.d std/regex/internal/generator.d std/regex/internal/ir.d std/regex/internal/parser.d std/regex/internal/backtracking.d std/regex/internal/tests.d std/regex/internal/tests2.d std/regex/internal/thompson.d std/regex/internal/kickstart.d std/windows/charset.d std/windows/registry.d std/windows/syserror.d etc/c/curl.d etc/c/odbc/sql.d etc/c/odbc/sqlext.d etc/c/odbc/sqltypes.d etc/c/odbc/sqlucode.d etc/c/sqlite3.d etc/c/zlib.d std/algorithm/internal.d std/digest/digest.d std/internal/cstring.d std/internal/digest/sha_SSSE3.d std/internal/math/biguintcore.d std/internal/math/biguintnoasm.d std/internal/math/biguintx86.d std/internal/math/errorfunction.d std/internal/math/gammafunction.d std/internal/scopebuffer.d std/internal/test/dummyrange.d std/internal/test/range.d std/internal/unicode_comp.d std/internal/unicode_decomp.d std/internal/unicode_grapheme.d std/internal/unicode_norm.d std/internal/unicode_tables.d std/internal/windows/advapi32.d std/typetuple.d generated/linux/debug/64/etc/c/zlib/adler32.o generated/linux/debug/64/etc/c/zlib/compress.o generated/linux/debug/64/etc/c/zlib/crc32.o generated/linux/debug/64/etc/c/zlib/deflate.o generated/linux/debug/64/etc/c/zlib/gzclose.o generated/linux/debug/64/etc/c/zlib/gzlib.o generated/linux/debug/64/etc/c/zlib/gzread.o generated/linux/debug/64/etc/c/zlib/gzwrite.o generated/linux/debug/64/etc/c/zlib/infback.o generated/linux/debug/64/etc/c/zlib/inffast.o generated/linux/debug/64/etc/c/zlib/inflate.o generated/linux/debug/64/etc/c/zlib/inftrees.o generated/linux/debug/64/etc/c/zlib/trees.o generated/linux/debug/64/etc/c/zlib/uncompr.o generated/linux/debug/64/etc/c/zlib/zutil.o
ln -sf libphobos2.so.0.94.1 generated/linux/debug/64/libphobos2.so.0.94
ln -sf libphobos2.so.0.94.1 generated/linux/debug/64/libphobos2.so
make: Leaving directory '/home/circleci/phobos'
+ ./src/build.d cxx-headers-test
Target `cxx-headers-test` is unknown.

Where is this command coming from? Grepping for cxx-headers-test in the dmd repository turns up nothing.

@jacob-carlborg
Copy link
Contributor

Where is this command coming from? Grepping for cxx-headers-test in the dmd repository turns up nothing.

dmd/src/build.d

Line 499 in 9991401

.name("cxx-headers-test")

@jacob-carlborg
Copy link
Contributor

jacob-carlborg commented Oct 27, 2020

Where is this command coming from? Grepping for cxx-headers-test in the dmd repository turns up nothing.

This is probably the one you're looking for:

./src/build.d cxx-headers-test

grep might be skipping the .circleci directory since it starts with a period. I really hate it that all (most) public CI systems require the configuration to be in a hidden file/directory.

@WalterBright
Copy link
Member Author

Thank you, @jacob-carlborg ! I had no idea grep ignored those.

@WalterBright
Copy link
Member Author

I agree that hidden files/directories are an abomination. Windows has them, too.

Copy link
Member

@ibuclaw ibuclaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, since the introduction of frontend.h, there have only been two regressions in the C++ interface that got missed by those making changes on the D side (ignoring one stylistic change).

Before that, regressions were frequent, wasting hours of debugging time. I for one feel more relaxed now that other people are being informed that they need to fix the headers before merging their changes, though all the worrying has now been replaced with changes that expose the language implementation is fundamentally broken. That is a good thing, however. Fixing these issues pays off a lot more than fixing out-of-sync C++ headers. By not having the C++ header test means that I'll regress back to fixing hard to debug C++ header issues.

@WalterBright
Copy link
Member Author

WalterBright commented Oct 27, 2020

By not having the C++ header test means that I'll regress back to fixing hard to debug C++ header issues.

I don't understand this. Now people do not fix them, they just auto-generate them. If they are auto-generated instead of checked in, they will always be in sync. Just like the object files are always in sync with the code.

@WalterBright WalterBright dismissed ibuclaw’s stale review October 27, 2020 10:07

Review did not request changes.

Copy link
Contributor

@MoonlightSentinel MoonlightSentinel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

frontend.h/cxx-headers-test is a canary to detect changes to the C++ interface which must be reflected in the manually managed headers.

Those will be replaced once dtoh is finished.

@WalterBright
Copy link
Member Author

I understand that, but the file does not need to be checked in to do that. Just have frontend.h generated into the generated directory. Then, if you suspect a change, diff it with one from another build.

@WalterBright WalterBright dismissed MoonlightSentinel’s stale review October 27, 2020 10:20

I do not see the point of requesting changes when there are no changes requested.

@ibuclaw
Copy link
Member

ibuclaw commented Oct 27, 2020

Those will be replaced once dtoh is finished.

Right, that is a crucial thing to mention. There are still some holes or problems with the dmd codebase that prevent use of the generated headers by the C++-based compilers. Even if all works well, there's still a bootstrap problem, so checking in the automated headers is here to stay for the time being.

@WalterBright
Copy link
Member Author

so checking in the automated headers is here to stay for the time being.

It is not necessary. As I remarked: "Just have frontend.h generated into the generated directory. Then, if you suspect a change, diff it with one from another build." There's no reason to check it in, just like there is no reason to check in any other generated file.

@ibuclaw
Copy link
Member

ibuclaw commented Oct 27, 2020

I understand that, but the file does not need to be checked in to do that.

The checked in header is used as a reference point for one build to another. Without it we're back to "gdc/ldc is broken, there have been 50 changes made over the last 2 weeks, and I have no idea whodunnit".

Copy link
Contributor

@MoonlightSentinel MoonlightSentinel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not see the point of requesting changes when there are no changes requested.

To spell it out:
cxx-headers-check won't be removed but feel free to implement an appropriate replacement which offers the same functionality without frontend.h.

@WalterBright
Copy link
Member Author

The checked in header is used as a reference point for one build to another. Without it we're back to "gdc/ldc is broken, there have been 50 changes made over the last 2 weeks, and I have no idea whodunnit".

Binary search. Besides, diff still works just as well as looking at github diff.

@WalterBright
Copy link
Member Author

WalterBright commented Oct 27, 2020

To spell it out: cxx-headers-check won't be removed but feel free to implement an appropriate replacement which offers the same functionality.

Saying you disapprove of this PR is not a "changes requested". Besides, I did point out equivalent functionality - diff. git is the wrong tool to manage generated files.

Also, I did not suggest removing generation of frontend.h. I understand that is useful. The PR still generates it.

@UplinkCoder
Copy link
Member

The point is to make it hard for a PR to break things unnoticed.
And to discourage breaking things.
I think it fulfills that role.

@WalterBright
Copy link
Member Author

The point is to make it hard for a PR to break things unnoticed. And to discourage breaking things. I think it fulfills that role.

It does not. It just makes my PRs constantly go stale and I, like everyone else, just generates them again. For example, the last change altered several thousand lines of frontend.h. Who vets that? Nobody. It's just regenerated and checked in.

Generating frontend.h and dropping it in the "generated" directory accomplishes the same thing, but does not keep breaking PRs.

@MoonlightSentinel
Copy link
Contributor

Saying you disapprove of this PR is not a "changes requested"

That's why my comment offered a solution: Provide a replacement that doesn't rely on tracking frontend.h but still notifies PR writers/reviewers about changes to the C++ interface.

@UplinkCoder
Copy link
Member

It does not. It just makes my PRs constantly go stale and I, like everyone else, just generates them again.

I don't think everyone just generates them again, I would look for a way which does not break the interface.

In any case something where manual re-generation is required is still more discouraging to breaking interface changes, than it just being automatically re-generated.

@WalterBright
Copy link
Member Author

In any case something where manual re-generation is required is still more discouraging to breaking interface changes, than it just being automatically re-generated.

It's even in the directions - if it's different, just regenerate it. How would that discourage anyone from making changes?

@UplinkCoder
Copy link
Member

It's even in the directions - if it's different, just regenerate it. How would that discourage anyone from making changes?

By being another manual step.
Like a captcha for interface changes.

@WalterBright
Copy link
Member Author

That's why my comment offered a solution: Provide a replacement that doesn't rely on tracking frontend.h but still notifies PR writers/reviewers about changes to the C++ interface.

diff lastworkingversion/generated/frontend.h current/generated/frontend.h

whenever deciding to update ldc/gdc. You pretty much have to do that anyway with the checked in one, it is not even extra work. Just different paths. Keep in mind I did not suggest not generating frontend.h. Only not checking it in.

@WalterBright
Copy link
Member Author

By being another manual step.

It that prevents a developer from making changes to a data structure, he shouldn't be working on the code. Seriously.

@Geod24
Copy link
Member

Geod24 commented Oct 27, 2020

I'm on the fence with this - On one hand, the experience when first dealing with frontend.h is absolutely horrible, and I think that's what Walter is experiencing. I didn't expect we'd check out a file that is not compilable. So w.r.t. user experience, I'm 100% in favor of this PR.

That being said, pass the initial hurdleS, I do understand the uses for it. It did catch a few instances where I didn't notice a C++ ABI change was taking place (although they were also false positives...).

Personally I'd be much happier if:

  1. A user-friendly error message was printed when that test fails;
  2. It was run when doing ./src/build.d test;

@UplinkCoder
Copy link
Member

It that prevents a developer from making changes to a data structure, he shouldn't be working on the code. Seriously.

I agree but when the data-structure is on an interface boundary there is increased value in keeping it stable.

@ibuclaw
Copy link
Member

ibuclaw commented Oct 27, 2020

Binary search. Besides, diff still works just as well as looking at github diff.

It's wasting my time, and I'm tired of telling repeat offenders that their changes broke gdc due to their carelessness.

With it being in the pipeline, that job is automated for me.

Copy link
Contributor

@wilzbach wilzbach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it fulfills it purpose. It drastically reduces the number of C++ interface regressions and furthermore it will replace the hand-written headers soon.

@atilaneves
Copy link
Contributor

I think the way forward is to auto diff it for the user. Humans shouldn't be doing what computers can do for them.

@UplinkCoder
Copy link
Member

UplinkCoder commented Oct 27, 2020 via email

@atilaneves
Copy link
Contributor

atilaneves commented Oct 27, 2020

Humans shouldn't be making work for other humans.

Correct. I don't know what the relevance of that comment is though. My point is that code should be doing most of the work.

@wilzbach
Copy link
Contributor

Humans shouldn't be making work for other humans.

Correct. I don't know what the relevance of that comment is though. My point is that code should be doing most of the work.

That's already the case. The file gets updated automatically and git/GitHub creates the diff.

@WalterBright
Copy link
Member Author

frontend.h, the file that never stops pointlessly breaking PRs. #11846

@ibuclaw
Copy link
Member

ibuclaw commented Nov 8, 2020

frontend.h, the file that never stops pointlessly breaking PRs. #11846

In defence of it, the list of dtoh changes will be somewhere close to 30 this release, most will have caused a significant change in the frontend.h file.

In offence of it, I've seen no alternative proposal for ensuring that new PRs both fail the pipeline when a C++ header isn't updated, and alert reviewers to take a closer look at the new definitions added to D and C++ sources.

@WalterBright
Copy link
Member Author

WalterBright commented Nov 8, 2020

I've seen no alternative proposal for ensuring that new PRs both fail the pipeline when a C++ header isn't updated, and alert reviewers to take a closer look at the new definitions added to D and C++ sources.

You can take a note of the front end git version last time you built a gdc. When building a new one against the latest front end, diff the generated frontend.h against the one from the last time. How often do you port to the latest master? This is surely much less work than breaking PRs every time a declaration changes, each one requiring manual work by the submitter.

@WalterBright
Copy link
Member Author

In fact, that's pretty much what you have to do regardless. You're still going to have to remember which version was the last one you used, and diff from the current to that one.

@ibuclaw
Copy link
Member

ibuclaw commented Nov 9, 2020

You can take a note of the front end git version last time you built a gdc. When building a new one against the latest front end, diff the generated frontend.h against the one from the last time.

That's not taking a proactive approach to ensure the interface is never broken.

How often do you port to the latest master?

Less often than I'd like to.

This is surely much less work than breaking PRs every time a declaration changes, each one requiring manual work by the submitter.

Conservatively, each broken dmd implementation can waste up to three days going on a week if it is silent corruption due to interface mismatch - rebase gcc; sync dmd; clean; bootstrap; regression test; debug; determine which "end" might be at fault; fix; rebase gcc; sync dmd; clean; bootstrap; regression test; merge fix with upstream dmd; write cxxfrontend test to ensure that part doesn't break again; raise PR; rebase gcc; sync dmd after merge of PR; clean; bootstrap; regression test; write changelog; rebase gcc; commit to gcc (check results of arm/sparc/ppc/... builds next day for druntime/phobos regressions).

@ibuclaw
Copy link
Member

ibuclaw commented Nov 9, 2020

It has occurred to me that when the frontend.h header gets to a point of being include-able, and the hand maintained headers go away, we'll need to check in the generated header into dmd anyway, as it will be the source of truth for downstream merges with gdc and ldc.

Otherwise, if we do it the way you suggest and keep the generated header checked in downstream only, it'll be immediately out of sync after a merge with upstream dmd, and there's no way to generate a new header as the bootstrap compiler won't work. Not without adding more hoops to jump through to do what should be a simple three step process (merge, compile and test) to update the D frontend.

@ibuclaw
Copy link
Member

ibuclaw commented Nov 9, 2020

It has also occurred to me that the header generated by dmd may not be correct for gdc or ldc anyway - gdc because there are differences in back-end types unless you compile with -version=IN_GCC, ldc because they heavily modify the front-end AST from vanilla dmd for their own needs.

@Geod24
Copy link
Member

Geod24 commented Jan 4, 2021

I don't mind the rebase, but I mind it being hard to update. Personally, I still have to do it mostly by hand. CC @MoonlightSentinel .

@Geod24
Copy link
Member

Geod24 commented Jan 4, 2021

Note that one thing that will never be solved unless we eliminate it (which luckily @WalterBright is in the process of doing) is this:

 enum class TARGET : bool
 {
-    Linux = true,
-    OSX = false,
+    Linux = false,
+    OSX = true,
     FreeBSD = false,
     OpenBSD = false,
     Solaris = false,

@ibuclaw
Copy link
Member

ibuclaw commented Jan 4, 2021

Note that one thing that will never be solved unless we eliminate it (which luckily @WalterBright is in the process of doing) is this:

Yep, it should be private to dmd.target.

@ibuclaw
Copy link
Member

ibuclaw commented Jan 4, 2021

I don't mind the rebase, but I mind it being hard to update. Personally, I still have to do it mostly by hand. CC @MoonlightSentinel .

I wrote down an informal proposal, though someone else should do the work as you'll be holding your breath for a long time if you expect me to find the time to do such a thing. :-)

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

Cc @kinke naturally your input matters more so than mine, so please slap me round the head if any kind of middle ground suggestion is nonsense.

@MoonlightSentinel
Copy link
Contributor

I don't mind the rebase, but I mind it being hard to update. Personally, I still have to do it mostly by hand. CC @MoonlightSentinel .

This can propably be improved a lot by

  • omit OS depending enums (declare them as extern(D))
  • improving alias detection in dtoh

The latter quite hard because the generated AST changes w.r.t. the current target settings (this definitly needs to be improved for DMD as a library)

@kinke
Copy link
Contributor

kinke commented Jan 5, 2021

Cc @kinke naturally your input matters more so than mine

Wut? ;) - I'm not too keen on having an extra layer for us C++ users. IMO, the situation wasn't that bad before frontend.h (but surely tedious), but has improved considerably since its introduction, especially given recent refactorings, field reorderings etc.

I haven't really looked at frontend.h and in what shape it is, i.e., how far it is from being actually usable and how many dtoh improvements we still need. Wrt. dtoh, I think we should definitely focus on C++11+ first; earlier standards should be mostly obsolete by now. E.g., instead of some huuuge constructors with default param values, I'm very much looking forward to field initializers and the like [although I don't think LDC actually initializes anything written in D from C++].

@Geod24
Copy link
Member

Geod24 commented Jan 6, 2021

omit OS depending enums (declare them as extern(D))

Well they are already extern(D).
I guess it makes sense for dtoh to provide extern(D) enums regardless of linkage, so I'm not looking to change this.

@RazvanN7
Copy link
Contributor

RazvanN7 commented Jan 7, 2021

Giving that:

  • dtoh is constantly improving
  • hopefully, we can get rid soon of the manually generated headers
  • frontend.h is undoubtedly helpful for people maintaining downstream compilers
  • the CIs make it easy to fix frontend.h mismatches/conflicts

I suggest that we bare with frontend.h for a while.

@WalterBright are you still not convinced?

I suggest that we close this.

@RazvanN7
Copy link
Contributor

Since there were no objections, I will take the liberty of closing this. Please reopen at any time if you do not agree with my assessment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.