Skip to content

Templatize _d_arrayappendcTX#21205

Merged
thewilsonator merged 1 commit intodlang:masterfrom
Albert24GG:_d_arrayappendcTX
May 16, 2025
Merged

Templatize _d_arrayappendcTX#21205
thewilsonator merged 1 commit intodlang:masterfrom
Albert24GG:_d_arrayappendcTX

Conversation

@Albert24GG
Copy link
Contributor

This PR continues the work started in #21144.
Any suggestions for further cleanup or optimization are welcome.

@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @Albert24GG! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

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

@Albert24GG Albert24GG marked this pull request as ready for review April 14, 2025 22:17
Copy link
Member

@teodutu teodutu left a comment

Choose a reason for hiding this comment

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

Looking good. Now fix the few coding style nitpicks and try to remove the qualifiers in the compiler instead of the wrapper hook.

@schveiguy
Copy link
Member

Why were some jobs cancelled?

Copy link
Member

@schveiguy schveiguy left a comment

Choose a reason for hiding this comment

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

I dislike having to cast all over the place. Maybe better to refactor, and use T* for ptr instead of void*?

The only place where void* makes the most sense is the memset call, but you can change newsize to newlength there, and then it's fine.

In general, it would be nice to get rid of void* and variables that aren't based on the element size completely. This is one clunky piece of the original code that is always confusing (is it length or size? Which one is in terms of bytes and which is in terms of elements?). It also can limit where we have to write trusted code.

This can be done later, if you don't want to do it in this PR. But fix the other things.

@teodutu
Copy link
Member

teodutu commented Apr 21, 2025

Why were some jobs cancelled?

The runner they're using is deprecated: actions/runner-images#11101

@RazvanN7
Copy link
Contributor

RazvanN7 commented Apr 23, 2025

@schveiguy @teodutu is this PR ready to be merged? Your comments have been addressed.

@Albert24GG Albert24GG requested a review from schveiguy April 23, 2025 08:10
Copy link
Member

@teodutu teodutu left a comment

Choose a reason for hiding this comment

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

Yup, things look good.

Copy link
Member

@schveiguy schveiguy left a comment

Choose a reason for hiding this comment

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

Thanks!

@RazvanN7
Copy link
Contributor

RazvanN7 commented May 9, 2025

Please squash commits. Also, is the changelog necessary? I haven't seen this being done for other hooks.

@Albert24GG
Copy link
Contributor Author

@RazvanN7 The other hooks introduced their changelogs after the PRs have been merged, but @teodutu advised me to add it now. I can discard it if it's redundant.
Regarding the commits, can't they be squashed when the PR is merged?

@teodutu
Copy link
Member

teodutu commented May 9, 2025

The requirement for a changelog entry was suggested here [1]. I made some changelog entries myself back in the day, but I also forgot about them.

[1] #21151 (comment)

Use existing `Unqual` and `__arrayAlloc` templates

Remove redundant array assignment

Update templatized `_d_arrayappendcTX`

Remove old `_d_arrayappendcTX` hook

Remove redundant variable

Replace `size_t` with `auto`

Fix slice passed to `gc_expandArrayUsed`

Avoid casting pointer retuned by `GC.malloc`

Remove `pure` attribute from `_d_arrayappendT`

Fix spacing for `version` statements

Add newline at EOF in `appending.d`

Remove explicit pure attribute from `_d_arrayappendcTX`

Remove implementations details from docs

Trim trailing whitespace

Fix spacing in if statements

Remove unnecessary casts

refactor: Replace `void*` with `T*`

Mark gc extern(C) functions as private

Add docs explaining the purpose of `@trusted` attribute

Fix newlines

Call `typeid` directly without storing the result

Add changelog file
@Albert24GG Albert24GG force-pushed the _d_arrayappendcTX branch from 7c4a6f7 to 696ee49 Compare May 15, 2025 12:49
@Albert24GG
Copy link
Contributor Author

@RazvanN7 Done with squashing.

@thewilsonator thewilsonator merged commit e4ab5d5 into dlang:master May 16, 2025
41 of 42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants