]> granicus.if.org Git - python/commitdiff
Excise DL_IMPORT/EXPORT from object.h, and related files. This patch
authorMark Hammond <mhammond@skippinet.com.au>
Mon, 29 Jul 2002 13:42:14 +0000 (13:42 +0000)
committerMark Hammond <mhammond@skippinet.com.au>
Mon, 29 Jul 2002 13:42:14 +0000 (13:42 +0000)
also adds 'extern' to PyAPI_DATA rather than at each declaration, as
discussed with Tim and Guido.

Include/import.h
Include/object.h
Include/pydebug.h
Include/pyport.h
Include/pythonrun.h
Objects/object.c
Python/exceptions.c

index 3f6157d3f85b20591d5b1dca0a64f1c4fe547f5b..c2c869e496e57ab7791d9b9087e47782c4aef124 100644 (file)
@@ -21,18 +21,18 @@ PyAPI_FUNC(PyObject *) PyImport_ReloadModule(PyObject *m);
 PyAPI_FUNC(void) PyImport_Cleanup(void);
 PyAPI_FUNC(int) PyImport_ImportFrozenModule(char *);
 
-extern PyAPI_FUNC(PyObject *)_PyImport_FindExtension(char *, char *);
-extern PyAPI_FUNC(PyObject *)_PyImport_FixupExtension(char *, char *);
+PyAPI_FUNC(PyObject *)_PyImport_FindExtension(char *, char *);
+PyAPI_FUNC(PyObject *)_PyImport_FixupExtension(char *, char *);
 
 struct _inittab {
     char *name;
     void (*initfunc)(void);
 };
 
-extern PyAPI_DATA(struct _inittab *) PyImport_Inittab;
+PyAPI_DATA(struct _inittab *) PyImport_Inittab;
 
-extern PyAPI_FUNC(int) PyImport_AppendInittab(char *name, void (*initfunc)(void));
-extern PyAPI_FUNC(int) PyImport_ExtendInittab(struct _inittab *newtab);
+PyAPI_FUNC(int) PyImport_AppendInittab(char *name, void (*initfunc)(void));
+PyAPI_FUNC(int) PyImport_ExtendInittab(struct _inittab *newtab);
 
 struct _frozen {
     char *name;
@@ -43,7 +43,7 @@ struct _frozen {
 /* Embedding apps may change this pointer to point to their favorite
    collection of frozen modules: */
 
-extern PyAPI_DATA(struct _frozen *) PyImport_FrozenModules;
+PyAPI_DATA(struct _frozen *) PyImport_FrozenModules;
 
 #ifdef __cplusplus
 }
index 3397662f0355cc752ab599551a1a9dd9f6fdb1b7..4987e12946812ea93c7d387ea266eb54676b1857 100644 (file)
@@ -327,52 +327,52 @@ typedef struct _typeobject {
 
 
 /* Generic type check */
-extern DL_IMPORT(int) PyType_IsSubtype(PyTypeObject *, PyTypeObject *);
+PyAPI_FUNC(int) PyType_IsSubtype(PyTypeObject *, PyTypeObject *);
 #define PyObject_TypeCheck(ob, tp) \
        ((ob)->ob_type == (tp) || PyType_IsSubtype((ob)->ob_type, (tp)))
 
-extern DL_IMPORT(PyTypeObject) PyType_Type; /* built-in 'type' */
-extern DL_IMPORT(PyTypeObject) PyBaseObject_Type; /* built-in 'object' */
-extern DL_IMPORT(PyTypeObject) PySuper_Type; /* built-in 'super' */
+PyAPI_DATA(PyTypeObject) PyType_Type; /* built-in 'type' */
+PyAPI_DATA(PyTypeObject) PyBaseObject_Type; /* built-in 'object' */
+PyAPI_DATA(PyTypeObject) PySuper_Type; /* built-in 'super' */
 
 #define PyType_Check(op) PyObject_TypeCheck(op, &PyType_Type)
 #define PyType_CheckExact(op) ((op)->ob_type == &PyType_Type)
 
-extern DL_IMPORT(int) PyType_Ready(PyTypeObject *);
-extern DL_IMPORT(PyObject *) PyType_GenericAlloc(PyTypeObject *, int);
-extern DL_IMPORT(PyObject *) PyType_GenericNew(PyTypeObject *,
+PyAPI_FUNC(int) PyType_Ready(PyTypeObject *);
+PyAPI_FUNC(PyObject *) PyType_GenericAlloc(PyTypeObject *, int);
+PyAPI_FUNC(PyObject *) PyType_GenericNew(PyTypeObject *,
                                               PyObject *, PyObject *);
-extern DL_IMPORT(PyObject *) _PyType_Lookup(PyTypeObject *, PyObject *);
+PyAPI_FUNC(PyObject *) _PyType_Lookup(PyTypeObject *, PyObject *);
 
 /* Generic operations on objects */
-extern DL_IMPORT(int) PyObject_Print(PyObject *, FILE *, int);
-extern DL_IMPORT(void) _PyObject_Dump(PyObject *);
-extern DL_IMPORT(PyObject *) PyObject_Repr(PyObject *);
-extern DL_IMPORT(PyObject *) PyObject_Str(PyObject *);
+PyAPI_FUNC(int) PyObject_Print(PyObject *, FILE *, int);
+PyAPI_FUNC(void) _PyObject_Dump(PyObject *);
+PyAPI_FUNC(PyObject *) PyObject_Repr(PyObject *);
+PyAPI_FUNC(PyObject *) PyObject_Str(PyObject *);
 #ifdef Py_USING_UNICODE
-extern DL_IMPORT(PyObject *) PyObject_Unicode(PyObject *);
+PyAPI_FUNC(PyObject *) PyObject_Unicode(PyObject *);
 #endif
-extern DL_IMPORT(int) PyObject_Compare(PyObject *, PyObject *);
-extern DL_IMPORT(PyObject *) PyObject_RichCompare(PyObject *, PyObject *, int);
-extern DL_IMPORT(int) PyObject_RichCompareBool(PyObject *, PyObject *, int);
-extern DL_IMPORT(PyObject *) PyObject_GetAttrString(PyObject *, char *);
-extern DL_IMPORT(int) PyObject_SetAttrString(PyObject *, char *, PyObject *);
-extern DL_IMPORT(int) PyObject_HasAttrString(PyObject *, char *);
-extern DL_IMPORT(PyObject *) PyObject_GetAttr(PyObject *, PyObject *);
-extern DL_IMPORT(int) PyObject_SetAttr(PyObject *, PyObject *, PyObject *);
-extern DL_IMPORT(int) PyObject_HasAttr(PyObject *, PyObject *);
-extern DL_IMPORT(PyObject **) _PyObject_GetDictPtr(PyObject *);
-extern DL_IMPORT(PyObject *) PyObject_GenericGetAttr(PyObject *, PyObject *);
-extern DL_IMPORT(int) PyObject_GenericSetAttr(PyObject *,
+PyAPI_FUNC(int) PyObject_Compare(PyObject *, PyObject *);
+PyAPI_FUNC(PyObject *) PyObject_RichCompare(PyObject *, PyObject *, int);
+PyAPI_FUNC(int) PyObject_RichCompareBool(PyObject *, PyObject *, int);
+PyAPI_FUNC(PyObject *) PyObject_GetAttrString(PyObject *, char *);
+PyAPI_FUNC(int) PyObject_SetAttrString(PyObject *, char *, PyObject *);
+PyAPI_FUNC(int) PyObject_HasAttrString(PyObject *, char *);
+PyAPI_FUNC(PyObject *) PyObject_GetAttr(PyObject *, PyObject *);
+PyAPI_FUNC(int) PyObject_SetAttr(PyObject *, PyObject *, PyObject *);
+PyAPI_FUNC(int) PyObject_HasAttr(PyObject *, PyObject *);
+PyAPI_FUNC(PyObject **) _PyObject_GetDictPtr(PyObject *);
+PyAPI_FUNC(PyObject *) PyObject_GenericGetAttr(PyObject *, PyObject *);
+PyAPI_FUNC(int) PyObject_GenericSetAttr(PyObject *,
                                              PyObject *, PyObject *);
-extern DL_IMPORT(long) PyObject_Hash(PyObject *);
-extern DL_IMPORT(int) PyObject_IsTrue(PyObject *);
-extern DL_IMPORT(int) PyObject_Not(PyObject *);
-extern DL_IMPORT(int) PyCallable_Check(PyObject *);
-extern DL_IMPORT(int) PyNumber_Coerce(PyObject **, PyObject **);
-extern DL_IMPORT(int) PyNumber_CoerceEx(PyObject **, PyObject **);
+PyAPI_FUNC(long) PyObject_Hash(PyObject *);
+PyAPI_FUNC(int) PyObject_IsTrue(PyObject *);
+PyAPI_FUNC(int) PyObject_Not(PyObject *);
+PyAPI_FUNC(int) PyCallable_Check(PyObject *);
+PyAPI_FUNC(int) PyNumber_Coerce(PyObject **, PyObject **);
+PyAPI_FUNC(int) PyNumber_CoerceEx(PyObject **, PyObject **);
 
-extern DL_IMPORT(void) PyObject_ClearWeakRefs(PyObject *);
+PyAPI_FUNC(void) PyObject_ClearWeakRefs(PyObject *);
 
 /* A slot function whose address we need to compare */
 extern int _PyObject_SlotCompare(PyObject *, PyObject *);
@@ -383,16 +383,16 @@ extern int _PyObject_SlotCompare(PyObject *, PyObject *);
    returning the names of the current locals.  In this case, if there are
    no current locals, NULL is returned, and PyErr_Occurred() is false.
 */
-extern DL_IMPORT(PyObject *) PyObject_Dir(PyObject *);
+PyAPI_FUNC(PyObject *) PyObject_Dir(PyObject *);
 
 
 /* Helpers for printing recursive container types */
-extern DL_IMPORT(int) Py_ReprEnter(PyObject *);
-extern DL_IMPORT(void) Py_ReprLeave(PyObject *);
+PyAPI_FUNC(int) Py_ReprEnter(PyObject *);
+PyAPI_FUNC(void) Py_ReprLeave(PyObject *);
 
 /* Helpers for hash functions */
-extern DL_IMPORT(long) _Py_HashDouble(double);
-extern DL_IMPORT(long) _Py_HashPointer(void*);
+PyAPI_FUNC(long) _Py_HashDouble(double);
+PyAPI_FUNC(long) _Py_HashPointer(void*);
 
 /* Helper for passing objects to printf and the like */
 #define PyObject_REPR(obj) PyString_AS_STRING(PyObject_Repr(obj))
@@ -521,8 +521,8 @@ environment the global variable trick is not safe.)
  * #ifdefs (we used to do that -- it was impenetrable).
  */
 #ifdef Py_REF_DEBUG
-extern DL_IMPORT(long) _Py_RefTotal;
-extern DL_IMPORT(void) _Py_NegativeRefcount(const char *fname,
+PyAPI_DATA(long) _Py_RefTotal;
+PyAPI_FUNC(void) _Py_NegativeRefcount(const char *fname,
                                            int lineno, PyObject *op);
 #define _Py_INC_REFTOTAL       _Py_RefTotal++
 #define _Py_DEC_REFTOTAL       _Py_RefTotal--
@@ -540,7 +540,7 @@ extern DL_IMPORT(void) _Py_NegativeRefcount(const char *fname,
 #endif /* Py_REF_DEBUG */
 
 #ifdef COUNT_ALLOCS
-extern DL_IMPORT(void) inc_count(PyTypeObject *);
+PyAPI_FUNC(void) inc_count(PyTypeObject *);
 #define _Py_INC_TPALLOCS(OP)   inc_count((OP)->ob_type)
 #define _Py_INC_TPFREES(OP)    (OP)->ob_type->tp_frees++
 #define _Py_DEC_TPFREES(OP)    (OP)->ob_type->tp_frees--
@@ -554,11 +554,11 @@ extern DL_IMPORT(void) inc_count(PyTypeObject *);
 
 #ifdef Py_TRACE_REFS
 /* Py_TRACE_REFS is such major surgery that we call external routines. */
-extern DL_IMPORT(void) _Py_NewReference(PyObject *);
-extern DL_IMPORT(void) _Py_ForgetReference(PyObject *);
-extern DL_IMPORT(void) _Py_Dealloc(PyObject *);
-extern DL_IMPORT(void) _Py_PrintReferences(FILE *);
-extern DL_IMPORT(void) _Py_ResetReferences(void);
+PyAPI_FUNC(void) _Py_NewReference(PyObject *);
+PyAPI_FUNC(void) _Py_ForgetReference(PyObject *);
+PyAPI_FUNC(void) _Py_Dealloc(PyObject *);
+PyAPI_FUNC(void) _Py_PrintReferences(FILE *);
+PyAPI_FUNC(void) _Py_ResetReferences(void);
 
 #else
 /* Without Py_TRACE_REFS, there's little enough to do that we expand code
@@ -597,14 +597,14 @@ where NULL (nil) is not suitable (since NULL often means 'error').
 
 Don't forget to apply Py_INCREF() when returning this value!!!
 */
-extern DL_IMPORT(PyObject) _Py_NoneStruct; /* Don't use this directly */
+PyAPI_DATA(PyObject) _Py_NoneStruct; /* Don't use this directly */
 #define Py_None (&_Py_NoneStruct)
 
 /*
 Py_NotImplemented is a singleton used to signal that an operation is
 not implemented for a given type combination.
 */
-extern DL_IMPORT(PyObject) _Py_NotImplementedStruct; /* Don't use this directly */
+PyAPI_DATA(PyObject) _Py_NotImplementedStruct; /* Don't use this directly */
 #define Py_NotImplemented (&_Py_NotImplementedStruct)
 
 /* Rich comparison opcodes */
@@ -720,10 +720,10 @@ chain of N deallocations is broken into N / PyTrash_UNWIND_LEVEL pieces,
 with the call stack never exceeding a depth of PyTrash_UNWIND_LEVEL.
 */
 
-extern DL_IMPORT(void) _PyTrash_deposit_object(PyObject*);
-extern DL_IMPORT(void) _PyTrash_destroy_chain(void);
-extern DL_IMPORT(int) _PyTrash_delete_nesting;
-extern DL_IMPORT(PyObject *) _PyTrash_delete_later;
+PyAPI_FUNC(void) _PyTrash_deposit_object(PyObject*);
+PyAPI_FUNC(void) _PyTrash_destroy_chain(void);
+PyAPI_DATA(int) _PyTrash_delete_nesting;
+PyAPI_DATA(PyObject *) _PyTrash_delete_later;
 
 #define PyTrash_UNWIND_LEVEL 50
 
index e24c9fe00572243e2bbbad44576bbadd80384221..9a5773ac12feb7b2f694c89a6028e05638d0903e 100644 (file)
@@ -5,28 +5,28 @@
 extern "C" {
 #endif
 
-extern DL_IMPORT(int) Py_DebugFlag;
-extern DL_IMPORT(int) Py_VerboseFlag;
-extern DL_IMPORT(int) Py_InteractiveFlag;
-extern DL_IMPORT(int) Py_OptimizeFlag;
-extern DL_IMPORT(int) Py_NoSiteFlag;
-extern DL_IMPORT(int) Py_UseClassExceptionsFlag;
-extern DL_IMPORT(int) Py_FrozenFlag;
-extern DL_IMPORT(int) Py_TabcheckFlag;
-extern DL_IMPORT(int) Py_UnicodeFlag;
-extern DL_IMPORT(int) Py_IgnoreEnvironmentFlag;
-extern DL_IMPORT(int) Py_DivisionWarningFlag;
+PyAPI_DATA(int) Py_DebugFlag;
+PyAPI_DATA(int) Py_VerboseFlag;
+PyAPI_DATA(int) Py_InteractiveFlag;
+PyAPI_DATA(int) Py_OptimizeFlag;
+PyAPI_DATA(int) Py_NoSiteFlag;
+PyAPI_DATA(int) Py_UseClassExceptionsFlag;
+PyAPI_DATA(int) Py_FrozenFlag;
+PyAPI_DATA(int) Py_TabcheckFlag;
+PyAPI_DATA(int) Py_UnicodeFlag;
+PyAPI_DATA(int) Py_IgnoreEnvironmentFlag;
+PyAPI_DATA(int) Py_DivisionWarningFlag;
 /* _XXX Py_QnewFlag should go away in 2.3.  It's true iff -Qnew is passed,
   on the command line, and is used in 2.2 by ceval.c to make all "/" divisions
   true divisions (which they will be in 2.3). */
-extern DL_IMPORT(int) _Py_QnewFlag;
+PyAPI_DATA(int) _Py_QnewFlag;
 
 /* this is a wrapper around getenv() that pays attention to
    Py_IgnoreEnvironmentFlag.  It should be used for getting variables like
    PYTHONPATH and PYTHONHOME from the environment */
 #define Py_GETENV(s) (Py_IgnoreEnvironmentFlag ? NULL : getenv(s))
 
-DL_IMPORT(void) Py_FatalError(const char *message);
+PyAPI_FUNC(void) Py_FatalError(const char *message);
 
 #ifdef __cplusplus
 }
index c362ca077f698c626267bc484c60a5bb95cae708..f1c42fb2ececf23de2d4c62576a780f2ff103d18 100644 (file)
@@ -405,14 +405,14 @@ and both these use __declspec()
 #      if defined(HAVE_DECLSPEC_DLL)
 #              ifdef Py_BUILD_CORE
 #                      define PyAPI_FUNC(RTYPE) __declspec(dllexport) RTYPE
-#                      define PyAPI_DATA(RTYPE) __declspec(dllexport) RTYPE
+#                      define PyAPI_DATA(RTYPE) extern __declspec(dllexport) RTYPE
                        /* module init functions inside the core need no external linkage */
 #                      define PyMODINIT_FUNC void
 #              else /* Py_BUILD_CORE */
                        /* Building an extension module, or an embedded situation */
                        /* public Python functions and data are imported */
 #                      define PyAPI_FUNC(RTYPE) __declspec(dllimport) RTYPE
-#                      define PyAPI_DATA(RTYPE) __declspec(dllimport) RTYPE
+#                      define PyAPI_DATA(RTYPE) extern __declspec(dllimport) RTYPE
                        /* module init functions outside the core must be exported */
 #                      if defined(__cplusplus)
 #                              define PyMODINIT_FUNC extern "C" __declspec(dllexport) void
@@ -428,7 +428,7 @@ and both these use __declspec()
 #      define PyAPI_FUNC(RTYPE) RTYPE
 #endif
 #ifndef PyAPI_DATA
-#      define PyAPI_DATA(RTYPE) RTYPE
+#      define PyAPI_DATA(RTYPE) extern RTYPE
 #endif
 #ifndef PyMODINIT_FUNC
 #      if defined(__cplusplus)
index 33cf15c6cc90f471a1329035c782cfc62872ec47..2d7d2b6e9697733517a4dec80cab92e6a0a2c91e 100644 (file)
@@ -79,35 +79,35 @@ DL_IMPORT(void) Py_Exit(int);
 DL_IMPORT(int) Py_FdIsInteractive(FILE *, char *);
 
 /* In getpath.c */
-DL_IMPORT(char *) Py_GetProgramFullPath(void);
-DL_IMPORT(char *) Py_GetPrefix(void);
-DL_IMPORT(char *) Py_GetExecPrefix(void);
-DL_IMPORT(char *) Py_GetPath(void);
+PyAPI_FUNC(char *) Py_GetProgramFullPath(void);
+PyAPI_FUNC(char *) Py_GetPrefix(void);
+PyAPI_FUNC(char *) Py_GetExecPrefix(void);
+PyAPI_FUNC(char *) Py_GetPath(void);
 
 /* In their own files */
-DL_IMPORT(const char *) Py_GetVersion(void);
-DL_IMPORT(const char *) Py_GetPlatform(void);
-DL_IMPORT(const char *) Py_GetCopyright(void);
-DL_IMPORT(const char *) Py_GetCompiler(void);
-DL_IMPORT(const char *) Py_GetBuildInfo(void);
+PyAPI_FUNC(const char *) Py_GetVersion(void);
+PyAPI_FUNC(const char *) Py_GetPlatform(void);
+PyAPI_FUNC(const char *) Py_GetCopyright(void);
+PyAPI_FUNC(const char *) Py_GetCompiler(void);
+PyAPI_FUNC(const char *) Py_GetBuildInfo(void);
 
 /* Internal -- various one-time initializations */
 DL_IMPORT(PyObject *) _PyBuiltin_Init(void);
 DL_IMPORT(PyObject *) _PySys_Init(void);
 DL_IMPORT(void) _PyImport_Init(void);
-DL_IMPORT(void) _PyExc_Init(void);
+PyAPI_FUNC(void) _PyExc_Init(void);
 
 /* Various internal finalizers */
-DL_IMPORT(void) _PyExc_Fini(void);
-DL_IMPORT(void) _PyImport_Fini(void);
-DL_IMPORT(void) PyMethod_Fini(void);
-DL_IMPORT(void) PyFrame_Fini(void);
-DL_IMPORT(void) PyCFunction_Fini(void);
-DL_IMPORT(void) PyTuple_Fini(void);
-DL_IMPORT(void) PyString_Fini(void);
-DL_IMPORT(void) PyInt_Fini(void);
-DL_IMPORT(void) PyFloat_Fini(void);
-DL_IMPORT(void) PyOS_FiniInterrupts(void);
+PyAPI_FUNC(void) _PyExc_Fini(void);
+PyAPI_FUNC(void) _PyImport_Fini(void);
+PyAPI_FUNC(void) PyMethod_Fini(void);
+PyAPI_FUNC(void) PyFrame_Fini(void);
+PyAPI_FUNC(void) PyCFunction_Fini(void);
+PyAPI_FUNC(void) PyTuple_Fini(void);
+PyAPI_FUNC(void) PyString_Fini(void);
+PyAPI_FUNC(void) PyInt_Fini(void);
+PyAPI_FUNC(void) PyFloat_Fini(void);
+PyAPI_FUNC(void) PyOS_FiniInterrupts(void);
 
 /* Stuff with no proper home (yet) */
 DL_IMPORT(char *) PyOS_Readline(char *);
index 19f9a7add145420d226b0e0f15c0e761f28098c8..e9251cc22d47cf1a052876ecace2c60938469b3d 100644 (file)
@@ -8,10 +8,10 @@
 #endif
 
 #ifdef Py_REF_DEBUG
-DL_IMPORT(long) _Py_RefTotal;
+long _Py_RefTotal;
 #endif
 
-DL_IMPORT(int) Py_DivisionWarningFlag;
+int Py_DivisionWarningFlag;
 
 /* Object allocation routines used by NEWOBJ and NEWVAROBJ macros.
    These are used by the individual routines for object creation.
index afb6a7bf3809195bb7e7c419529888e6064cdb72..934850aa066146dc46eff3cc2b1bdfcb4195435e 100644 (file)
@@ -1050,7 +1050,7 @@ static struct {
 
 \f
 
-DL_EXPORT(void)
+void
 _PyExc_Init(void)
 {
     char *modulename = "exceptions";
@@ -1146,7 +1146,7 @@ _PyExc_Init(void)
 }
 
 
-DL_EXPORT(void)
+void
 _PyExc_Fini(void)
 {
     int i;