Use multi-phase initialization for unicode-names
This commit is contained in:
parent
8986d15a5b
commit
a0740d1616
@ -91,20 +91,24 @@ static PyMethodDef module_methods[] = {
|
|||||||
{NULL, NULL, 0, NULL} /* Sentinel */
|
{NULL, NULL, 0, NULL} /* Sentinel */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static int
|
||||||
|
exec_module(PyObject *m UNUSED) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
IGNORE_PEDANTIC_WARNINGS
|
||||||
|
static PyModuleDef_Slot slots[] = { {Py_mod_exec, (void*)exec_module}, {0, NULL} };
|
||||||
|
END_IGNORE_PEDANTIC_WARNINGS
|
||||||
|
|
||||||
static struct PyModuleDef module = {
|
static struct PyModuleDef module = {
|
||||||
.m_base = PyModuleDef_HEAD_INIT,
|
.m_base = PyModuleDef_HEAD_INIT,
|
||||||
.m_name = "unicode_names", /* name of module */
|
.m_name = "unicode_names", /* name of module */
|
||||||
.m_doc = NULL,
|
.m_doc = NULL,
|
||||||
.m_size = -1,
|
.m_slots = slots,
|
||||||
.m_methods = module_methods
|
.m_methods = module_methods
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
EXPORTED PyMODINIT_FUNC
|
EXPORTED PyMODINIT_FUNC
|
||||||
PyInit_unicode_names(void) {
|
PyInit_unicode_names(void) {
|
||||||
PyObject *m;
|
return PyModuleDef_Init(&module);
|
||||||
|
|
||||||
m = PyModule_Create(&module);
|
|
||||||
if (m == NULL) return NULL;
|
|
||||||
return m;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -113,17 +113,18 @@ typedef enum { TILING, SCALED, MIRRORED } BackgroundImageLayout;
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
#define START_ALLOW_CASE_RANGE _Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wpedantic\"")
|
#define IGNORE_PEDANTIC_WARNINGS _Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wpedantic\"")
|
||||||
#define END_ALLOW_CASE_RANGE _Pragma("clang diagnostic pop")
|
#define END_IGNORE_PEDANTIC_WARNINGS _Pragma("clang diagnostic pop")
|
||||||
#define ALLOW_UNUSED_RESULT _Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wunused-result\"")
|
#define ALLOW_UNUSED_RESULT _Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wunused-result\"")
|
||||||
#define END_ALLOW_UNUSED_RESULT _Pragma("clang diagnostic pop")
|
#define END_ALLOW_UNUSED_RESULT _Pragma("clang diagnostic pop")
|
||||||
#else
|
#else
|
||||||
#define START_ALLOW_CASE_RANGE _Pragma("GCC diagnostic ignored \"-Wpedantic\"")
|
#define IGNORE_PEDANTIC_WARNINGS _Pragma("GCC diagnostic ignored \"-Wpedantic\"")
|
||||||
#define END_ALLOW_CASE_RANGE _Pragma("GCC diagnostic pop")
|
#define END_IGNORE_PEDANTIC_WARNINGS _Pragma("GCC diagnostic pop")
|
||||||
#define ALLOW_UNUSED_RESULT _Pragma("GCC diagnostic ignored \"-Wunused-result\"")
|
#define ALLOW_UNUSED_RESULT _Pragma("GCC diagnostic ignored \"-Wunused-result\"")
|
||||||
#define END_ALLOW_UNUSED_RESULT _Pragma("GCC diagnostic pop")
|
#define END_ALLOW_UNUSED_RESULT _Pragma("GCC diagnostic pop")
|
||||||
#endif
|
#endif
|
||||||
|
#define START_ALLOW_CASE_RANGE IGNORE_PEDANTIC_WARNINGS
|
||||||
|
#define END_ALLOW_CASE_RANGE END_IGNORE_PEDANTIC_WARNINGS
|
||||||
|
|
||||||
typedef enum UTF8State { UTF8_ACCEPT = 0, UTF8_REJECT = 1} UTF8State;
|
typedef enum UTF8State { UTF8_ACCEPT = 0, UTF8_REJECT = 1} UTF8State;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user