Poll: -od -lib -of and breaking compatibility with build tools
Nick Sabalausky (Abscissa)
SeeWebsiteToContactMe at semitwist.com
Thu Aug 15 03:39:42 UTC 2019
On 8/12/19 1:59 AM, FeepingCreature wrote:
> I ran into this bug a few days ago.
>
> DMD, when specifying -od (output directory), -of (output file) and
> *only* when in -lib mode, treats the output file path as relative to the
> output directory path. Ie. -odfoo -oflibbar.a results in foo/libbar.a as
> opposed to ./libbar.a. This is in contradiction to every other mode
> (-shared, binary output, object output) and every other D compiler (ldc,
> gdc).
I haven't fully refreshed my memory on this, but looking at the PR, Mr.
2015 Walter also mentioned that my PR also introduced a discrepancy in
the meaning of -od for .obj files vs .lib files while fixing the
original problem.
I only bring this up to point out that any new PR should take extra care
to fully think through the logic and handling of the relevant flags.
> This issue was raised four years ago. At the time, Walter said he was
> not fixing it in order to avoid breaking compatibility with existing
> build setups: see https://github.com/dlang/dmd/pull/4753 .
>
> People who are using build tools that call dmd: would you rather this be
> fixed, and have to update your code, or leave it in?
>
> (Me, I want it fixed. It's a really annoying trap for all the people who
> are building with dmd but aren't using -od yet, which I was among until
> a few days ago.)
I can't test right now, but does anyone know whether these flags are
case-sensitive? I know '-o' and '-O' have different meanings.
If that case sensitivity extends to -of and -od as well, then let's just
assign the the new, fully rethought and fully orthogonal behaviors to
'-OF' and '-OD'. That way, we get the best of both worlds: proper
predictable behavior PLUS absolute unquestionable certainty of not
breaking anything. We can recommend -OF/-OD as the preferred form, and
then maybe phase out -of/-od or not.
More information about the Digitalmars-d
mailing list