mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-129666: Add C11/C++11 to docs and -pedantic-errors
to GCC/clang test_c[pp]ext tests (GH-130686)
This commit is contained in:
parent
cc17307faa
commit
003e6d2b97
7 changed files with 62 additions and 0 deletions
|
@ -161,11 +161,24 @@ private:
|
|||
|
||||
int VirtualPyObject::instance_count = 0;
|
||||
|
||||
// Converting from function pointer to void* has undefined behavior, but
|
||||
// works on all known platforms, and CPython's module and type slots currently
|
||||
// need it.
|
||||
// (GCC doesn't have a narrower category for this than -Wpedantic.)
|
||||
_Py_COMP_DIAG_PUSH
|
||||
#if defined(__GNUC__)
|
||||
#pragma GCC diagnostic ignored "-Wpedantic"
|
||||
#elif defined(__clang__)
|
||||
#pragma clang diagnostic ignored "-Wpedantic"
|
||||
#endif
|
||||
|
||||
PyType_Slot VirtualPyObject_Slots[] = {
|
||||
{Py_tp_free, (void*)VirtualPyObject::dealloc},
|
||||
{0, _Py_NULL},
|
||||
};
|
||||
|
||||
_Py_COMP_DIAG_POP
|
||||
|
||||
PyType_Spec VirtualPyObject_Spec = {
|
||||
/* .name */ STR(MODULE_NAME) ".VirtualPyObject",
|
||||
/* .basicsize */ sizeof(VirtualPyObject),
|
||||
|
@ -241,11 +254,20 @@ _testcppext_exec(PyObject *module)
|
|||
return 0;
|
||||
}
|
||||
|
||||
// Need to ignore "-Wpedantic" warnings; see VirtualPyObject_Slots above
|
||||
_Py_COMP_DIAG_PUSH
|
||||
#if defined(__GNUC__)
|
||||
#pragma GCC diagnostic ignored "-Wpedantic"
|
||||
#elif defined(__clang__)
|
||||
#pragma clang diagnostic ignored "-Wpedantic"
|
||||
#endif
|
||||
|
||||
static PyModuleDef_Slot _testcppext_slots[] = {
|
||||
{Py_mod_exec, reinterpret_cast<void*>(_testcppext_exec)},
|
||||
{0, _Py_NULL}
|
||||
};
|
||||
|
||||
_Py_COMP_DIAG_POP
|
||||
|
||||
PyDoc_STRVAR(_testcppext_doc, "C++ test extension.");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue