Skip to content

Conversation

@wilzbach
Copy link
Contributor

@wilzbach wilzbach commented Jan 9, 2018

The following still triggers a deprecation warning:

deprecated creal foo() { return 2 + 2i; }

In other words a creal in a FuncDeclaration doesn't check its function yet.
However, this is good enough to push the complex transition at Phobos as auto
works just fine.

See also: #7640

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @wilzbach!

Bugzilla references

Auto-close Bugzilla Description
18212 Usage of cfloat,cdouble,cfloat,ifloat,idouble,ireal shouldn't trigger an error in deprecated code

*
* Returns: `true` if any parent scope is deprecated, `false` otherwise`
*/
final bool isInDeprecatedScope(Scope* sc)
Copy link
Contributor

Choose a reason for hiding this comment

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

In general I prefer not to split things out into functions unless they have more than one caller, or the caller is excessively large. Also, in general, I think this refactoring should be in a separate PR as it is not essential to the bug-fix at hand, and should be argued on its own individual merits.

Copy link
Contributor

Choose a reason for hiding this comment

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

Another problem with this method is it's modifying the public interface of the class, yet there is no public caller or potential caller. If it is decided to keep this, it should probably be in its own private static function within the module.

Copy link
Contributor Author

@wilzbach wilzbach Jan 9, 2018

Choose a reason for hiding this comment

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

There are two callers: checkComplexTransition and checkDeprecated - it just felt wrong to duplicate code that has a certain functionality.
It might get changed or improved later and then the duplication won't get an update.

Copy link
Contributor

Choose a reason for hiding this comment

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

Gah! Sorry. Totally missed that. You're right on here.

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this also needs to be reflected in the C++ interface dsymbo.h

* loc = The source location.
*/
final void checkComplexTransition(Loc loc)
final bool checkComplexTransition(Loc loc, Scope* sc)
Copy link
Contributor

Choose a reason for hiding this comment

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

C++ interface change. See mtype.h.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(done)

@wilzbach
Copy link
Contributor Author

wilzbach commented Jan 9, 2018

I believe this also needs to be reflected in the C++ interface dsymbo.h

I thought we only need to add methods to the header files that are used by the LDC or GDC?
BTW I wasn't really sure where the right place to put is. After thinking a bit about it I moved it in Scope at dscope.d.

@wilzbach wilzbach force-pushed the fix-18212 branch 2 times, most recently from 3fb6a19 to b2e1245 Compare January 9, 2018 15:41
JinShil
JinShil previously requested changes Jan 9, 2018
src/dmd/dscope.d Outdated
*
* Returns: `true` if this or any parent scope is deprecated, `false` otherwise`
*/
extern(D) bool isDeprecated()
Copy link
Contributor

@JinShil JinShil Jan 9, 2018

Choose a reason for hiding this comment

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

Isn't extern(D) the default? I think that is redundant.

UPDATE: Actually I think this should be extern(C++) if it is part of the public interface. See the other methods in struct Scope. And then I think this method needs to be added to scope.h.

It is also my understanding that we only need to maintain the C++ interface for GDC and LDC, but this looks like part of the public interface that they will consume.

@JinShil
Copy link
Contributor

JinShil commented Jan 9, 2018

After thinking a bit about it I moved it in Scope at dscope.d.

Seems logical.

… shouldn't trigger an error in deprecated code
Copy link
Member

@ibuclaw ibuclaw left a comment

Choose a reason for hiding this comment

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

Ok.

@wilzbach
Copy link
Contributor Author

wilzbach commented Jan 9, 2018

Somehow DAutoTest is under heavy stress recently and it hasn't picked up this PR :/
@CyberShadow is there anything easy that could be done to speed up DAutoTest? With our transition to SemaphoreCI, DAutoTest is now the slowest CI.
Cleaning up the Makefile hell at dlang.org will probably take a couple of weeks.

@CyberShadow
Copy link
Member

@CyberShadow is there anything easy that could be done to speed up DAutoTest?

Maybe less build steps and less clones from scratch, eh? ;)

I'm not sure it's a question of computing resources - it's already running on a tmpfs, and the server is essentially never CPU-starved.

@wilzbach wilzbach deleted the fix-18212 branch March 13, 2018 17:29
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.

5 participants