dmd icon indicating copy to clipboard operation
dmd copied to clipboard

bitfields: add bitoffsetof, bitwidth, isBitfield

Open WalterBright opened this issue 3 months ago • 5 comments

Adds bitfield introspection capabilities as described:

https://github.com/WalterBright/documents/blob/master/bitfields.md

WalterBright avatar May 05 '24 23:05 WalterBright

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#16444"

dlang-bot avatar May 05 '24 23:05 dlang-bot

Awesome! Thanks for doing this, it'll be a real help.

That covers one of the major issues I outlined in my original post.

rikkimax avatar May 05 '24 23:05 rikkimax

@jmdavis This should address the introspection concerns and help you with your work on traits.

LightBender avatar May 05 '24 23:05 LightBender

As for the "Needs Spec PR" there's a 2+ year old PR for bitfield documentation:

https://github.com/dlang/dlang.org/pull/3190

WalterBright avatar May 06 '24 03:05 WalterBright

You would still need to add those properties & trait to that PR

thewilsonator avatar May 06 '24 03:05 thewilsonator

@RazvanN7 why was this merged without a spec PR for the traits?

thewilsonator avatar May 08 '24 23:05 thewilsonator

@thewilsonator Walter has complained about this PR stalling other work. The bitfields DIP hasn't been accepted yet so it might be the case that all of this is reverted anyway. Once the DIP is accepted we can take care of the spec PR, or if it gets rejected then no harm was done.

I agree that the best approach here would have been to also have a spec PR, however, I took Walter's annoyance into account and decided to merge this as is.

RazvanN7 avatar May 09 '24 07:05 RazvanN7