From 938ace69a0e112424a2f426a4881d1fd1fc922d2 Mon Sep 17 00:00:00 2001 From: Jeremy Hylton Date: Wed, 17 Jul 2002 16:30:39 +0000 Subject: staticforward bites the dust. The staticforward define was needed to support certain broken C compilers (notably SCO ODT 3.0, perhaps early AIX as well) botched the static keyword when it was used with a forward declaration of a static initialized structure. Standard C allows the forward declaration with static, and we've decided to stop catering to broken C compilers. (In fact, we expect that the compilers are all fixed eight years later.) I'm leaving staticforward and statichere defined in object.h as static. This is only for backwards compatibility with C extensions that might still use it. XXX I haven't updated the documentation. --- Include/object.h | 27 +++++---------- Mac/Lib/test/mkcwproj/mkcwtestmodule.c | 2 +- Mac/Modules/Nav.c | 2 +- Mac/Modules/calldll.c | 6 ++-- Mac/Modules/ctbmodule.c | 2 +- Mac/Modules/ctl/_Ctlmodule.c | 8 ++--- Mac/Modules/hfsplusmodule.c | 6 ++-- Mac/Modules/icgluemodule.c | 2 +- Mac/Modules/macfsmodule.c | 12 +++---- Mac/Modules/macosmodule.c | 2 +- Mac/Modules/macspeechmodule.c | 4 +-- Mac/Modules/mlte/_Mltemodule.c | 8 ++--- Mac/Modules/qd/_Qdmodule.c | 6 ++-- Mac/Modules/snd/_Sndmodule.c | 8 ++--- Mac/Modules/waste/wastemodule.c | 4 +-- Mac/Python/macgetpath.c | 2 +- Modules/_sre.c | 6 ++-- Modules/_ssl.c | 8 ++--- Modules/_tkinter.c | 6 ++-- Modules/almodule.c | 4 +-- Modules/arraymodule.c | 2 +- Modules/bsddbmodule.c | 2 +- Modules/cPickle.c | 4 +-- Modules/cmathmodule.c | 6 ++-- Modules/dbmmodule.c | 2 +- Modules/dlmodule.c | 2 +- Modules/flmodule.c | 4 +-- Modules/fmmodule.c | 2 +- Modules/gdbmmodule.c | 2 +- Modules/linuxaudiodev.c | 2 +- Modules/md5module.c | 2 +- Modules/mpzmodule.c | 2 +- Modules/parsermodule.c | 19 ++++------- Modules/pcremodule.c | 4 +-- Modules/pyexpat.c | 4 +-- Modules/rotormodule.c | 2 +- Modules/selectmodule.c | 2 +- Modules/shamodule.c | 2 +- Modules/socketmodule.c | 2 +- Modules/sunaudiodev.c | 4 +-- Modules/threadmodule.c | 2 +- Modules/xreadlinesmodule.c | 2 +- Modules/xxmodule.c | 2 +- Modules/xxsubtype.c | 4 +-- Modules/zlibmodule.c | 4 +-- Objects/dictobject.c | 2 +- Objects/floatobject.c | 2 +- Objects/intobject.c | 2 +- Objects/listobject.c | 2 +- Objects/longobject.c | 3 +- Objects/rangeobject.c | 4 +-- Objects/stringobject.c | 2 +- Objects/tupleobject.c | 2 +- Objects/typeobject.c | 22 ++++++------ Objects/unicodeobject.c | 2 +- Objects/xxobject.c | 2 +- Python/ceval.c | 2 +- Tools/bgen/bgen/bgenObjectDefinition.py | 4 +-- Tools/modulator/Templates/object_head | 2 +- configure | 60 +-------------------------------- configure.in | 25 -------------- 61 files changed, 126 insertions(+), 222 deletions(-) diff --git a/Include/object.h b/Include/object.h index 736095a..3397662 100644 --- a/Include/object.h +++ b/Include/object.h @@ -616,28 +616,19 @@ extern DL_IMPORT(PyObject) _Py_NotImplementedStruct; /* Don't use this directly #define Py_GE 5 /* -A common programming style in Python requires the forward declaration -of static, initialized structures, e.g. for a type object that is used -by the functions whose address must be used in the initializer. -Some compilers (notably SCO ODT 3.0, I seem to remember early AIX as -well) botch this if you use the static keyword for both declarations -(they allocate two objects, and use the first, uninitialized one until -the second declaration is encountered). Therefore, the forward -declaration should use the 'forwardstatic' keyword. This expands to -static on most systems, but to extern on a few. The actual storage -and name will still be static because the second declaration is -static, so no linker visible symbols will be generated. (Standard C -compilers take offense to the extern forward declaration of a static -object, so I can't just put extern in all cases. :-( ) +Define staticforward and statichere for source compatibility with old +C extensions. + +The staticforward define was needed to support certain broken C +compilers (notably SCO ODT 3.0, perhaps early AIX as well) botched the +static keyword when it was used with a forward declaration of a static +initialized structure. Standard C allows the forward declaration with +static, and we've decided to stop catering to broken C compilers. +(In fact, we expect that the compilers are all fixed eight years later.) */ -#ifdef BAD_STATIC_FORWARD -#define staticforward extern -#define statichere static -#else /* !BAD_STATIC_FORWARD */ #define staticforward static #define statichere static -#endif /* !BAD_STATIC_FORWARD */ /* diff --git a/Mac/Lib/test/mkcwproj/mkcwtestmodule.c b/Mac/Lib/test/mkcwproj/mkcwtestmodule.c index ad8099b..84d0e2d 100644 --- a/Mac/Lib/test/mkcwproj/mkcwtestmodule.c +++ b/Mac/Lib/test/mkcwproj/mkcwtestmodule.c @@ -23,7 +23,7 @@ typedef struct { PyObject *x_attr; /* Attributes dictionary */ } XxoObject; -staticforward PyTypeObject Xxo_Type; +static PyTypeObject Xxo_Type; #define XxoObject_Check(v) ((v)->ob_type == &Xxo_Type) diff --git a/Mac/Modules/Nav.c b/Mac/Modules/Nav.c index fb0c21b..7dfe3e5 100644 --- a/Mac/Modules/Nav.c +++ b/Mac/Modules/Nav.c @@ -233,7 +233,7 @@ typedef struct { NavReplyRecord itself; } navrrobject; -staticforward PyTypeObject Navrrtype; +static PyTypeObject Navrrtype; diff --git a/Mac/Modules/calldll.c b/Mac/Modules/calldll.c index e2c2e3e..f390a9d 100644 --- a/Mac/Modules/calldll.c +++ b/Mac/Modules/calldll.c @@ -471,7 +471,7 @@ typedef struct { char name[MAXNAME+1]; } cdfobject; -staticforward PyTypeObject Cdftype; +static PyTypeObject Cdftype; @@ -485,7 +485,7 @@ typedef struct { char name[MAXNAME+1]; } cdrobject; -staticforward PyTypeObject Cdrtype; +static PyTypeObject Cdrtype; @@ -503,7 +503,7 @@ typedef struct { conventry *argconv[MAXARG]; /* Value converter list */ } cdcobject; -staticforward PyTypeObject Cdctype; +static PyTypeObject Cdctype; diff --git a/Mac/Modules/ctbmodule.c b/Mac/Modules/ctbmodule.c index 3dc8f0f..f8bc25e 100644 --- a/Mac/Modules/ctbmodule.c +++ b/Mac/Modules/ctbmodule.c @@ -80,7 +80,7 @@ typedef struct { int err; /* Error to pass to the callback */ } ctbcmobject; -staticforward PyTypeObject ctbcmtype; +static PyTypeObject ctbcmtype; #define is_ctbcmobject(v) ((v)->ob_type == &ctbcmtype) diff --git a/Mac/Modules/ctl/_Ctlmodule.c b/Mac/Modules/ctl/_Ctlmodule.c index c9a8aa4..cde42b7 100644 --- a/Mac/Modules/ctl/_Ctlmodule.c +++ b/Mac/Modules/ctl/_Ctlmodule.c @@ -35,7 +35,7 @@ extern int _CtlObj_Convert(PyObject *, ControlHandle *); #define CtlObj_Convert _CtlObj_Convert #endif -staticforward PyObject *CtlObj_WhichControl(ControlHandle); +static PyObject *CtlObj_WhichControl(ControlHandle); #define as_Control(h) ((ControlHandle)h) #define as_Resource(ctl) ((Handle)ctl) @@ -139,9 +139,9 @@ static ControlUserPaneIdleUPP myidleproc_upp; static ControlUserPaneHitTestUPP myhittestproc_upp; static ControlUserPaneTrackingUPP mytrackingproc_upp; -staticforward int settrackfunc(PyObject *); /* forward */ -staticforward void clrtrackfunc(void); /* forward */ -staticforward int setcallback(PyObject *, OSType, PyObject *, UniversalProcPtr *); +static int settrackfunc(PyObject *); /* forward */ +static void clrtrackfunc(void); /* forward */ +static int setcallback(PyObject *, OSType, PyObject *, UniversalProcPtr *); static PyObject *Ctl_Error; diff --git a/Mac/Modules/hfsplusmodule.c b/Mac/Modules/hfsplusmodule.c index 4135cd0..1c69031 100644 --- a/Mac/Modules/hfsplusmodule.c +++ b/Mac/Modules/hfsplusmodule.c @@ -43,7 +43,7 @@ typedef struct { short forkref; } forkRefObject; -staticforward PyTypeObject forkRefObject_Type; +static PyTypeObject forkRefObject_Type; #define forkRefObject_Check(v) ((v)->ob_type == &forkRefObject_Type) @@ -359,7 +359,7 @@ typedef struct { FSIterator iterator; } iteratorObject; -staticforward PyTypeObject iteratorObject_Type; +static PyTypeObject iteratorObject_Type; #define iteratorObject_Check(v) ((v)->ob_type == &iteratorObject_Type) @@ -534,7 +534,7 @@ typedef struct { Boolean directory; } fsRefObject; -staticforward PyTypeObject fsRefObject_Type; +static PyTypeObject fsRefObject_Type; #define fsRefObject_Check(v) ((v)->ob_type == &fsRefObject_Type) diff --git a/Mac/Modules/icgluemodule.c b/Mac/Modules/icgluemodule.c index 1368ff2..c974a0c 100644 --- a/Mac/Modules/icgluemodule.c +++ b/Mac/Modules/icgluemodule.c @@ -61,7 +61,7 @@ typedef struct { ICInstance inst; } iciobject; -staticforward PyTypeObject Icitype; +static PyTypeObject Icitype; diff --git a/Mac/Modules/macfsmodule.c b/Mac/Modules/macfsmodule.c index a251811..488dd7e 100644 --- a/Mac/Modules/macfsmodule.c +++ b/Mac/Modules/macfsmodule.c @@ -70,7 +70,7 @@ typedef struct { AliasHandle alias; } mfsaobject; -staticforward PyTypeObject Mfsatype; +static PyTypeObject Mfsatype; #define is_mfsaobject(v) ((v)->ob_type == &Mfsatype) @@ -82,7 +82,7 @@ typedef struct { FSSpec fsspec; } mfssobject; -staticforward PyTypeObject Mfsstype; +static PyTypeObject Mfsstype; #define is_mfssobject(v) ((v)->ob_type == &Mfsstype) @@ -94,7 +94,7 @@ typedef struct { FSRef fsref; } mfsrobject; -staticforward PyTypeObject Mfsrtype; +static PyTypeObject Mfsrtype; #define is_mfsrobject(v) ((v)->ob_type == &Mfsrtype) @@ -107,13 +107,13 @@ typedef struct { FInfo finfo; } mfsiobject; -staticforward PyTypeObject Mfsitype; +static PyTypeObject Mfsitype; #define is_mfsiobject(v) ((v)->ob_type == &Mfsitype) -staticforward mfssobject *newmfssobject(FSSpec *fss); /* Forward */ -staticforward mfsrobject *newmfsrobject(FSRef *fsr); /* Forward */ +static mfssobject *newmfssobject(FSSpec *fss); /* Forward */ +static mfsrobject *newmfsrobject(FSRef *fsr); /* Forward */ /* ---------------------------------------------------------------- */ diff --git a/Mac/Modules/macosmodule.c b/Mac/Modules/macosmodule.c index 671d67d..dc9a94f 100644 --- a/Mac/Modules/macosmodule.c +++ b/Mac/Modules/macosmodule.c @@ -60,7 +60,7 @@ typedef struct { int isclosed; } rfobject; -staticforward PyTypeObject Rftype; +static PyTypeObject Rftype; diff --git a/Mac/Modules/macspeechmodule.c b/Mac/Modules/macspeechmodule.c index b8bed57..a8388e9 100644 --- a/Mac/Modules/macspeechmodule.c +++ b/Mac/Modules/macspeechmodule.c @@ -88,7 +88,7 @@ typedef struct { PyObject *curtext; /* If non-NULL current text being spoken */ } scobject; -staticforward PyTypeObject sctype; +static PyTypeObject sctype; #define is_scobject(v) ((v)->ob_type == &sctype) @@ -285,7 +285,7 @@ typedef struct { VoiceDescription vd; } mvobject; -staticforward PyTypeObject mvtype; +static PyTypeObject mvtype; #define is_mvobject(v) ((v)->ob_type == &mvtype) diff --git a/Mac/Modules/mlte/_Mltemodule.c b/Mac/Modules/mlte/_Mltemodule.c index ec512aa..12ef25a 100644 --- a/Mac/Modules/mlte/_Mltemodule.c +++ b/Mac/Modules/mlte/_Mltemodule.c @@ -27,10 +27,10 @@ #endif /* For now we declare them forward here. They'll go to mactoolbox later */ -staticforward PyObject *TXNObj_New(TXNObject); -staticforward int TXNObj_Convert(PyObject *, TXNObject *); -staticforward PyObject *TXNFontMenuObj_New(TXNFontMenuObject); -staticforward int TXNFontMenuObj_Convert(PyObject *, TXNFontMenuObject *); +static PyObject *TXNObj_New(TXNObject); +static int TXNObj_Convert(PyObject *, TXNObject *); +static PyObject *TXNFontMenuObj_New(TXNFontMenuObject); +static int TXNFontMenuObj_Convert(PyObject *, TXNFontMenuObject *); // ADD declarations #ifdef NOTYET_USE_TOOLBOX_OBJECT_GLUE diff --git a/Mac/Modules/qd/_Qdmodule.c b/Mac/Modules/qd/_Qdmodule.c index b174e02..f7956b8 100644 --- a/Mac/Modules/qd/_Qdmodule.c +++ b/Mac/Modules/qd/_Qdmodule.c @@ -111,7 +111,7 @@ extern int _QdRGB_Convert(PyObject *, RGBColorPtr); #define QDIsPortBuffered(port) 0 #endif /* !TARGET_API_MAC_CARBON */ -staticforward PyObject *BMObj_NewCopied(BitMapPtr); +static PyObject *BMObj_NewCopied(BitMapPtr); /* ** Parse/generate RGB records @@ -527,7 +527,7 @@ PyTypeObject BitMap_Type = { /* ------------------ Object type QDGlobalsAccess ------------------- */ -staticforward PyTypeObject QDGlobalsAccess_Type; +static PyTypeObject QDGlobalsAccess_Type; #define QDGA_Check(x) ((x)->ob_type == &QDGlobalsAccess_Type) @@ -631,7 +631,7 @@ static PyObject *QDGA_getattr(QDGlobalsAccessObject *self, char *name) #define QDGA_hash NULL -staticforward PyTypeObject QDGlobalsAccess_Type = { +static PyTypeObject QDGlobalsAccess_Type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ "_Qd.QDGlobalsAccess", /*tp_name*/ diff --git a/Mac/Modules/snd/_Sndmodule.c b/Mac/Modules/snd/_Sndmodule.c index 1308bba..7a8f9fd 100644 --- a/Mac/Modules/snd/_Sndmodule.c +++ b/Mac/Modules/snd/_Sndmodule.c @@ -62,7 +62,7 @@ static PyObject *Snd_Error; /* --------------------- Object type SndChannel --------------------- */ -staticforward PyTypeObject SndChannel_Type; +static PyTypeObject SndChannel_Type; #define SndCh_Check(x) ((x)->ob_type == &SndChannel_Type) @@ -315,7 +315,7 @@ static PyObject *SndCh_getattr(SndChannelObject *self, char *name) #define SndCh_hash NULL -staticforward PyTypeObject SndChannel_Type = { +static PyTypeObject SndChannel_Type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ "_Snd.SndChannel", /*tp_name*/ @@ -339,7 +339,7 @@ staticforward PyTypeObject SndChannel_Type = { /* ------------------------ Object type SPB ------------------------- */ -staticforward PyTypeObject SPB_Type; +static PyTypeObject SPB_Type; #define SPBObj_Check(x) ((x)->ob_type == &SPB_Type) @@ -443,7 +443,7 @@ static int SPBObj_setattr(SPBObject *self, char *name, PyObject *value) #define SPBObj_hash NULL -staticforward PyTypeObject SPB_Type = { +static PyTypeObject SPB_Type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ "_Snd.SPB", /*tp_name*/ diff --git a/Mac/Modules/waste/wastemodule.c b/Mac/Modules/waste/wastemodule.c index 0fd90d3..a1eab0b 100644 --- a/Mac/Modules/waste/wastemodule.c +++ b/Mac/Modules/waste/wastemodule.c @@ -33,8 +33,8 @@ extern PyObject *AEDesc_New(AppleEvent *); extern int AEDesc_Convert(PyObject *, AppleEvent *); /* Forward declaration */ -staticforward PyObject *WEOObj_New(WEObjectReference); -staticforward PyObject *ExistingwasteObj_New(WEReference); +static PyObject *WEOObj_New(WEObjectReference); +static PyObject *ExistingwasteObj_New(WEReference); /* ** Parse/generate TextStyle records diff --git a/Mac/Python/macgetpath.c b/Mac/Python/macgetpath.c index dfb689e..b79d555 100644 --- a/Mac/Python/macgetpath.c +++ b/Mac/Python/macgetpath.c @@ -64,7 +64,7 @@ PERFORMANCE OF THIS SOFTWARE. #include #ifndef USE_BUILTIN_PATH -staticforward char *PyMac_GetPythonPath(); +static char *PyMac_GetPythonPath(); #endif #define PYTHONPATH "\ diff --git a/Modules/_sre.c b/Modules/_sre.c index 839763d..fdc8207 100644 --- a/Modules/_sre.c +++ b/Modules/_sre.c @@ -1293,9 +1293,9 @@ SRE_LITERAL_TEMPLATE(SRE_CHAR* ptr, int len) /* see sre.h for object declarations */ -staticforward PyTypeObject Pattern_Type; -staticforward PyTypeObject Match_Type; -staticforward PyTypeObject Scanner_Type; +static PyTypeObject Pattern_Type; +static PyTypeObject Match_Type; +static PyTypeObject Scanner_Type; static PyObject * _compile(PyObject* self_, PyObject* args) diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 1317791..5f5e530 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -61,9 +61,9 @@ typedef struct { } PySSLObject; -staticforward PyTypeObject PySSL_Type; -staticforward PyObject *PySSL_SSLwrite(PySSLObject *self, PyObject *args); -staticforward PyObject *PySSL_SSLread(PySSLObject *self, PyObject *args); +static PyTypeObject PySSL_Type; +static PyObject *PySSL_SSLwrite(PySSLObject *self, PyObject *args); +static PyObject *PySSL_SSLread(PySSLObject *self, PyObject *args); #define PySSLObject_Check(v) ((v)->ob_type == &PySSL_Type) @@ -354,7 +354,7 @@ static PyObject *PySSL_getattr(PySSLObject *self, char *name) return Py_FindMethod(PySSLMethods, (PyObject *)self, name); } -staticforward PyTypeObject PySSL_Type = { +static PyTypeObject PySSL_Type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ "socket.SSL", /*tp_name*/ diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c index 788177f..6c75a5d 100644 --- a/Modules/_tkinter.c +++ b/Modules/_tkinter.c @@ -186,7 +186,7 @@ typedef int (*TclMacConvertEventPtr) (EventRecord *eventPtr); void Tcl_MacSetEventProc(TclMacConvertEventPtr procPtr); int TkMacConvertEvent(EventRecord *eventPtr); -staticforward int PyMacConvertEvent(EventRecord *eventPtr); +static int PyMacConvertEvent(EventRecord *eventPtr); #include extern int SIOUXIsAppWindow(WindowPtr); @@ -199,7 +199,7 @@ extern int SIOUXIsAppWindow(WindowPtr); /**** Tkapp Object Declaration ****/ -staticforward PyTypeObject Tkapp_Type; +static PyTypeObject Tkapp_Type; typedef struct { PyObject_HEAD @@ -1515,7 +1515,7 @@ Tkapp_DeleteFileHandler(PyObject *self, PyObject *args) /**** Tktt Object (timer token) ****/ -staticforward PyTypeObject Tktt_Type; +static PyTypeObject Tktt_Type; typedef struct { PyObject_HEAD diff --git a/Modules/almodule.c b/Modules/almodule.c index 05c4bef..8954528 100644 --- a/Modules/almodule.c +++ b/Modules/almodule.c @@ -24,7 +24,7 @@ typedef struct { ALport port; } alpobject; -staticforward PyTypeObject Alptype; +static PyTypeObject Alptype; @@ -38,7 +38,7 @@ typedef struct { ALconfig config; } alcobject; -staticforward PyTypeObject Alctype; +static PyTypeObject Alctype; static void diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c index c0e59bc..87c51cc 100644 --- a/Modules/arraymodule.c +++ b/Modules/arraymodule.c @@ -35,7 +35,7 @@ typedef struct arrayobject { struct arraydescr *ob_descr; } arrayobject; -staticforward PyTypeObject Arraytype; +static PyTypeObject Arraytype; #define array_Check(op) PyObject_TypeCheck(op, &Arraytype) #define array_CheckExact(op) ((op)->ob_type == &Arraytype) diff --git a/Modules/bsddbmodule.c b/Modules/bsddbmodule.c index 74f9133..afb2390 100644 --- a/Modules/bsddbmodule.c +++ b/Modules/bsddbmodule.c @@ -39,7 +39,7 @@ typedef struct { #endif } bsddbobject; -staticforward PyTypeObject Bsddbtype; +static PyTypeObject Bsddbtype; #define is_bsddbobject(v) ((v)->ob_type == &Bsddbtype) #define check_bsddbobject_open(v, r) if ((v)->di_bsddb == NULL) \ diff --git a/Modules/cPickle.c b/Modules/cPickle.c index ce32683..af42484 100644 --- a/Modules/cPickle.c +++ b/Modules/cPickle.c @@ -288,7 +288,7 @@ typedef struct Picklerobject { #define PY_CPICKLE_FAST_LIMIT 50 #endif -staticforward PyTypeObject Picklertype; +static PyTypeObject Picklertype; typedef struct Unpicklerobject { PyObject_HEAD @@ -313,7 +313,7 @@ typedef struct Unpicklerobject { PyObject *find_class; } Unpicklerobject; -staticforward PyTypeObject Unpicklertype; +static PyTypeObject Unpicklertype; /* Forward decls that need the above structs */ static int save(Picklerobject *, PyObject *, int); diff --git a/Modules/cmathmodule.c b/Modules/cmathmodule.c index 0437368..5bb08f2 100644 --- a/Modules/cmathmodule.c +++ b/Modules/cmathmodule.c @@ -17,9 +17,9 @@ static Py_complex c_i = {0., 1.}; static Py_complex c_halfi = {0., 0.5}; /* forward declarations */ -staticforward Py_complex c_log(Py_complex); -staticforward Py_complex c_prodi(Py_complex); -staticforward Py_complex c_sqrt(Py_complex); +static Py_complex c_log(Py_complex); +static Py_complex c_prodi(Py_complex); +static Py_complex c_sqrt(Py_complex); static Py_complex diff --git a/Modules/dbmmodule.c b/Modules/dbmmodule.c index bbc70a8..dde5b49 100644 --- a/Modules/dbmmodule.c +++ b/Modules/dbmmodule.c @@ -31,7 +31,7 @@ typedef struct { DBM *di_dbm; } dbmobject; -staticforward PyTypeObject Dbmtype; +static PyTypeObject Dbmtype; #define is_dbmobject(v) ((v)->ob_type == &Dbmtype) #define check_dbmobject_open(v) if ((v)->di_dbm == NULL) \ diff --git a/Modules/dlmodule.c b/Modules/dlmodule.c index 4606ea8..ea083e2 100644 --- a/Modules/dlmodule.c +++ b/Modules/dlmodule.c @@ -15,7 +15,7 @@ typedef struct { PyUnivPtr *dl_handle; } dlobject; -staticforward PyTypeObject Dltype; +static PyTypeObject Dltype; static PyObject *Dlerror; diff --git a/Modules/flmodule.c b/Modules/flmodule.c index 483ce6e..b3e7d1f 100644 --- a/Modules/flmodule.c +++ b/Modules/flmodule.c @@ -29,7 +29,7 @@ typedef struct { PyObject *ob_callback_arg; } genericobject; -staticforward PyTypeObject GenericObjecttype; +static PyTypeObject GenericObjecttype; #define is_genericobject(g) ((g)->ob_type == &GenericObjecttype) @@ -1189,7 +1189,7 @@ typedef struct { FL_FORM *ob_form; } formobject; -staticforward PyTypeObject Formtype; +static PyTypeObject Formtype; #define is_formobject(v) ((v)->ob_type == &Formtype) diff --git a/Modules/fmmodule.c b/Modules/fmmodule.c index d6d753a..78a5877 100644 --- a/Modules/fmmodule.c +++ b/Modules/fmmodule.c @@ -15,7 +15,7 @@ typedef struct { fmfonthandle fh_fh; } fhobject; -staticforward PyTypeObject Fhtype; +static PyTypeObject Fhtype; #define is_fhobject(v) ((v)->ob_type == &Fhtype) diff --git a/Modules/gdbmmodule.c b/Modules/gdbmmodule.c index 1da53ff..6e85ed3 100644 --- a/Modules/gdbmmodule.c +++ b/Modules/gdbmmodule.c @@ -34,7 +34,7 @@ typedef struct { GDBM_FILE di_dbm; } dbmobject; -staticforward PyTypeObject Dbmtype; +static PyTypeObject Dbmtype; #define is_dbmobject(v) ((v)->ob_type == &Dbmtype) #define check_dbmobject_open(v) if ((v)->di_dbm == NULL) \ diff --git a/Modules/linuxaudiodev.c b/Modules/linuxaudiodev.c index 7d4abc9..74cfdee 100644 --- a/Modules/linuxaudiodev.c +++ b/Modules/linuxaudiodev.c @@ -70,7 +70,7 @@ static struct { static int n_audio_types = sizeof(audio_types) / sizeof(audio_types[0]); -staticforward PyTypeObject Ladtype; +static PyTypeObject Ladtype; static PyObject *LinuxAudioError; diff --git a/Modules/md5module.c b/Modules/md5module.c index 045f27f..b7f2c69 100644 --- a/Modules/md5module.c +++ b/Modules/md5module.c @@ -17,7 +17,7 @@ typedef struct { MD5_CTX md5; /* the context holder */ } md5object; -staticforward PyTypeObject MD5type; +static PyTypeObject MD5type; #define is_md5object(v) ((v)->ob_type == &MD5type) diff --git a/Modules/mpzmodule.c b/Modules/mpzmodule.c index 0cdc84d..0cb6495 100644 --- a/Modules/mpzmodule.c +++ b/Modules/mpzmodule.c @@ -75,7 +75,7 @@ typedef struct { MP_INT mpz; /* the actual number */ } mpzobject; -staticforward PyTypeObject MPZtype; +static PyTypeObject MPZtype; #define is_mpzobject(v) ((v)->ob_type == &MPZtype) diff --git a/Modules/parsermodule.c b/Modules/parsermodule.c index 854d986..e790352 100644 --- a/Modules/parsermodule.c +++ b/Modules/parsermodule.c @@ -157,14 +157,9 @@ typedef struct { } PyST_Object; -staticforward void -parser_free(PyST_Object *st); - -staticforward int -parser_compare(PyST_Object *left, PyST_Object *right); - -staticforward PyObject * -parser_getattr(PyObject *self, char *name); +static void parser_free(PyST_Object *st); +static int parser_compare(PyST_Object *left, PyST_Object *right); +static PyObject *parser_getattr(PyObject *self, char *name); static @@ -550,9 +545,9 @@ parser_suite(PyST_Object *self, PyObject *args, PyObject *kw) */ -staticforward node* build_node_tree(PyObject *tuple); -staticforward int validate_expr_tree(node *tree); -staticforward int validate_file_input(node *tree); +static node* build_node_tree(PyObject *tuple); +static int validate_expr_tree(node *tree); +static int validate_file_input(node *tree); /* PyObject* parser_tuple2st(PyObject* self, PyObject* args) @@ -793,7 +788,7 @@ build_node_tree(PyObject *tuple) /* * Validation routines used within the validation section: */ -staticforward int validate_terminal(node *terminal, int type, char *string); +static int validate_terminal(node *terminal, int type, char *string); #define validate_ampersand(ch) validate_terminal(ch, AMPER, "&") #define validate_circumflex(ch) validate_terminal(ch, CIRCUMFLEX, "^") diff --git a/Modules/pcremodule.c b/Modules/pcremodule.c index 6c05766..383dde8 100644 --- a/Modules/pcremodule.c +++ b/Modules/pcremodule.c @@ -24,7 +24,7 @@ typedef struct { int num_groups; } PcreObject; -staticforward PyTypeObject Pcre_Type; +static PyTypeObject Pcre_Type; #define PcreObject_Check(v) ((v)->ob_type == &Pcre_Type) #define NORMAL 0 @@ -125,7 +125,7 @@ PyPcre_getattr(PcreObject *self, char *name) } -staticforward PyTypeObject Pcre_Type = { +static PyTypeObject Pcre_Type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ "pcre.Pcre", /*tp_name*/ diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c index 396986a..2d14675 100644 --- a/Modules/pyexpat.c +++ b/Modules/pyexpat.c @@ -66,7 +66,7 @@ typedef struct { #define CHARACTER_DATA_BUFFER_SIZE 8192 -staticforward PyTypeObject Xmlparsetype; +static PyTypeObject Xmlparsetype; typedef void (*xmlhandlersetter)(XML_Parser *self, void *meth); typedef void* xmlhandler; @@ -79,7 +79,7 @@ struct HandlerInfo { PyObject *nameobj; }; -staticforward struct HandlerInfo handler_info[64]; +static struct HandlerInfo handler_info[64]; /* Set an integer attribute on the error object; return true on success, * false on an exception. diff --git a/Modules/rotormodule.c b/Modules/rotormodule.c index 0377832..75f1aeb 100644 --- a/Modules/rotormodule.c +++ b/Modules/rotormodule.c @@ -78,7 +78,7 @@ typedef struct { unsigned char *advances; /* [num_rotors] */ } Rotorobj; -staticforward PyTypeObject Rotor_Type; +static PyTypeObject Rotor_Type; #define is_rotor(v) ((v)->ob_type == &Rotor_Type) diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c index 73abd4f..5d9ab35 100644 --- a/Modules/selectmodule.c +++ b/Modules/selectmodule.c @@ -322,7 +322,7 @@ typedef struct { struct pollfd *ufds; } pollObject; -staticforward PyTypeObject poll_Type; +static PyTypeObject poll_Type; /* Update the malloc'ed array of pollfds to match the dictionary contained within a pollObject. Return 1 on success, 0 on an error. diff --git a/Modules/shamodule.c b/Modules/shamodule.c index 94b1eff..14e51ea 100644 --- a/Modules/shamodule.c +++ b/Modules/shamodule.c @@ -330,7 +330,7 @@ sha_final(unsigned char digest[20], SHAobject *sha_info) * ------------------------------------------------------------------------ */ -staticforward PyTypeObject SHAtype; +static PyTypeObject SHAtype; static SHAobject * diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 3b194b3..5314dcf 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -276,7 +276,7 @@ static int taskwindow; The sock_type variable contains pointers to various functions, some of which call new_sockobject(), which uses sock_type, so there has to be a circular reference. */ -staticforward PyTypeObject sock_type; +static PyTypeObject sock_type; /* Convenience function to raise an error according to errno and return a NULL pointer from a function. */ diff --git a/Modules/sunaudiodev.c b/Modules/sunaudiodev.c index 506ee33..3269c76 100644 --- a/Modules/sunaudiodev.c +++ b/Modules/sunaudiodev.c @@ -36,8 +36,8 @@ typedef struct { audio_info_t ai; } sadstatusobject; -staticforward PyTypeObject Sadtype; -staticforward PyTypeObject Sadstatustype; +static PyTypeObject Sadtype; +static PyTypeObject Sadstatustype; static sadstatusobject *sads_alloc(void); /* Forward */ static PyObject *SunAudioError; diff --git a/Modules/threadmodule.c b/Modules/threadmodule.c index aa9d3c9..b872dd0 100644 --- a/Modules/threadmodule.c +++ b/Modules/threadmodule.c @@ -22,7 +22,7 @@ typedef struct { PyThread_type_lock lock_lock; } lockobject; -staticforward PyTypeObject Locktype; +static PyTypeObject Locktype; static lockobject * newlockobject(void) diff --git a/Modules/xreadlinesmodule.c b/Modules/xreadlinesmodule.c index 7fba5db..8c6b91f 100644 --- a/Modules/xreadlinesmodule.c +++ b/Modules/xreadlinesmodule.c @@ -14,7 +14,7 @@ typedef struct { int abslineno; } PyXReadlinesObject; -staticforward PyTypeObject XReadlinesObject_Type; +static PyTypeObject XReadlinesObject_Type; static void xreadlines_dealloc(PyXReadlinesObject *op) diff --git a/Modules/xxmodule.c b/Modules/xxmodule.c index b170651..07f5d64 100644 --- a/Modules/xxmodule.c +++ b/Modules/xxmodule.c @@ -23,7 +23,7 @@ typedef struct { PyObject *x_attr; /* Attributes dictionary */ } XxoObject; -staticforward PyTypeObject Xxo_Type; +static PyTypeObject Xxo_Type; #define XxoObject_Check(v) ((v)->ob_type == &Xxo_Type) diff --git a/Modules/xxsubtype.c b/Modules/xxsubtype.c index 353f773..9013467 100644 --- a/Modules/xxsubtype.c +++ b/Modules/xxsubtype.c @@ -79,7 +79,7 @@ static PyMethodDef spamlist_methods[] = { {NULL, NULL}, }; -staticforward PyTypeObject spamlist_type; +static PyTypeObject spamlist_type; static int spamlist_init(spamlistobject *self, PyObject *args, PyObject *kwds) @@ -179,7 +179,7 @@ static PyMethodDef spamdict_methods[] = { {NULL, NULL}, }; -staticforward PyTypeObject spamdict_type; +static PyTypeObject spamdict_type; static int spamdict_init(spamdictobject *self, PyObject *args, PyObject *kwds) diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c index 3e979a3..2ee4996 100644 --- a/Modules/zlibmodule.c +++ b/Modules/zlibmodule.c @@ -55,8 +55,8 @@ static PyThread_type_lock zlib_lock = NULL; /* initialized on module load */ #define DEFAULTALLOC (16*1024) #define PyInit_zlib initzlib -staticforward PyTypeObject Comptype; -staticforward PyTypeObject Decomptype; +static PyTypeObject Comptype; +static PyTypeObject Decomptype; static PyObject *ZlibError; diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 2619160..86c74ba 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -1611,7 +1611,7 @@ dict_tp_clear(PyObject *op) } -staticforward PyObject *dictiter_new(dictobject *, binaryfunc); +static PyObject *dictiter_new(dictobject *, binaryfunc); static PyObject * select_key(PyObject *key, PyObject *value) diff --git a/Objects/floatobject.c b/Objects/floatobject.c index d711726..2787a0a 100644 --- a/Objects/floatobject.c +++ b/Objects/floatobject.c @@ -678,7 +678,7 @@ float_float(PyObject *v) } -staticforward PyObject * +static PyObject * float_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds); static PyObject * diff --git a/Objects/intobject.c b/Objects/intobject.c index 444ada3..0202980 100644 --- a/Objects/intobject.c +++ b/Objects/intobject.c @@ -775,7 +775,7 @@ int_hex(PyIntObject *v) return PyString_FromString(buf); } -staticforward PyObject * +static PyObject * int_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds); static PyObject * diff --git a/Objects/listobject.c b/Objects/listobject.c index d0d1127..8173025 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -1282,7 +1282,7 @@ samplesortslice(PyObject **lo, PyObject **hi, PyObject *compare) #undef SETK -staticforward PyTypeObject immutable_list_type; +static PyTypeObject immutable_list_type; static PyObject * listsort(PyListObject *self, PyObject *args) diff --git a/Objects/longobject.c b/Objects/longobject.c index 7f94a62..b1271f4 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -2199,7 +2199,8 @@ long_hex(PyObject *v) { return long_format(v, 16, 1); } -staticforward PyObject * + +static PyObject * long_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds); static PyObject * diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c index 7c0e609..3080252 100644 --- a/Objects/rangeobject.c +++ b/Objects/rangeobject.c @@ -163,7 +163,7 @@ static PySequenceMethods range_as_sequence = { 0, /* sq_slice */ }; -staticforward PyObject * range_iter(PyObject *seq); +static PyObject * range_iter(PyObject *seq); PyTypeObject PyRange_Type = { PyObject_HEAD_INIT(&PyType_Type) @@ -217,7 +217,7 @@ typedef struct { long len; } rangeiterobject; -staticforward PyTypeObject Pyrangeiter_Type; +static PyTypeObject Pyrangeiter_Type; static PyObject * range_iter(PyObject *seq) diff --git a/Objects/stringobject.c b/Objects/stringobject.c index 0543f80..5e40524 100644 --- a/Objects/stringobject.c +++ b/Objects/stringobject.c @@ -2864,7 +2864,7 @@ string_methods[] = { {NULL, NULL} /* sentinel */ }; -staticforward PyObject * +static PyObject * str_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds); static PyObject * diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c index 1a15bb7..add9cac 100644 --- a/Objects/tupleobject.c +++ b/Objects/tupleobject.c @@ -479,7 +479,7 @@ tuplerichcompare(PyObject *v, PyObject *w, int op) return PyObject_RichCompare(vt->ob_item[i], wt->ob_item[i], op); } -staticforward PyObject * +static PyObject * tuple_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds); static PyObject * diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 31a7c3d..9662d95 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -356,7 +356,7 @@ subtype_clear(PyObject *self) return 0; } -staticforward PyObject *lookup_maybe(PyObject *, char *, PyObject **); +static PyObject *lookup_maybe(PyObject *, char *, PyObject **); static int call_finalizer(PyObject *self) @@ -469,7 +469,7 @@ subtype_dealloc(PyObject *self) } } -staticforward PyTypeObject *solid_base(PyTypeObject *type); +static PyTypeObject *solid_base(PyTypeObject *type); /* type test with subclassing support */ @@ -894,10 +894,10 @@ solid_base(PyTypeObject *type) return base; } -staticforward void object_dealloc(PyObject *); -staticforward int object_init(PyObject *, PyObject *, PyObject *); -staticforward int update_slot(PyTypeObject *, PyObject *); -staticforward void fixup_slot_dispatchers(PyTypeObject *); +static void object_dealloc(PyObject *); +static int object_init(PyObject *, PyObject *, PyObject *); +static int update_slot(PyTypeObject *, PyObject *); +static void fixup_slot_dispatchers(PyTypeObject *); static PyObject * subtype_dict(PyObject *obj, void *context) @@ -2187,8 +2187,8 @@ inherit_slots(PyTypeObject *type, PyTypeObject *base) } } -staticforward int add_operators(PyTypeObject *); -staticforward int add_subclass(PyTypeObject *base, PyTypeObject *type); +static int add_operators(PyTypeObject *); +static int add_subclass(PyTypeObject *base, PyTypeObject *type); int PyType_Ready(PyTypeObject *type) @@ -3118,7 +3118,7 @@ SLOT1BIN(slot_nb_divide, nb_divide, "__div__", "__rdiv__") SLOT1BIN(slot_nb_remainder, nb_remainder, "__mod__", "__rmod__") SLOT1BIN(slot_nb_divmod, nb_divmod, "__divmod__", "__rdivmod__") -staticforward PyObject *slot_nb_power(PyObject *, PyObject *, PyObject *); +static PyObject *slot_nb_power(PyObject *, PyObject *, PyObject *); SLOT1BINFULL(slot_nb_power_binary, slot_nb_power, nb_power, "__pow__", "__rpow__") @@ -4013,8 +4013,8 @@ update_one_slot(PyTypeObject *type, slotdef *p) return p; } -staticforward int recurse_down_subclasses(PyTypeObject *type, - slotdef **pp, PyObject *name); +static int recurse_down_subclasses(PyTypeObject *type, slotdef **pp, + PyObject *name); /* In the type, update the slots whose slotdefs are gathered in the pp0 array, and then do the same for all this type's subtypes. */ diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 1b45ef7..9f61652 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -5796,7 +5796,7 @@ static PyBufferProcs unicode_as_buffer = { (getcharbufferproc) unicode_buffer_getcharbuf, }; -staticforward PyObject * +static PyObject * unicode_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds); static PyObject * diff --git a/Objects/xxobject.c b/Objects/xxobject.c index 117714a..d847c52 100644 --- a/Objects/xxobject.c +++ b/Objects/xxobject.c @@ -18,7 +18,7 @@ typedef struct { PyObject *x_attr; /* Attributes dictionary */ } xxobject; -staticforward PyTypeObject Xxtype; +static PyTypeObject Xxtype; #define is_xxobject(v) ((v)->ob_type == &Xxtype) diff --git a/Python/ceval.c b/Python/ceval.c index 8c19787..0cd1c36 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -84,7 +84,7 @@ static long dxp[256]; #endif #endif -staticforward PyTypeObject gentype; +static PyTypeObject gentype; typedef struct { PyObject_HEAD diff --git a/Tools/bgen/bgen/bgenObjectDefinition.py b/Tools/bgen/bgen/bgenObjectDefinition.py index 87ae40f..86878b9 100644 --- a/Tools/bgen/bgen/bgenObjectDefinition.py +++ b/Tools/bgen/bgen/bgenObjectDefinition.py @@ -40,7 +40,7 @@ class ObjectDefinition(GeneratorGroup): OutHeader2("Object type " + self.name) - sf = self.static and "staticforward " + sf = self.static and "static " Output("%sPyTypeObject %s;", sf, self.typename) Output() Output("#define %s_Check(x) ((x)->ob_type == &%s)", @@ -164,7 +164,7 @@ class ObjectDefinition(GeneratorGroup): Output("#define %s_hash NULL", self.prefix) def outputTypeObject(self): - sf = self.static and "staticforward " + sf = self.static and "static " Output() Output("%sPyTypeObject %s = {", sf, self.typename) IndentLevel() diff --git a/Tools/modulator/Templates/object_head b/Tools/modulator/Templates/object_head index 9e6fa5e..07d1f6a 100644 --- a/Tools/modulator/Templates/object_head +++ b/Tools/modulator/Templates/object_head @@ -6,7 +6,7 @@ typedef struct { /* XXXX Add your own stuff here */ } $abbrev$object; -staticforward PyTypeObject $Abbrev$type; +static PyTypeObject $Abbrev$type; diff --git a/configure b/configure index 48d4cd4..0979bfd 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 1.327 . +# From configure.in Revision: 1.328 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. # @@ -13774,64 +13774,6 @@ echo "${ECHO_T}no" >&6 fi rm -f conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: checking for bad static forward" >&5 -echo $ECHO_N "checking for bad static forward... $ECHO_C" >&6 -if test "${ac_cv_bad_static_forward+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then - ac_cv_bad_static_forward=no -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" - -struct s { int a; int b; }; -static struct s foo; -int foobar() { - static int random; - random = (int) &foo; - return random; -} -static struct s foo = { 1, 2 }; -main() { - exit(!((int)&foo == foobar())); -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_bad_static_forward=no -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -( exit $ac_status ) -ac_cv_bad_static_forward=yes -fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi - -echo "$as_me:$LINENO: result: $ac_cv_bad_static_forward" >&5 -echo "${ECHO_T}$ac_cv_bad_static_forward" >&6 -if test "$ac_cv_bad_static_forward" = yes -then - -cat >>confdefs.h <<\_ACEOF -#define BAD_STATIC_FORWARD 1 -_ACEOF - -fi - va_list_is_array=no echo "$as_me:$LINENO: checking whether va_list is an array" >&5 echo $ECHO_N "checking whether va_list is an array... $ECHO_C" >&6 diff --git a/configure.in b/configure.in index 57d9a4a..5fbe2ec 100644 --- a/configure.in +++ b/configure.in @@ -1896,31 +1896,6 @@ x.sa_len = 0;], AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Define if sockaddr has sa_len member]), AC_MSG_RESULT(no)) -AC_MSG_CHECKING(for bad static forward) -AC_CACHE_VAL(ac_cv_bad_static_forward, -[AC_TRY_RUN([ -struct s { int a; int b; }; -static struct s foo; -int foobar() { - static int random; - random = (int) &foo; - return random; -} -static struct s foo = { 1, 2 }; -main() { - exit(!((int)&foo == foobar())); -}], -ac_cv_bad_static_forward=no, -ac_cv_bad_static_forward=yes, -ac_cv_bad_static_forward=no)]) -AC_MSG_RESULT($ac_cv_bad_static_forward) -if test "$ac_cv_bad_static_forward" = yes -then - AC_DEFINE(BAD_STATIC_FORWARD, 1, - [Define if your compiler botches static forward declarations - (as it does on SCI ODT 3.0)]) -fi - va_list_is_array=no AC_MSG_CHECKING(whether va_list is an array) AC_TRY_COMPILE([ -- cgit v0.12