From 3a3dbc37f18ede6dbaf45180ef666ee2c230a303 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Sun, 2 May 2021 17:36:29 -0700 Subject: [PATCH] clean up references to `__IMPORT__` and `__EXPORT__` This removes any reference to the custom `__IMPORT__` and `__EXPORT__` macros. These are remnants from supporting uwin. However, the need for uwin is greatly diminished by proper native Windows support for the library. Furthermore, the functionality that this enables will be restored imminently by means of decoration of public interfaces. The uwin system used `_BLD_STATIC` to indicate a static build and `__DYNAMIC__` to indicate a shared build. Furthermore, it used `_BLD_DLL` to indicate a dynamic library on Windows, that is a DLL. This augmented the check of `_DLL` which is the Microsoft specified define that indicates a shared library build. Based upon the state of these four flags (why four flags for 2 states?) it then defined `__IMPORT__` and `__EXPORT__` to `__declspec(dllimport)` and `__declspec(dllexport)` respectively. To further complicate things, UWIN was built up during Windows 3.1, which meant that it predated the linker support for DLL storage. Instead, this is required work by the user, and it has special macros for declaring the (now) synthetic import symbol as well as defining it. This is now no longer required due to improved support in the compiler and linker which will perform the necessary work. On Unix, this synthetic symbol declaration and definition is not required as the linker has always supported this for shared libraries - it is responsible for creating the PLT which is roughly equivalent to the IAT (technically, the IAT is both the PLT and the GOT). This is now also automated on Windows, at least for the past ~25 years. This clean up is meant to simplify the migration to `[module]_EXPORTS` as the "standard" macro which is defined by CMake (and is generally used elsewhere now as well) to indicate that the symbols for the module should be exported. `_DLL` provides the necessary information whether a DLL is being built or not. With that history, it is clear that this is a regression for GraphViz on uwin, the temporary breakage seems reasonable to simplify the migration. --- lib/ast/hashkey.h | 3 --- lib/dotgen/dotprocs.h | 3 --- lib/expr/expr.h | 10 ---------- lib/pathplan/pathplan.h | 3 --- lib/pathplan/vispath.h | 3 --- lib/sfio/sfio.h | 3 --- tclpkg/tcldot/tcldot.c | 3 --- 7 files changed, 28 deletions(-) diff --git a/lib/ast/hashkey.h b/lib/ast/hashkey.h index b10bf2da9..ba1d798bb 100644 --- a/lib/ast/hashkey.h +++ b/lib/ast/hashkey.h @@ -43,9 +43,6 @@ extern "C" { #define HASHNKEY4(n,c4,c3,c2,c1) HASHKEY5((n)+'a',c4,c3,c2,c1) #define HASHNKEY5(n,c5,c4,c3,c2,c1) HASHKEY6((n)+'a',c5,c4,c3,c2,c1) -#if _BLD_ast && defined(__EXPORT__) -#define extern __EXPORT__ -#endif extern long strkey(const char *); diff --git a/lib/dotgen/dotprocs.h b/lib/dotgen/dotprocs.h index 93fd9fa78..d9d22f78e 100644 --- a/lib/dotgen/dotprocs.h +++ b/lib/dotgen/dotprocs.h @@ -69,9 +69,6 @@ extern "C" { extern void virtual_weight(Agedge_t *); extern void zapinlist(elist *, Agedge_t *); -#if defined(_BLD_dot) && defined(_DLL) -# define extern __EXPORT__ -#endif extern Agraph_t* dot_root(void *); extern void dot_concentrate(Agraph_t *); extern void dot_mincross(Agraph_t *, int); diff --git a/lib/expr/expr.h b/lib/expr/expr.h index c81446f94..68072a2f1 100644 --- a/lib/expr/expr.h +++ b/lib/expr/expr.h @@ -27,13 +27,6 @@ extern "C" { #undef RS /* hp.pa grabs this!! */ -#if _BLD_expr && defined(__EXPORT__) -#define extern __EXPORT__ -#endif -#if !_BLD_expr && defined(__IMPORT__) -#define extern extern __IMPORT__ -#endif - #include #undef extern @@ -277,9 +270,6 @@ struct Excc_s /* excc() state */ }; -#if _BLD_expr && defined(__EXPORT__) -#define extern __EXPORT__ -#endif extern Exnode_t* excast(Expr_t*, Exnode_t*, int, Exnode_t*, int); extern Exnode_t* exnoncast(Exnode_t *); diff --git a/lib/pathplan/pathplan.h b/lib/pathplan/pathplan.h index afb868d22..a2e8773ea 100644 --- a/lib/pathplan/pathplan.h +++ b/lib/pathplan/pathplan.h @@ -20,9 +20,6 @@ extern "C" { #endif -#if defined(_BLD_pathplan) && defined(__EXPORT__) -# define extern __EXPORT__ -#endif /* find shortest euclidean path within a simple polygon */ extern int Pshortestpath(Ppoly_t * boundary, Ppoint_t endpoints[2], diff --git a/lib/pathplan/vispath.h b/lib/pathplan/vispath.h index 4a4a5be74..614504777 100644 --- a/lib/pathplan/vispath.h +++ b/lib/pathplan/vispath.h @@ -19,9 +19,6 @@ extern "C" { #endif -#if defined(_BLD_pathplan) && defined(__EXPORT__) -# define extern __EXPORT__ -#endif /* open a visibility graph * Points in polygonal obstacles must be in clockwise order. diff --git a/lib/sfio/sfio.h b/lib/sfio/sfio.h index 7f75011d3..a4a0f60a8 100644 --- a/lib/sfio/sfio.h +++ b/lib/sfio/sfio.h @@ -281,9 +281,6 @@ extern "C" { #define sfstderr ((Sfio_t*)_ast_dll->_ast_stderr) #endif -#if defined(_BLD_sfio) && defined(__EXPORT__) -#define extern __EXPORT__ -#endif extern Sfio_t *sfnew(Sfio_t *, void *, size_t, int, int); extern Sfio_t *sfopen(Sfio_t *, const char *, const char *); diff --git a/tclpkg/tcldot/tcldot.c b/tclpkg/tcldot/tcldot.c index 24151b304..b747124cf 100644 --- a/tclpkg/tcldot/tcldot.c +++ b/tclpkg/tcldot/tcldot.c @@ -151,9 +151,6 @@ static int dotstring(ClientData clientData, Tcl_Interp * interp, return TCL_OK; } -#if defined(_BLD_tcldot) && defined(_DLL) -__EXPORT__ -#endif int Tcldot_Init(Tcl_Interp * interp) { ictx_t *ictx; -- 2.40.0