|
27 | 27 |
|
28 | 28 | function(get_hiprtc_macros HIPRTC_DEFINES) |
29 | 29 | set(${HIPRTC_DEFINES} |
30 | | -"#pragma clang diagnostic push\n\ |
31 | | -#pragma clang diagnostic ignored \"-Wreserved-id-macro\"\n\ |
32 | | -#pragma clang diagnostic ignored \"-Wc++98-compat-pedantic\"\n\ |
33 | | -#pragma clang diagnostic ignored \"-Wreserved-macro-identifier\"\n\ |
34 | | -#pragma clang diagnostic ignored \"-Wundef\"\n\ |
35 | | -#define __device__ __attribute__((device))\n\ |
| 30 | +"#define __device__ __attribute__((device))\n\ |
36 | 31 | #define __host__ __attribute__((host))\n\ |
37 | 32 | #define __global__ __attribute__((global))\n\ |
38 | 33 | #define __constant__ __attribute__((constant))\n\ |
@@ -70,30 +65,35 @@ namespace std {\n\ |
70 | 65 | using ::ptrdiff_t;\n\ |
71 | 66 | using ::clock_t;\n\ |
72 | 67 | }\n\ |
73 | | -#endif // __HIP_NO_STD_DEFS__\n\ |
74 | | -#pragma clang diagnostic pop" |
| 68 | +#endif // __HIP_NO_STD_DEFS__\n" |
75 | 69 | PARENT_SCOPE) |
76 | 70 | endfunction(get_hiprtc_macros) |
77 | 71 |
|
78 | 72 | # To allow concatenating above macros during build time, call this file in script mode. |
79 | 73 | if(HIPRTC_ADD_MACROS) |
80 | 74 | # Read the existing content of the preprocessed file into a temporary variable |
81 | 75 | FILE(READ "${HIPRTC_PREPROCESSED_FILE}" ORIGINAL_PREPROCESSED_FILE) |
82 | | -# Prepend the pragma to the original content |
83 | | - set(MODIFIED_PREPROCESSED_FILE "#pragma clang diagnostic ignored \"-Weverything\" |
| 76 | +# Prepend the push and ignore pragmas to the original preprocessed file |
| 77 | + set(PRAGMA_PUSH "#pragma clang diagnostic push") |
| 78 | + set(PRAGMA_EVERYTHING "#pragma clang diagnostic ignored \"-Weverything\"") |
| 79 | + set(MODIFIED_PREPROCESSED_FILE "${PRAGMA_PUSH}\n${PRAGMA_EVERYTHING} |
84 | 80 | \n${ORIGINAL_PREPROCESSED_FILE}") |
85 | 81 | # Write the modified preprocessed content back to the original file |
86 | 82 | FILE(WRITE ${HIPRTC_PREPROCESSED_FILE} "${MODIFIED_PREPROCESSED_FILE}") |
| 83 | + |
87 | 84 | message(STATUS "Appending hiprtc macros to ${HIPRTC_PREPROCESSED_FILE}.") |
88 | 85 | get_hiprtc_macros(HIPRTC_DEFINES) |
89 | 86 | FILE(APPEND ${HIPRTC_PREPROCESSED_FILE} "${HIPRTC_DEFINES}") |
90 | 87 | set(HIPRTC_HEADER_LIST ${HIPRTC_HEADERS}) |
91 | 88 | separate_arguments(HIPRTC_HEADER_LIST) |
92 | | -# appends all the headers from the list to the hiprtc preprocessed file |
| 89 | +# Appends all the headers from the list to the hiprtc preprocessed file |
93 | 90 | foreach(header ${HIPRTC_HEADER_LIST}) |
94 | 91 | FILE(READ "${header}" HEADER_FILE) |
95 | 92 | FILE(APPEND ${HIPRTC_PREPROCESSED_FILE} "${HEADER_FILE}") |
96 | 93 | endforeach() |
| 94 | +# Append the pop pragma to the preprocessed file |
| 95 | + set(PRAGMA_POP "#pragma clang diagnostic pop\n") |
| 96 | + FILE(APPEND ${HIPRTC_PREPROCESSED_FILE} "${PRAGMA_POP}") |
97 | 97 | endif() |
98 | 98 |
|
99 | 99 | macro(generate_hiprtc_header HiprtcHeader) |
|
0 commit comments