Skip to content

Refactor: Prefer 'if constexpr' Over Preprocessor Macros - #325

Draft
ZwFink wants to merge 17 commits into
mainfrom
remove_preprocessor_if
Draft

Refactor: Prefer 'if constexpr' Over Preprocessor Macros#325
ZwFink wants to merge 17 commits into
mainfrom
remove_preprocessor_if

Conversation

@ZwFink

@ZwFink ZwFink commented Nov 22, 2025

Copy link
Copy Markdown
Collaborator

Closes #298

This PR replaces some uses of #ifdef PROTEUS_ENABLE_HIP/CUDA with if constexpr.
I do not apply this change in "top-level" entries outside any function/class definition.
Some instances yield compiler errors if changed; I leave them unchanged.

@ZwFink
ZwFink force-pushed the remove_preprocessor_if branch from d6a6879 to 2c5ade9 Compare November 24, 2025 18:01
@ZwFink
ZwFink force-pushed the remove_preprocessor_if branch from 2c5ade9 to 6d1f528 Compare December 1, 2025 18:19
Comment thread src/lib/CMakeLists.txt
Comment thread CMakeLists.txt

message(STATUS "Using LLVM installation: ${LLVM_INSTALL_DIR}")

# Always define GPU feature macros to numeric 0/1 for all targets

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opinion: I prefer avoiding global cmake options. I prefer having them per target and also specify the usage requirements.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not define these in a generated config header? Do we support the values changing at use time vs. proteus library build time?

@ggeorgakoudis
ggeorgakoudis marked this pull request as draft March 4, 2026 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Avoid maybe_unused in favor of if contexpr

3 participants