apply cpuid guard to tbb headers copied at install time#253
Merged
Conversation
On Windows, RcppParallel ships the TBB headers provided by Rtools, not the bundled copy of oneTBB -- useTbbPreamble() copies them from TBB_INC at build time. The __cpuid guard added in #248 patched only the bundled sources, so installed packages on Windows never received it, and the cpuid.h/intrin.h include-order conflict persisted. Post-process the copied _machine.h in useTbbPreamble() instead, applying the same guard to whichever headers are actually installed. The patch function is idempotent and bails if the header does not have the expected form.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #248, which turned out to be incomplete: on Windows, RcppParallel ships the TBB headers provided by Rtools, not the bundled oneTBB copy --
useTbbPreamble()copies them fromTBB_INCat build time. So the__cpuidguard patched into the bundled sources never reached installed packages on Windows, and thecpuid.h/intrin.hinclude-order conflict persisted. Confirmed on a real Rtools45 setup: the sourceCpp repro (#include <cpuid.h>before<tbb/parallel_sort.h>) still failed against a patched build, with the installed_machine.hshowing the unpatched line.This applies the same guard by post-processing the copied
_machine.hinuseTbbPreamble(), covering both the Rtools and bundled header sources. The patch function is idempotent (skips ifpush_macroalready present) and bails unless the header contains exactly one bare#include <intrin.h>line, so unexpected header layouts are left untouched.Tested: patching a pristine v6.0.0
_machine.hproduces output identical (modulo blank lines) to the source-patched bundled header; re-running is a no-op; files without the expected include are left unmodified._flow_graph_trace_impl.his the only other TBB header including<intrin.h>, and only under_MSC_VER, so_machine.hremains the single mingw chokepoint.