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.
This commit is contained in:
Jeremy Hylton 2002-07-17 16:30:39 +00:00
parent 9cb64b954a
commit 938ace69a0
61 changed files with 126 additions and 222 deletions

View File

@ -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 */
/*

View File

@ -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)

View File

@ -233,7 +233,7 @@ typedef struct {
NavReplyRecord itself;
} navrrobject;
staticforward PyTypeObject Navrrtype;
static PyTypeObject Navrrtype;

View File

@ -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;

View File

@ -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)

View File

@ -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;

View File

@ -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)

View File

@ -61,7 +61,7 @@ typedef struct {
ICInstance inst;
} iciobject;
staticforward PyTypeObject Icitype;
static PyTypeObject Icitype;

View File

@ -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 */
/* ---------------------------------------------------------------- */

View File

@ -60,7 +60,7 @@ typedef struct {
int isclosed;
} rfobject;
staticforward PyTypeObject Rftype;
static PyTypeObject Rftype;

View File

@ -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)

View File

@ -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

View File

@ -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*/

View File

@ -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*/

View File

@ -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

View File

@ -64,7 +64,7 @@ PERFORMANCE OF THIS SOFTWARE.
#include <Dialogs.h>
#ifndef USE_BUILTIN_PATH
staticforward char *PyMac_GetPythonPath();
static char *PyMac_GetPythonPath();
#endif
#define PYTHONPATH "\

View File

@ -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)

View File

@ -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*/

View File

@ -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 <SIOUX.h>
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

View File

@ -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

View File

@ -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)

View File

@ -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) \

View File

@ -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);

View File

@ -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

View File

@ -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) \

View File

@ -15,7 +15,7 @@ typedef struct {
PyUnivPtr *dl_handle;
} dlobject;
staticforward PyTypeObject Dltype;
static PyTypeObject Dltype;
static PyObject *Dlerror;

View File

@ -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)

View File

@ -15,7 +15,7 @@ typedef struct {
fmfonthandle fh_fh;
} fhobject;
staticforward PyTypeObject Fhtype;
static PyTypeObject Fhtype;
#define is_fhobject(v) ((v)->ob_type == &Fhtype)

View File

@ -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) \

View File

@ -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;

View File

@ -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)

View File

@ -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)

View File

@ -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, "^")

View File

@ -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*/

View File

@ -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.

View File

@ -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)

View File

@ -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.

View File

@ -330,7 +330,7 @@ sha_final(unsigned char digest[20], SHAobject *sha_info)
* ------------------------------------------------------------------------
*/
staticforward PyTypeObject SHAtype;
static PyTypeObject SHAtype;
static SHAobject *

View File

@ -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. */

View File

@ -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;

View File

@ -22,7 +22,7 @@ typedef struct {
PyThread_type_lock lock_lock;
} lockobject;
staticforward PyTypeObject Locktype;
static PyTypeObject Locktype;
static lockobject *
newlockobject(void)

View File

@ -14,7 +14,7 @@ typedef struct {
int abslineno;
} PyXReadlinesObject;
staticforward PyTypeObject XReadlinesObject_Type;
static PyTypeObject XReadlinesObject_Type;
static void
xreadlines_dealloc(PyXReadlinesObject *op)

View File

@ -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)

View File

@ -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)

View File

@ -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;

View File

@ -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)

View File

@ -678,7 +678,7 @@ float_float(PyObject *v)
}
staticforward PyObject *
static PyObject *
float_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
static PyObject *

View File

@ -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 *

View File

@ -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)

View File

@ -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 *

View File

@ -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)

View File

@ -2864,7 +2864,7 @@ string_methods[] = {
{NULL, NULL} /* sentinel */
};
staticforward PyObject *
static PyObject *
str_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
static PyObject *

View File

@ -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 *

View File

@ -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. */

View File

@ -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 *

View File

@ -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)

View File

@ -84,7 +84,7 @@ static long dxp[256];
#endif
#endif
staticforward PyTypeObject gentype;
static PyTypeObject gentype;
typedef struct {
PyObject_HEAD

View File

@ -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()

View File

@ -6,7 +6,7 @@ typedef struct {
/* XXXX Add your own stuff here */
} $abbrev$object;
staticforward PyTypeObject $Abbrev$type;
static PyTypeObject $Abbrev$type;

60
configure vendored
View File

@ -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

View File

@ -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([