| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 9112dae commit c1adc06
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -214,12 +214,12 @@ | |||
| 214 | 214 | // | |
| 215 | 215 | // gh-158810: Do not use __builtin_types_compatible_p() in strict C ANSI mode | |
| 216 | 216 | // and on C++. | |
| 217 | - #if (defined(__GNUC__) && __GNUC__ >= 4 \ | ||
| 217 | + #if (defined(__GNUC__) && __GNUC__ >= 4 && defined(_Py_TYPEOF) \ | ||
| 218 | 218 | && !defined(__STRICT_ANSI__) && !defined(__cplusplus)) | |
| 219 | 219 | #define Py_ARRAY_LENGTH(array) \ | |
| 220 | 220 | (sizeof(array) / sizeof((array)[0]) \ | |
| 221 | - + Py_BUILD_ASSERT_EXPR(!__builtin_types_compatible_p(typeof(array), \ | ||
| 222 | - typeof(&(array)[0])))) | ||
| 221 | + + Py_BUILD_ASSERT_EXPR(!__builtin_types_compatible_p(_Py_TYPEOF(array), \ | ||
| 222 | + _Py_TYPEOF(&(array)[0])))) | ||
| 223 | 223 | #else | |
| 224 | 224 | #define Py_ARRAY_LENGTH(array) \ | |
| 225 | 225 | (sizeof(array) / sizeof((array)[0])) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -388,6 +388,11 @@ module_exec(PyObject *module) | |||
| 388 | 388 | return -1; | |
| 389 | 389 | } | |
| 390 | 390 | #endif | |
| 391 | + #ifdef __STRICT_ANSI__ | ||
| 392 | + if (PyModule_AddIntConstant(module, "__STRICT_ANSI__", 1) < 0) { | ||
| 393 | + return -1; | ||
| 394 | + } | ||
| 395 | + #endif | ||
| 391 | 396 | #ifdef __cplusplus | |
| 392 | 397 | if (PyModule_AddIntMacro(module, __cplusplus) < 0) { | |
| 393 | 398 | return -1; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -28,7 +28,12 @@ def main(): | |||
| 28 | 28 | testmod = importlib.import_module(module_name) | |
| 29 | 29 | ||
| 30 | 30 | newline = False | |
| 31 | - for name in ('__STDC_VERSION__', '__cplusplus', '_MSVC_LANG'): | ||
| 31 | + for name in ( | ||
| 32 | + '__STDC_VERSION__', | ||
| 33 | + '__STRICT_ANSI__', | ||
| 34 | + '__cplusplus', | ||
| 35 | + '_MSVC_LANG', | ||
| 36 | + ): | ||
| 32 | 37 | try: | |
| 33 | 38 | value = getattr(testmod, name) | |
| 34 | 39 | except AttributeError: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -135,7 +135,7 @@ def main(): | |||
| 135 | 135 | # option emits a C++ compiler warning. Remove "-std11" option from the | |
| 136 | 136 | # CC command. | |
| 137 | 137 | cmd = (sysconfig.get_config_var('CC') or '') | |
| 138 | - if cmd is not None: | ||
| 138 | + if cmd is not None and 'CC' not in os.environ: | ||
| 139 | 139 | if support.MS_WINDOWS: | |
| 140 | 140 | std_prefix = '/std' | |
| 141 | 141 | else: | |
| Back | FazBrowse Home | New Git URL |
0 commit comments