Fix Issue 13738 - RTInfo generation on deprecated struct causes deprecation message#4147
Conversation
src/struct.c
Outdated
There was a problem hiding this comment.
I know doing things like this works, but in my experience tweaking global settings like this usually turn out badly, causing unexpected bugs popping up in other places. Please, there's got to be a better way!
(For a primo example, the gagging system in dmd. It's awful, and has been the cause of endless problems and bugs.)
There was a problem hiding this comment.
Perhaps a better plan is to recognize RTInfo as special and omit the message where it is generated, rather than here with a global setting.
There was a problem hiding this comment.
This is not really a "global" setting, but modifies the current type. I agree that the solution is non-optimal.
I tried to figure if there is a way to detect running RTInfo analysis in checkDeprecated, but one problem is that a new scope is created when evaluating template arguments (https://github.com/D-Programming-Language/dmd/blob/master/src/template.c#L5998).
The problem mentioned in the comment is: if we mute messages during analysis of RTInfo, it might silently instantiate templates that use (other) deprecated types. If these template instances are used in other parts of the program later, they will be reused without ever producing the deprecation message. The implementation here restricts muting to the types that RTInfo is currently generated for.
There was a problem hiding this comment.
Can you please amend the comment to reflect the better explanation?
Done. Thinking about it again, it might be less invasive to add a bool "mutedeprecated" that is read only in DSymbol::checkDeprecated. That way any other semantic analysis is unaffected (e.g. inheriting deprecation from base class). |
I pushed a new version that implements this. |
|
@braddr I very often see the FreeBSD testers fail like with this test: they are waiting at the end of the successful druntime tests until the timeout of 20 minutes expires. I tried to reproduce this in a FreeBSD VM, but it never happened for me. |
|
Auto-merge toggled on |
Fix Issue 13738 - RTInfo generation on deprecated struct causes deprecation message
assume aggregate to be non-deprecated during RTInfo generation
https://issues.dlang.org/show_bug.cgi?id=13738