Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add check that 'struct ModuleInfo' exists in object.d #1925

Merged
merged 1 commit into from Apr 24, 2013

Conversation

ibuclaw
Copy link
Member

@ibuclaw ibuclaw commented Apr 23, 2013

Makes Module::moduleinfo an AggregateDeclaration, sets it's value if found in object.d, and checks that it exists before generating the moduleinfo.

Knowing what type 'struct ModuleInfo' will be helpful for gdc in some related fixes in porting to ARM.

@@ -40,6 +40,7 @@
extern bool obj_includelib(const char *name);
void obj_startaddress(Symbol *s);
void obj_lzext(Symbol *s1,Symbol *s2);
void ObjectNotFound(Identifier *id);
Copy link
Member

Choose a reason for hiding this comment

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

This should go into declaration.h.

@MartinNowak
Copy link
Member

Otherwise fine

@ibuclaw
Copy link
Member Author

ibuclaw commented Apr 24, 2013

OK, updated.

MartinNowak added a commit that referenced this pull request Apr 24, 2013
Add check that 'struct ModuleInfo' exists in object.d
@MartinNowak MartinNowak merged commit 0b5641e into dlang:master Apr 24, 2013
#if MODULEINFO_IS_STRUCT
if (id == Id::ModuleInfo)
{ if (Module::moduleinfo)
Module::moduleinfo->error("only object.d can define this reserved struct name");
Copy link
Member

Choose a reason for hiding this comment

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

This is a breaking language chance and needs updating on the website.

Actually, why isn't the compiler just looking for ModuleInfo in object only?

Copy link
Member Author

Choose a reason for hiding this comment

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

As with the others (in class.c) - it assumes that object.d is the always the first module processed.

Copy link
Member Author

Choose a reason for hiding this comment

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

Will also note that before MODULEINFO_IS_STRUCT it was an error to define class ModuleInfo

Copy link
Contributor

Choose a reason for hiding this comment

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

In D2, D2, declaring struct ModuleInfo had not been rejected. Now it would raise an error "struct test.ModuleInfo only object.d can define this reserved struct name" and we should say it is be a breaking change.

Copy link
Contributor

Choose a reason for hiding this comment

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

Now, developing 2.063 is entered the beta phase. I think this breaking change is not enough reasonable. We should try to fix the regression, and if it is impossible, we should revert this change.

I'll work on this tomorrow.

Copy link
Contributor

Choose a reason for hiding this comment

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

I opened #1932 to fix the regression.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants