2424#define IS_PY3K
2525#endif
2626
27+ #if defined(__GNUC__) && !defined(__clang__)
28+ #define IS_GCC
29+ #endif
30+ #if defined(__clang__)
31+ #define IS_CLANG
32+ #endif
33+
2734namespace {
2835
2936std::string segy_errstr ( int err ) {
@@ -1753,6 +1760,16 @@ PyObject* stanza_names( segyfd* self ) {
17531760 return names;
17541761}
17551762
1763+ #ifdef IS_CLANG
1764+ #pragma clang diagnostic push
1765+ #pragma clang diagnostic ignored "-Wcast-function-type"
1766+ #pragma clang diagnostic ignored "-Wmissing-field-initializers"
1767+ #endif
1768+ #ifdef IS_GCC
1769+ #pragma GCC diagnostic push
1770+ #pragma GCC diagnostic ignored "-Wcast-function-type"
1771+ #pragma GCC diagnostic ignored "-Wmissing-field-initializers"
1772+ #endif
17561773PyMethodDef methods [] = {
17571774 { " segyopen" , (PyCFunction) fd::segyopen,
17581775 METH_VARARGS | METH_KEYWORDS , " Open file." },
@@ -1797,9 +1814,23 @@ PyMethodDef methods [] = {
17971814
17981815 { NULL }
17991816};
1817+ #ifdef IS_GCC
1818+ #pragma GCC diagnostic pop
1819+ #endif
1820+ #ifdef IS_CLANG
1821+ #pragma clang diagnostic pop
1822+ #endif
18001823
18011824}
18021825
1826+ #ifdef IS_CLANG
1827+ #pragma clang diagnostic push
1828+ #pragma clang diagnostic ignored "-Wmissing-field-initializers"
1829+ #endif
1830+ #ifdef IS_GCC
1831+ #pragma GCC diagnostic push
1832+ #pragma GCC diagnostic ignored "-Wmissing-field-initializers"
1833+ #endif
18031834PyTypeObject Segyfd = {
18041835 PyVarObject_HEAD_INIT ( NULL , 0 )
18051836 " _segyio.segyfd" , /* name */
@@ -1838,6 +1869,12 @@ PyTypeObject Segyfd = {
18381869 0 , /* tp_dictoffset */
18391870 (initproc)fd::init, /* tp_init */
18401871};
1872+ #ifdef IS_GCC
1873+ #pragma GCC diagnostic pop
1874+ #endif
1875+ #ifdef IS_CLANG
1876+ #pragma clang diagnostic pop
1877+ #endif
18411878
18421879PyObject* binsize ( PyObject* ) {
18431880 return PyLong_FromLong ( segy_binheader_size () );
@@ -2166,6 +2203,16 @@ PyObject* format( PyObject* , PyObject* args ) {
21662203 return out;
21672204}
21682205
2206+ #ifdef IS_CLANG
2207+ #pragma clang diagnostic push
2208+ #pragma clang diagnostic ignored "-Wcast-function-type"
2209+ #pragma clang diagnostic ignored "-Wmissing-field-initializers"
2210+ #endif
2211+ #ifdef IS_GCC
2212+ #pragma GCC diagnostic push
2213+ #pragma GCC diagnostic ignored "-Wcast-function-type"
2214+ #pragma GCC diagnostic ignored "-Wmissing-field-initializers"
2215+ #endif
21692216PyMethodDef SegyMethods[] = {
21702217 { " binsize" , (PyCFunction) binsize, METH_NOARGS , " Size of the binary header." },
21712218 { " thsize" , (PyCFunction) thsize, METH_NOARGS , " Size of the trace header." },
@@ -2182,6 +2229,12 @@ PyMethodDef SegyMethods[] = {
21822229
21832230 { NULL }
21842231};
2232+ #ifdef IS_GCC
2233+ #pragma GCC diagnostic pop
2234+ #endif
2235+ #ifdef IS_CLANG
2236+ #pragma clang diagnostic pop
2237+ #endif
21852238
21862239namespace {
21872240
@@ -2709,13 +2762,27 @@ int extract_layout_stanza(
27092762
27102763/* module initialization */
27112764#ifdef IS_PY3K
2765+ #ifdef IS_CLANG
2766+ #pragma clang diagnostic push
2767+ #pragma clang diagnostic ignored "-Wmissing-field-initializers"
2768+ #endif
2769+ #ifdef IS_GCC
2770+ #pragma GCC diagnostic push
2771+ #pragma GCC diagnostic ignored "-Wmissing-field-initializers"
2772+ #endif
27122773static struct PyModuleDef segyio_module = {
27132774 PyModuleDef_HEAD_INIT,
27142775 " _segyio" , /* name of module */
27152776 NULL , /* module documentation, may be NULL */
27162777 -1 , /* size of per-interpreter state of the module, or -1 if the module keeps state in global variables. */
27172778 SegyMethods
27182779};
2780+ #ifdef IS_GCC
2781+ #pragma GCC diagnostic pop
2782+ #endif
2783+ #ifdef IS_CLANG
2784+ #pragma clang diagnostic pop
2785+ #endif
27192786
27202787PyMODINIT_FUNC
27212788PyInit__segyio (void ) {
0 commit comments