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

Fix Issue 14305 - DMD incorrectly interprets -of and -od with -lib... #4753

Closed
wants to merge 2 commits into from

Conversation

Abscissa
Copy link
Contributor

@CyberShadow
Copy link
Member

This is some odd logic... With -odA, -ofb.lib and -ofA/b.lib would do the same thing?

@Abscissa
Copy link
Contributor Author

Hmm, ok, I think I managed to have a bug and a misunderstanding of -od manage to cancel each other out. This does the right thing, but for the wrong reasons. Gonna revisit and reopen this after some sleep.

@Abscissa Abscissa closed this Jun 19, 2015
@Abscissa
Copy link
Contributor Author

Ok, I reworked it.

@Abscissa Abscissa reopened this Jun 19, 2015
@WalterBright
Copy link
Member

What bothers me about this is now -od has a different meaning for .obj files and for .lib files. This is intensely confusing. If -od, -of, and -lib are all given, then the path should be stripped from the -of name, and the path from -od used.

@CyberShadow
Copy link
Member

What bothers me about this is now -od has a different meaning for .obj files and for .lib files.

This also applies to the current situation (see description of issue 14305).

. If -od, -of, and -lib are all given, then the path should be stripped from the -of name, and the path from -od used.

I think it would be better to ignore -od (and only use it for intermediary files) if -of is specified, for -lib to be consistent with non--lib usage, no?

@WalterBright
Copy link
Member

  1. there's how obj, lib, exe, dll, html, etc. files are generated. This should all be consistent.
  2. I am reluctant to simply change all this around, as who knows what makefiles and build systems will get broken. Such a change could highly annoy many users.

The only solution I can see is to define a new switch, and define some systematic and consistent behavior for it. Leave -od as it is.

@CyberShadow
Copy link
Member

  1. This should all be consistent.
  2. I am reluctant to simply change all this around

These are mutually exclusive as I understand

@CyberShadow
Copy link
Member

Looking at the code, I think this patch is done in the wrong place, and should instead be done in Lib*::setFilename (which, BTW, is identical across all four Library implementations and should be refactored).

They contains the following code:

    const char *arg = filename;
    if (!arg || !*arg)
    {   // Generate lib file name from first obj name
        const char *n = (*global.params.objfiles)[0];

        n = FileName::name(n);
        arg = FileName::forceExt(n, global.lib_ext);
    }
    if (!FileName::absolute(arg))
        arg = FileName::combine(dir, arg);

The second if block should be moved to the end of the first if block, so that the -od switch only applies to automatically-generated output filenames, and not any explicitly-user-specified filenames.

@MartinNowak
Copy link
Member

What's the state of this?
Why do we need to fix an rdmd bug in dmd.
If it addresses a regression it should go into the stable branch.

@CyberShadow
Copy link
Member

Why do we need to fix an rdmd bug in dmd.

https://issues.dlang.org/show_bug.cgi?id=14296#c1

@WalterBright
Copy link
Member

Again, I think it is a BAD idea to change the behavior of -od. It's a fine way to make people mad. To change the behavior, a new switch must be created, or fix rdmd to use fully qualified names.

@ibuclaw
Copy link
Member

ibuclaw commented Jan 14, 2018

As per comments last comments, I will close this.

@Abscissa - Please rebase and reopen if you think that this should be pursued in a new light.

@FeepingCreature
Copy link
Contributor

FeepingCreature commented Aug 9, 2019

I've just ran into this behavior of -od. Let me just say that the crazy, lolrandom way that it currently works is making me plenty mad on its own.

I'd rather dlang make some people mad now rather than make every future user mad when they find out.

@FeepingCreature
Copy link
Contributor

Update: opinion on the forums seems unanimously in favor of 'fix it, please'.

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