[RFC] Add deprecation message for extern functions with default safety#11176
[RFC] Add deprecation message for extern functions with default safety#11176pbackus wants to merge 2 commits intodlang:masterfrom
Conversation
|
Thanks for your pull request and interest in making D better, @pbackus! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
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 referencesYour 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 locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + dmd#11176" |
|
Interesting idea. This could theoretically exclude |
|
Thanks @pbackus, I think the best way to go it to require non- |
|
@PetarKirov Whether Personally, I think the value of this PR is independent of the outcome of that debate, so I've decided to punt on the issue for now. [1] https://forum.dlang.org/post/r5hfe5$u8g$1@digitalmars.com |
|
extern(D) declarations should probably be deprecated as well. Definitions on the other hand, are checked by the compiler. |
|
@atilaneves This PR applies to all |
4e3e27d to
a6cb1a0
Compare
a6cb1a0 to
170c1a9
Compare
|
|
Update: it turns out there are a lot of |
|
|
You are missing quite a lot of functions. E.g. everything in this module (the backend has a lot of those): Lines 22 to 24 in a0af9fa |
170c1a9 to
8591df9
Compare
|
@Geod24 I've updated the check; it should catch everything now. Test-suite changes are split into a separate commit to make reviewing easier. There are still un-annotated declarations in druntime and phobos that need to be updated to make the full test-suite pass. PRs for both forthcoming. |
|
Given the large number of changes this requires, it looks impractical. |
|
@WalterBright The changes in question are required by DIP 1028, regardless of whether this is merged or not. Since you yourself recently submitted one such change in dlang/druntime#3009, it seems we are in agreement about that. All this message does is makes the declarations that need updating easier to find. |
|
Closing this now that DIP 1028 has been withdrawn. |
This message is needed to avoid silently introducing safety violations
to existing code when the default is changed from
@systemto@safe. Itshould become an error when
@safeis made the default.This is an attempt to provide a compiler diagnostic for the potential safety violations that would be introduced by DIP 1028, as it is currently written. (See e.g. [1] for a more detailed explanation.)
I've implemented it as a deprecation, with the recommendation that it become an error when
-preview=safedefaultis enabled. If necessary, it can be downgraded to a warning--the important thing is to ensure that safety is not violated silently.[1] https://forum.dlang.org/post/ra8t3k$q09$1@digitalmars.com