Same as the above but supports compile-time expressions.
(self, cexpr, flags=[])
| 1092 | |
| 1093 | @_Cache.me |
| 1094 | def cc_test_cexpr(self, cexpr, flags=[]): |
| 1095 | """ |
| 1096 | Same as the above but supports compile-time expressions. |
| 1097 | """ |
| 1098 | self.dist_log("testing compiler expression", cexpr) |
| 1099 | test_path = os.path.join(self.conf_tmp_path, "npy_dist_test_cexpr.c") |
| 1100 | with open(test_path, "w") as fd: |
| 1101 | fd.write(textwrap.dedent(f"""\ |
| 1102 | #if !({cexpr}) |
| 1103 | #error "unsupported expression" |
| 1104 | #endif |
| 1105 | int dummy; |
| 1106 | """)) |
| 1107 | test = self.dist_test(test_path, flags) |
| 1108 | if not test: |
| 1109 | self.dist_log("testing failed", stderr=True) |
| 1110 | return test |
| 1111 | |
| 1112 | def cc_normalize_flags(self, flags): |
| 1113 | """ |