Macro redefinition warnings - #144
Merged
RichardGe merged 1 commit intoAug 18, 2026
Merged
Conversation
…end header Orochi.cpp includes two headers that define the same 50 macro names with different replacement lists. Orochi.h pulls in contrib/hipew/include/hipew.h, which defines the HIP-native values (hipEventDefault 0x0, hipStreamPerThread ((hipStream_t)2), __dparm(x) empty). nvidia_hip_runtime_api_oro.h, the HIP SDK's CUDA back-end, then defines the same names in terms of their CUDA equivalents (cudaEventDefault, ((cudaStream_t)2), __dparm(x) = x). Every one of them produced a C4005 warning when OROCHI_ENABLE_CUEW is defined. The collision was already resolving to the CUDA spellings, since the last definition wins and those are the ones the CU4ORO namespace needs, so this only removes the diagnostics and leaves the preprocessor output unchanged. Drop the hipew mapping with an #undef block immediately before the include, mirroring the existing cuew #undef block at the top of the namespace. The list is exactly the 50-name intersection of the two headers' #define sets: no misses, no over-reach. All 50 are unconditionally redefined by the CUDA header afterwards, so none are left dangling; __dparm is defined in both branches of its #ifdef __cplusplus. Nothing after the include uses the hipew spellings, and the public hipewInit declaration uses hipew__dparm, which is a separate macro and is untouched. Verified by compiling the directive streams extracted from both real headers with MSVC 14.51: 49 C4005 warnings before, 0 after, no new diagnostics. The 50th, hipCooperativeLaunchMultiDeviceNoPostSync, warns only in a real build because its definition uses a line continuation the extraction flattened. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
meistdan
requested review from
RichardGe,
shoikeda and
takahiroharada
and
a lite review from Copilot
August 14, 2026 02:10
There was a problem hiding this comment.
Pull request overview
This PR targets MSVC C4005 macro redefinition warnings observed during HIPRT compilation by adjusting preprocessor state in Orochi.cpp before including the NVIDIA HIP back-end headers.
Changes:
- Undefines a set of HIP-side flag/utility macros (previously provided via
hipew.hthroughOrochi.h) before includingnvidia_hip_runtime_api_oro.h, preventing conflicting macro redefinitions.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+810
to
+814
| // Orochi.h pulls in hipew.h, which defines the HIP-side spelling of these flag macros (hipEventDefault 0x0, | ||
| // hipStreamPerThread ((hipStream_t)2), __dparm(x) empty, ...). The header below is the HIP SDK's CUDA | ||
| // back-end and defines the same names in terms of their CUDA equivalents (cudaEventDefault, | ||
| // ((cudaStream_t)2), ...). Same names, different replacement lists, so every one of them was a C4005 | ||
| // macro redefinition warning. The CUDA spellings are the ones this namespace needs, and they are what the |
RichardGe
approved these changes
Aug 18, 2026
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.
This PR resolves macro redefinition warnings #98