[Scons-dev] Bug in MSVC_BATCH handling
Bill Deegan
bill at baddogconsulting.com
Sun Dec 15 15:49:26 EST 2019
Generally issues like this should go to the users mailing list.
(Mainly so searching users mailing list will find issues run into by users).
Good catch.
Any chance you can put together a PR with a test?
-Bill
On Sun, Dec 15, 2019 at 12:13 PM Eric Fahlgren <ericfahlgren at gmail.com>
wrote:
> Py 3.7 64, Win 10 64
> SCons 3.1.1 (but same as master in this case)
>
> While cleaning up some old scripts, I uncovered a bug that I've been
> working around for who knows how long and finally isolated it.
>
> Problem: When MSVC_BATCH is enabled globally, files with different target
> name are built individually, but ignoring the specified $TARGET name.
> Here's a little example, note the first argument to the "cl" output.
>
> Input:
> env = Environment(MSVC_BATCH=True)
> bug32 = env.Object(target='file32', source='file.cpp')
>
> Output:
> cl /FoWIN32\src\\ /c WIN32\src\file.cpp
>
> If you explicitly suppress batching in the Object, then it works fine.
> Input:
> obj32 = env.Object(target='file32', source='file.cpp', MSVC_BATCH=False)
> Output:
> cl /FoWIN32\src\file32.obj /c WIN32\src\file.cpp
>
> I chased this to the logic in Tool.msvc, the function msvc_output_flag
> where it's checking the state of the MSVC_BATCH variable, and ignores the
> difference in base name that the function just above (msvc_batch_key)
> performs, see lines 168-173. My hack, which seems to work, is to change
> line 191 in msvc.py from:
>
> 191: if 'MSVC_BATCH' not in env or env.subst('$MSVC_BATCH') in ('0', '
> False', '', None):
>
> to use the already-working logic in the batch key function like this:
>
> 191: if msvc_batch_key(None, env, target, source) is None:
>
> I tried it on single file and multi-file compilations, and from my cursory
> playing around, this keeps the batched files together and separates out
> those with different target base names, but then I didn't try all cases or
> check any other downstream code in the pipeline to see if this would break
> anything there...
>
> _______________________________________________
> Scons-dev mailing list
> Scons-dev at scons.org
> https://pairlist2.pair.net/mailman/listinfo/scons-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist2.pair.net/pipermail/scons-dev/attachments/20191215/66f53714/attachment.html>
More information about the Scons-dev
mailing list