mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-118124: Use static_assert() in Py_BUILD_ASSERT() on C11 (#118398)
Use static_assert() in Py_BUILD_ASSERT() and Py_BUILD_ASSERT_EXPR() on C11 and newer and C++11 and newer. Add tests to test_cext and test_cppext.
This commit is contained in:
parent
6999d68d28
commit
587388ff22
4 changed files with 45 additions and 16 deletions
|
@ -225,6 +225,10 @@ _testcppext_exec(PyObject *module)
|
|||
if (!result) return -1;
|
||||
Py_DECREF(result);
|
||||
|
||||
// test Py_BUILD_ASSERT() and Py_BUILD_ASSERT_EXPR()
|
||||
Py_BUILD_ASSERT(sizeof(int) == sizeof(unsigned int));
|
||||
assert(Py_BUILD_ASSERT_EXPR(sizeof(int) == sizeof(unsigned int)) == 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue