From: Erwin Janssen Date: Mon, 19 Sep 2016 18:47:43 +0000 (+0200) Subject: Remove all __DEFINE__ and __EXTERN__ macros X-Git-Tag: untagged-5fc0363bc76319758ff6~1^2^2~16 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c2ec332621903e10a37d64ced47b1a7127fe4a17;p=graphviz Remove all __DEFINE__ and __EXTERN__ macros It seems that the condition where this macro is defined (`#if !defined(_DLL_BLD) && defined(_dll_import)`) is never met. This macro also seems to be meant for very specific scenario. All in all, it seems safe to remove the macros by replacing them with the value it gets when the above condition is not met. --- diff --git a/ast_common.h.in b/ast_common.h.in index bbb98eeae..e1a1962a9 100644 --- a/ast_common.h.in +++ b/ast_common.h.in @@ -98,14 +98,6 @@ #endif #endif /*_astimport*/ -#if !defined(_DLL_BLD) && defined(_dll_import) -#define __EXTERN__(T,obj) extern T obj; T* _imp__ ## obj = &obj -#define __DEFINE__(T,obj,val) T obj = val; T* _imp__ ## obj = &obj -#else -#define __EXTERN__(T,obj) extern T obj -#define __DEFINE__(T,obj,val) T obj = val -#endif - #ifndef _AST_STD_H # if defined(_hdr_stddef) # include diff --git a/features/common b/features/common index 5a7d1df61..f5a025ee4 100644 --- a/features/common +++ b/features/common @@ -108,16 +108,6 @@ cat{ #endif /*_astimport*/ }end -cat{ - #if !_DLL_BLD && _dll_import - #define __EXTERN__(T,obj) extern T obj; T* _imp__ ## obj = &obj - #define __DEFINE__(T,obj,val) T obj = val; T* _imp__ ## obj = &obj - #else - #define __EXTERN__(T,obj) extern T obj - #define __DEFINE__(T,obj,val) T obj = val - #endif -}end - cat{ #ifndef _AST_STD_H # if _hdr_stddef diff --git a/lib/cdt/cdt.h b/lib/cdt/cdt.h index 19dcb2512..6dc99e5da 100644 --- a/lib/cdt/cdt.h +++ b/lib/cdt/cdt.h @@ -29,15 +29,6 @@ #define __IMPORT__ __declspec (dllimport) #endif - -#if !defined(_DLL_BLD) && defined(_dll_import) -#define __EXTERN__(T,obj) extern T obj; T* _imp__ ## obj = &obj -#define __DEFINE__(T,obj,val) T obj = val; T* _imp__ ## obj = &obj -#else -#define __EXTERN__(T,obj) extern T obj -#define __DEFINE__(T,obj,val) T obj = val -#endif - typedef struct _dtlink_s Dtlink_t; typedef struct _dthold_s Dthold_t; typedef struct _dtdisc_s Dtdisc_t; diff --git a/lib/cdt/dthash.c b/lib/cdt/dthash.c index ac5359f48..8babf1613 100644 --- a/lib/cdt/dthash.c +++ b/lib/cdt/dthash.c @@ -322,12 +322,12 @@ static Void_t* dthash(Dt_t* dt, reg Void_t* obj, int type) static Dtmethod_t _Dtset = { dthash, DT_SET }; static Dtmethod_t _Dtbag = { dthash, DT_BAG }; -__DEFINE__(Dtmethod_t*,Dtset,&_Dtset); -__DEFINE__(Dtmethod_t*,Dtbag,&_Dtbag); +Dtmethod_t* Dtset = &_Dtset; +Dtmethod_t* Dtbag = &_Dtbag; #ifndef KPVDEL /* for backward compatibility - remove next time */ Dtmethod_t _Dthash = { dthash, DT_SET }; -__DEFINE__(Dtmethod_t*,Dthash,&_Dthash); +Dtmethod_t* Dthash = &_Dthash; #endif #ifdef NoF diff --git a/lib/cdt/dtlist.c b/lib/cdt/dtlist.c index 1ed726b53..a49de2c82 100644 --- a/lib/cdt/dtlist.c +++ b/lib/cdt/dtlist.c @@ -175,10 +175,10 @@ static Dtmethod_t _Dtdeque = { dtlist, DT_DEQUE }; static Dtmethod_t _Dtstack = { dtlist, DT_STACK }; static Dtmethod_t _Dtqueue = { dtlist, DT_QUEUE }; -__DEFINE__(Dtmethod_t*,Dtlist,&_Dtlist); -__DEFINE__(Dtmethod_t*,Dtdeque,&_Dtdeque); -__DEFINE__(Dtmethod_t*,Dtstack,&_Dtstack); -__DEFINE__(Dtmethod_t*,Dtqueue,&_Dtqueue); +Dtmethod_t* Dtlist = &_Dtlist; +Dtmethod_t* Dtdeque = &_Dtdeque; +Dtmethod_t* Dtstack = &_Dtstack; +Dtmethod_t* Dtqueue = &_Dtqueue; #ifdef NoF NoF(dtlist) diff --git a/lib/cdt/dttree.c b/lib/cdt/dttree.c index 87b2f0e38..cffeade48 100644 --- a/lib/cdt/dttree.c +++ b/lib/cdt/dttree.c @@ -349,13 +349,13 @@ static Void_t* dttree(Dt_t* dt, Void_t* obj, int type) /* make this method available */ static Dtmethod_t _Dtoset = { dttree, DT_OSET }; static Dtmethod_t _Dtobag = { dttree, DT_OBAG }; -__DEFINE__(Dtmethod_t*,Dtoset,&_Dtoset); -__DEFINE__(Dtmethod_t*,Dtobag,&_Dtobag); +Dtmethod_t* Dtoset = &_Dtoset; +Dtmethod_t* Dtobag = &_Dtobag; #ifndef KPVDEL /* backward compatibility - delete next time around */ Dtmethod_t _Dttree = { dttree, DT_OSET }; -__DEFINE__(Dtmethod_t*,Dtorder,&_Dttree); -__DEFINE__(Dtmethod_t*,Dttree,&_Dttree); +Dtmethod_t* Dtorder = &_Dttree; +Dtmethod_t* Dttree = &_Dttree; #endif #ifdef NoF diff --git a/lib/cdt/features/common b/lib/cdt/features/common index d554c86d3..5c15fcb7b 100644 --- a/lib/cdt/features/common +++ b/lib/cdt/features/common @@ -110,16 +110,6 @@ cat{ #endif /*_astimport*/ }end -cat{ - #if !_DLL_BLD && _dll_import - #define __EXTERN__(T,obj) extern T obj; T* _imp__ ## obj = &obj - #define __DEFINE__(T,obj,val) T obj = val; T* _imp__ ## obj = &obj - #else - #define __EXTERN__(T,obj) extern T obj - #define __DEFINE__(T,obj,val) T obj = val - #endif -}end - cat{ #ifndef _AST_STD_H # if _hdr_stddef diff --git a/lib/sfio/features/common b/lib/sfio/features/common index fce0e3593..7f27e5526 100644 --- a/lib/sfio/features/common +++ b/lib/sfio/features/common @@ -108,16 +108,6 @@ cat{ #endif /*_astimport*/ }end -cat{ - #if !_DLL_BLD && _dll_import - #define __EXTERN__(T,obj) extern T obj; T* _imp__ ## obj = &obj - #define __DEFINE__(T,obj,val) T obj = val; T* _imp__ ## obj = &obj - #else - #define __EXTERN__(T,obj) extern T obj - #define __DEFINE__(T,obj,val) T obj = val - #endif -}end - cat{ #ifndef _AST_STD_H # if _hdr_stddef diff --git a/lib/sfio/sfextern.c b/lib/sfio/sfextern.c index f2bf3ab95..20b096ab1 100644 --- a/lib/sfio/sfextern.c +++ b/lib/sfio/sfextern.c @@ -79,10 +79,10 @@ Sfio_t *sfstdin = &_Sfstdin; Sfio_t *sfstdout = &_Sfstdout; Sfio_t *sfstderr = &_Sfstderr; -__EXTERN__(ssize_t, _Sfi); -__EXTERN__(Sfio_t, _Sfstdin); -__EXTERN__(Sfio_t, _Sfstdout); -__EXTERN__(Sfio_t, _Sfstderr); -__EXTERN__(Sfio_t *, sfstdin); -__EXTERN__(Sfio_t *, sfstdout); -__EXTERN__(Sfio_t *, sfstderr); +extern ssize_t _Sfi; +extern Sfio_t _Sfstdin; +extern Sfio_t _Sfstdout; +extern Sfio_t _Sfstderr; +extern Sfio_t *sfstdin; +extern Sfio_t *sfstdout; +extern Sfio_t *sfstderr; diff --git a/lib/vmalloc/features/common b/lib/vmalloc/features/common index fce0e3593..7f27e5526 100644 --- a/lib/vmalloc/features/common +++ b/lib/vmalloc/features/common @@ -108,16 +108,6 @@ cat{ #endif /*_astimport*/ }end -cat{ - #if !_DLL_BLD && _dll_import - #define __EXTERN__(T,obj) extern T obj; T* _imp__ ## obj = &obj - #define __DEFINE__(T,obj,val) T obj = val; T* _imp__ ## obj = &obj - #else - #define __EXTERN__(T,obj) extern T obj - #define __DEFINE__(T,obj,val) T obj = val - #endif -}end - cat{ #ifndef _AST_STD_H # if _hdr_stddef diff --git a/lib/vmalloc/vmbest.c b/lib/vmalloc/vmbest.c index 7cff84123..92fb55328 100644 --- a/lib/vmalloc/vmbest.c +++ b/lib/vmalloc/vmbest.c @@ -1179,7 +1179,7 @@ static Vmalloc_t _Vmheap = { NIL(Vmalloc_t *) /* next */ }; -__DEFINE__(Vmalloc_t *, Vmheap, &_Vmheap); -__DEFINE__(Vmalloc_t *, Vmregion, &_Vmheap); -__DEFINE__(Vmethod_t *, Vmbest, &_Vmbest); -__DEFINE__(Vmdisc_t *, Vmdcsbrk, &_Vmdcsbrk); +Vmalloc_t* Vmheap = &_Vmheap; +Vmalloc_t* Vmregion = &_Vmheap; +Vmethod_t* Vmbest = &_Vmbest; +Vmdisc_t* Vmdcsbrk = &_Vmdcsbrk; diff --git a/lib/vmalloc/vmdcheap.c b/lib/vmalloc/vmdcheap.c index 6967999a0..1bf1f0cad 100644 --- a/lib/vmalloc/vmdcheap.c +++ b/lib/vmalloc/vmdcheap.c @@ -40,4 +40,4 @@ static Void_t *heapmem(Vmalloc_t * vm, Void_t * caddr, static Vmdisc_t _Vmdcheap = { heapmem, NIL(Vmexcept_f), 0 }; -__DEFINE__(Vmdisc_t *, Vmdcheap, &_Vmdcheap); +Vmdisc_t* Vmdcheap = &_Vmdcheap; diff --git a/lib/vmalloc/vmdebug.c b/lib/vmalloc/vmdebug.c index b8e0f11c3..05d36594a 100644 --- a/lib/vmalloc/vmdebug.c +++ b/lib/vmalloc/vmdebug.c @@ -651,4 +651,4 @@ static Vmethod_t _Vmdebug = { VM_MTDEBUG }; -__DEFINE__(Vmethod_t *, Vmdebug, &_Vmdebug); +Vmethod_t* Vmdebug = &_Vmdebug; diff --git a/lib/vmalloc/vmlast.c b/lib/vmalloc/vmlast.c index bd6b376e8..c46757368 100644 --- a/lib/vmalloc/vmlast.c +++ b/lib/vmalloc/vmlast.c @@ -396,4 +396,4 @@ static Vmethod_t _Vmlast = { VM_MTLAST }; -__DEFINE__(Vmethod_t *, Vmlast, &_Vmlast); +Vmethod_t* Vmlast = &_Vmlast; diff --git a/lib/vmalloc/vmpool.c b/lib/vmalloc/vmpool.c index 133e57212..09e6c2077 100644 --- a/lib/vmalloc/vmpool.c +++ b/lib/vmalloc/vmpool.c @@ -279,4 +279,4 @@ static Vmethod_t _Vmpool = { VM_MTPOOL }; -__DEFINE__(Vmethod_t *, Vmpool, &_Vmpool); +Vmethod_t* Vmpool = &_Vmpool; diff --git a/lib/vmalloc/vmprofile.c b/lib/vmalloc/vmprofile.c index 8d8a8b657..38dd357c1 100644 --- a/lib/vmalloc/vmprofile.c +++ b/lib/vmalloc/vmprofile.c @@ -627,4 +627,4 @@ static Vmethod_t _Vmprofile = { VM_MTPROFILE }; -__DEFINE__(Vmethod_t *, Vmprofile, &_Vmprofile); +Vmethod_t* Vmprofile = &_Vmprofile; diff --git a/windows/include/ast_common.h b/windows/include/ast_common.h index dc03822c6..6d552f6a9 100644 --- a/windows/include/ast_common.h +++ b/windows/include/ast_common.h @@ -84,13 +84,6 @@ #define _astimport extern #endif #endif /*_astimport*/ -#if !defined(_DLL_BLD) && defined(_dll_import) -#define __EXTERN__(T,obj) extern T obj; T* _imp__ ## obj = &obj -#define __DEFINE__(T,obj,val) T obj = val; T* _imp__ ## obj = &obj -#else -#define __EXTERN__(T,obj) extern T obj -#define __DEFINE__(T,obj,val) T obj = val -#endif #ifndef _AST_STD_H # if _hdr_stddef # include