-
-
Notifications
You must be signed in to change notification settings - Fork 613
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 -conf=path compiler switch #4256
Conversation
177a003
to
baddfcf
Compare
See the references above for how people struggle with the current behavior. |
A reasonable case can be made for just about any ordering. I don't think this change is categorically better than the current one. An argument could probably be made for ordering along with a policy/procedure for merging, but even that's fraught with fun. Or, hrm.. never tried it, but can you do something like DFLAGS=$DFLAGS -Inewdir in dmd.conf right now? For the sake of testing and guaranteed consistency of them, a command line parameter to point to the config file to use would probably be best. Assuming it also overrides any other search and internal defaults. |
People tend to "fire and forget" their dmd.conf. Changing the search order will unexpectedly break things for them. It's like changing the way |
On the other hand, sometimes you want to override sc.ini for a local project. I'm not sure what the best way is, but it's really annoying not being able to use a specific config file. |
No it can't, it's an installation time configuration for the compiler. That doesn't change when you cd into another directory. The current search order is nonsense because it favors using the same configuration for multiple compilers over using specific configurations per compiler.
That's what you'd use a compiler switch for that specifies an alternative configuration.
Yeah, I'm also worried about that. Now I wonder who uses the current search order to override it's configuration. We could detect that and ask the people to move the config files. |
Sure, if we had one.
Yes please. |
baddfcf
to
0d77bfc
Compare
That would probably be the best solution. |
0d77bfc
to
f5e8b48
Compare
I'm search for both the new and the old order. If there is a mismatch an informational warning is printed, advising people to use the newly added Once again the old order is culprit for many dmd.conf related issues, because it doesn't make sense that my installed compiler picks up a different config file depending on where I am. |
f5e8b48
to
b131af1
Compare
It seems obvious to me that when I am in my project directory, that it picks up the config file from that directory. I use it all the time. Anyhow, a compiler flag sounds fine, but not a redo of the order and the attendant confusion and breakage that will cause.
That just seems like layers of more complexity. |
I disagree with the proposed order; local stuff should override global stuff. So things are good as they are. To override the global stuff just create a local conf file. I'm okay with adding a flag though I see all this unnecessary churn and the illusion of progress because a simple and effective solution is available. |
Yes, local to the compiler you're using. |
- allows to specify a compiler config file
b131af1
to
6a941e3
Compare
Now it's only the -conf=path switch. I also left in the additions to error.c.
It's obvious for things that you want to configure on a per-project base, like say which compiler version to use. But it doesn't make sense to use the same compiler configuration for every compiler. You're configuring the compiler not your project, therefor you need to lookup the config file from where the compiler is installed not from where your project lives. |
{ | ||
if (strncmp(p + 1, "conf=", 5) == 0) | ||
conf = p + 6; | ||
else if (strcmp(p + 1, "run") == 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's "run" doing here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In dmd -run myprog.d -conf=dmd.conf
the -conf=dmd.conf
argument belongs to myprog.
If |
* Used for backtraces, etc | ||
*/ | ||
void errorSupplemental(Loc loc, const char *format, ...) | ||
void warningSupplemental(Loc loc, const char *format, ...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't add these if they're not used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I already needed them earlier and it just makes the API consistent.
Good idea, added that. |
ec1fd40
to
b6515ed
Compare
@@ -296,7 +299,7 @@ const char *inifile(const char *argv0, const char *inifile, const char *envsecti | |||
break; | |||
} | |||
} | |||
return filename; | |||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unnecessary return at end of function
Auto-merge toggled on |
add -conf=path compiler switch
tl;dr, please reconsider changing the conf order or splitting the conf file That dmd.conf is driving me crazy. I need a dmd.conf in my dmd repo, so that I can use dmd-master. It wouldn't work without a config and putting Now that we require a host D compiler to build dmd it no longer works, because the dmd.conf for my dmd-master overrides the system wide dmd.conf of my host dmd. Setting HOST_DC is a workaround but is impractical, because it requires an awkward We learned the same from dlang.org dlang/dlang.org#758 (comment), adding the It might seem intuitive, that a local configuration should override a global one, but it's a false friend here, because the configuration should be local from the perspective of the compiler, not from the perspective of the user. In fact the config is so tied to the compiler that we could almost compile it into the compiler (like gcc does with it's spec). At best it's something package maintainers need to touch to accomodate platform differences, but it's not a user configuration file. If people use it to configure DFLAGS and such project dependent stuff, then we need to split the configuration file, into one part that tells the compiler where to find druntime/phobos and how to link, and one part that can be used for per-project configuration of compiler arguments and env variables. conclusionThe lookup order for the config file should be changed to the following.
The current situation is unmaintainable. |
No description provided.