mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
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:
parent
9cb64b954a
commit
938ace69a0
61 changed files with 126 additions and 222 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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*/
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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) \
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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) \
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ typedef struct {
|
|||
PyUnivPtr *dl_handle;
|
||||
} dlobject;
|
||||
|
||||
staticforward PyTypeObject Dltype;
|
||||
static PyTypeObject Dltype;
|
||||
|
||||
static PyObject *Dlerror;
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ typedef struct {
|
|||
fmfonthandle fh_fh;
|
||||
} fhobject;
|
||||
|
||||
staticforward PyTypeObject Fhtype;
|
||||
static PyTypeObject Fhtype;
|
||||
|
||||
#define is_fhobject(v) ((v)->ob_type == &Fhtype)
|
||||
|
||||
|
|
|
|||
|
|
@ -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) \
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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, "^")
|
||||
|
|
|
|||
|
|
@ -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*/
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -330,7 +330,7 @@ sha_final(unsigned char digest[20], SHAobject *sha_info)
|
|||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
staticforward PyTypeObject SHAtype;
|
||||
static PyTypeObject SHAtype;
|
||||
|
||||
|
||||
static SHAobject *
|
||||
|
|
|
|||
|
|
@ -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. */
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ typedef struct {
|
|||
PyThread_type_lock lock_lock;
|
||||
} lockobject;
|
||||
|
||||
staticforward PyTypeObject Locktype;
|
||||
static PyTypeObject Locktype;
|
||||
|
||||
static lockobject *
|
||||
newlockobject(void)
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ typedef struct {
|
|||
int abslineno;
|
||||
} PyXReadlinesObject;
|
||||
|
||||
staticforward PyTypeObject XReadlinesObject_Type;
|
||||
static PyTypeObject XReadlinesObject_Type;
|
||||
|
||||
static void
|
||||
xreadlines_dealloc(PyXReadlinesObject *op)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue