CUDA-1.11¶
Do not modify CUDA language specific macro names
Required inputs: IR
CUDA 1.11 [preprocessing.reserved-macros] Do not modify CUDA language specific macro names
The macro names defined in the CUDA language specification should not be undefined or redefined in the user code.
Scope: Host, Device.
Audience: CUDA C++.
Category: Required.
Hardware Applicability: All Compute Capabilities.
Rationale
The macro names defined in the CUDA language specification control the way the compiler behaves. The user should not modify these macros because this can have dangerous repercussions in the compiler.
Example 1 (Bad)
# undef __CUDA_ARCH__ // non-compliant: the macro name is defined by the implementation.Excerpt from NVIDIA CUDA C++ Guidelines for robust and safety-critical programming, Version 3.0.1, Copyright (C) 2018-2023 NVIDIA Corporation.
Possible Messages
Key |
Text |
Severity |
Disabled |
|---|---|---|---|
cuda_preprocessing_reserved_macros |
Do not modify CUDA language specific macro names |
None |
False |
Options¶
This rule shares the following common options: exclude_in_macros, exclude_messages_in_system_headers, excludes, extend_exclude_to_macro_invocations, includes, justification_checker, languages, post_processing, provider, report_at, severity
The following places define options that affect this rule: Stylechecks, Analysis-GlobalOptions
forbidden_macros¶
forbidden_macros
CUDA SDK macro names that shall not be undefined or redefinedType: set[bauhaus.analysis.config.MacroName]
Default:
{'__CUDACC_RDC__', '__CUDACC_VER_MAJOR__', '__CUDACC_VER_MINOR__', '__CUDACC__', '__CUDA_ARCH__', '__constant__', '__device__', '__global__', '__host__', '__managed__', '__shared__'}