Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 938ace6

Browse files
committed
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.
1 parent 9cb64b9 commit 938ace6

61 files changed

Lines changed: 126 additions & 222 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Include/object.h

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -616,28 +616,19 @@ extern DL_IMPORT(PyObject) _Py_NotImplementedStruct; /* Don't use this directly
616616
#define Py_GE 5
617617

618618
/*
619-
A common programming style in Python requires the forward declaration
620-
of static, initialized structures, e.g. for a type object that is used
621-
by the functions whose address must be used in the initializer.
622-
Some compilers (notably SCO ODT 3.0, I seem to remember early AIX as
623-
well) botch this if you use the static keyword for both declarations
624-
(they allocate two objects, and use the first, uninitialized one until
625-
the second declaration is encountered). Therefore, the forward
626-
declaration should use the 'forwardstatic' keyword. This expands to
627-
static on most systems, but to extern on a few. The actual storage
628-
and name will still be static because the second declaration is
629-
static, so no linker visible symbols will be generated. (Standard C
630-
compilers take offense to the extern forward declaration of a static
631-
object, so I can't just put extern in all cases. :-( )
619+
Define staticforward and statichere for source compatibility with old
620+
C extensions.
621+
622+
The staticforward define was needed to support certain broken C
623+
compilers (notably SCO ODT 3.0, perhaps early AIX as well) botched the
624+
static keyword when it was used with a forward declaration of a static
625+
initialized structure. Standard C allows the forward declaration with
626+
static, and we've decided to stop catering to broken C compilers.
627+
(In fact, we expect that the compilers are all fixed eight years later.)
632628
*/
633629

634-
#ifdef BAD_STATIC_FORWARD
635-
#define staticforward extern
636-
#define statichere static
637-
#else /* !BAD_STATIC_FORWARD */
638630
#define staticforward static
639631
#define statichere static
640-
#endif /* !BAD_STATIC_FORWARD */
641632

642633

643634
/*

Mac/Lib/test/mkcwproj/mkcwtestmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ typedef struct {
2323
PyObject *x_attr; /* Attributes dictionary */
2424
} XxoObject;
2525

26-
staticforward PyTypeObject Xxo_Type;
26+
static PyTypeObject Xxo_Type;
2727

2828
#define XxoObject_Check(v) ((v)->ob_type == &Xxo_Type)
2929

Mac/Modules/Nav.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ typedef struct {
233233
NavReplyRecord itself;
234234
} navrrobject;
235235

236-
staticforward PyTypeObject Navrrtype;
236+
static PyTypeObject Navrrtype;
237237

238238

239239

Mac/Modules/calldll.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ typedef struct {
471471
char name[MAXNAME+1];
472472
} cdfobject;
473473

474-
staticforward PyTypeObject Cdftype;
474+
static PyTypeObject Cdftype;
475475

476476

477477

@@ -485,7 +485,7 @@ typedef struct {
485485
char name[MAXNAME+1];
486486
} cdrobject;
487487

488-
staticforward PyTypeObject Cdrtype;
488+
static PyTypeObject Cdrtype;
489489

490490

491491

@@ -503,7 +503,7 @@ typedef struct {
503503
conventry *argconv[MAXARG]; /* Value converter list */
504504
} cdcobject;
505505

506-
staticforward PyTypeObject Cdctype;
506+
static PyTypeObject Cdctype;
507507

508508

509509

Mac/Modules/ctbmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ typedef struct {
8080
int err; /* Error to pass to the callback */
8181
} ctbcmobject;
8282

83-
staticforward PyTypeObject ctbcmtype;
83+
static PyTypeObject ctbcmtype;
8484

8585
#define is_ctbcmobject(v) ((v)->ob_type == &ctbcmtype)
8686

Mac/Modules/ctl/_Ctlmodule.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ extern int _CtlObj_Convert(PyObject *, ControlHandle *);
3535
#define CtlObj_Convert _CtlObj_Convert
3636
#endif
3737

38-
staticforward PyObject *CtlObj_WhichControl(ControlHandle);
38+
static PyObject *CtlObj_WhichControl(ControlHandle);
3939

4040
#define as_Control(h) ((ControlHandle)h)
4141
#define as_Resource(ctl) ((Handle)ctl)
@@ -139,9 +139,9 @@ static ControlUserPaneIdleUPP myidleproc_upp;
139139
static ControlUserPaneHitTestUPP myhittestproc_upp;
140140
static ControlUserPaneTrackingUPP mytrackingproc_upp;
141141

142-
staticforward int settrackfunc(PyObject *); /* forward */
143-
staticforward void clrtrackfunc(void); /* forward */
144-
staticforward int setcallback(PyObject *, OSType, PyObject *, UniversalProcPtr *);
142+
static int settrackfunc(PyObject *); /* forward */
143+
static void clrtrackfunc(void); /* forward */
144+
static int setcallback(PyObject *, OSType, PyObject *, UniversalProcPtr *);
145145

146146
static PyObject *Ctl_Error;
147147

Mac/Modules/hfsplusmodule.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ typedef struct {
4343
short forkref;
4444
} forkRefObject;
4545

46-
staticforward PyTypeObject forkRefObject_Type;
46+
static PyTypeObject forkRefObject_Type;
4747

4848
#define forkRefObject_Check(v) ((v)->ob_type == &forkRefObject_Type)
4949

@@ -359,7 +359,7 @@ typedef struct {
359359
FSIterator iterator;
360360
} iteratorObject;
361361

362-
staticforward PyTypeObject iteratorObject_Type;
362+
static PyTypeObject iteratorObject_Type;
363363

364364
#define iteratorObject_Check(v) ((v)->ob_type == &iteratorObject_Type)
365365

@@ -534,7 +534,7 @@ typedef struct {
534534
Boolean directory;
535535
} fsRefObject;
536536

537-
staticforward PyTypeObject fsRefObject_Type;
537+
static PyTypeObject fsRefObject_Type;
538538

539539
#define fsRefObject_Check(v) ((v)->ob_type == &fsRefObject_Type)
540540

Mac/Modules/icgluemodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ typedef struct {
6161
ICInstance inst;
6262
} iciobject;
6363

64-
staticforward PyTypeObject Icitype;
64+
static PyTypeObject Icitype;
6565

6666

6767

Mac/Modules/macfsmodule.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ typedef struct {
7070
AliasHandle alias;
7171
} mfsaobject;
7272

73-
staticforward PyTypeObject Mfsatype;
73+
static PyTypeObject Mfsatype;
7474

7575
#define is_mfsaobject(v) ((v)->ob_type == &Mfsatype)
7676

@@ -82,7 +82,7 @@ typedef struct {
8282
FSSpec fsspec;
8383
} mfssobject;
8484

85-
staticforward PyTypeObject Mfsstype;
85+
static PyTypeObject Mfsstype;
8686

8787
#define is_mfssobject(v) ((v)->ob_type == &Mfsstype)
8888

@@ -94,7 +94,7 @@ typedef struct {
9494
FSRef fsref;
9595
} mfsrobject;
9696

97-
staticforward PyTypeObject Mfsrtype;
97+
static PyTypeObject Mfsrtype;
9898

9999
#define is_mfsrobject(v) ((v)->ob_type == &Mfsrtype)
100100

@@ -107,13 +107,13 @@ typedef struct {
107107
FInfo finfo;
108108
} mfsiobject;
109109

110-
staticforward PyTypeObject Mfsitype;
110+
static PyTypeObject Mfsitype;
111111

112112
#define is_mfsiobject(v) ((v)->ob_type == &Mfsitype)
113113

114114

115-
staticforward mfssobject *newmfssobject(FSSpec *fss); /* Forward */
116-
staticforward mfsrobject *newmfsrobject(FSRef *fsr); /* Forward */
115+
static mfssobject *newmfssobject(FSSpec *fss); /* Forward */
116+
static mfsrobject *newmfsrobject(FSRef *fsr); /* Forward */
117117

118118
/* ---------------------------------------------------------------- */
119119

Mac/Modules/macosmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ typedef struct {
6060
int isclosed;
6161
} rfobject;
6262

63-
staticforward PyTypeObject Rftype;
63+
static PyTypeObject Rftype;
6464

6565

6666

0 commit comments

Comments
 (0)