Skip to content

remove dmacro.d dependency on doc.d#15470

Merged
WalterBright merged 1 commit into
dlang:masterfrom
WalterBright:utfStride
Aug 10, 2023
Merged

remove dmacro.d dependency on doc.d#15470
WalterBright merged 1 commit into
dlang:masterfrom
WalterBright:utfStride

Conversation

@WalterBright

Copy link
Copy Markdown
Member

Also make declarations private by default and obsolete C++ linkage, and default to @trusted.

@dlang-bot

Copy link
Copy Markdown

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

@WalterBright
WalterBright force-pushed the utfStride branch 2 times, most recently from 5b596d3 to 3273a37 Compare July 28, 2023 20:22
@WalterBright
WalterBright requested a review from ibuclaw as a code owner July 28, 2023 20:22
Comment thread compiler/src/dmd/doc.d Outdated
Comment thread compiler/src/dmd/dmacro.d Outdated
* Returns: number of bytes in UTF character. Returns 1 on invalid UTF start.
*/
@safe
int utfStride(scope const(char)* p) @nogc nothrow pure

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Instead of duplicating this function, a common function should be imported from dmd.root.utf. Otherwise, this function needs a unittest and correct documentation. ("length of an UTF string" is wrong, it returns the number of UTF-8 code units in a code point based on the first one)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I fixed the documentation and added some unittests. Generally, you're right that one shouldn't repeat oneself. In this case, I wanted dmacros.d to be usable as a macro text processor on its own, and utfStride() is a trivial function. root.utf is a substantial module. In this case, it's justifiable for a tiny bit of redundancy.

@WalterBright
WalterBright force-pushed the utfStride branch 8 times, most recently from 26ee989 to 71ef7f8 Compare August 9, 2023 05:16
@WalterBright

Copy link
Copy Markdown
Member Author

@dkorpel ping

@WalterBright
WalterBright merged commit 1628aff into dlang:master Aug 10, 2023
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.

4 participants