remove #define EXTERN trick in cgraph
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 14 Aug 2020 03:11:39 +0000 (20:11 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 10 Sep 2020 02:26:50 +0000 (19:26 -0700)
This was designed to allow one declaration of Ag_G_global serve as both
declaration and definition. However, this obscures the actual definition of this
variable from any code browser unable to evaluate macro expansion (e.g. Cscope).
There's no real need for this trick, as we can just define the variable as
normal.

lib/cgraph/cghdr.h
lib/cgraph/graph.c

index db195d5db16aa74d8dd9394245c22aeb4215263d..131efbadfd2a72daf9673b9e71b604cdabb79922 100644 (file)
 #define ATT_GRAPHPVT_H 1
 #define _BLD_cgraph 1
 
-#ifndef EXTERN
-#define EXTERN extern
-#endif
-
 #ifdef _WIN32
 #   ifdef EXPORT_CGHDR
 #       define CGHDR_API __declspec(dllexport)
@@ -75,7 +71,7 @@ CGHDR_API int agapply(Agraph_t * g, Agobj_t * obj, agobjfn_t fn, void *arg,
            int preorder);
 
        /* global variables */
-EXTERN Agraph_t *Ag_G_global;
+extern Agraph_t *Ag_G_global;
 extern char *AgDataRecName;
 
        /* set ordering disciplines */
index 453ac52c2910c9673d586387ae9ea9ac9f0a9bd4..0d9dbac378c38691f79d7be05b3f3de1ed451a41 100644 (file)
  * Contributors: See CVS logs. Details at http://www.graphviz.org/
  *************************************************************************/
 
-#define EXTERN
 #include <cghdr.h>
 
+Agraph_t *Ag_G_global;
+
 const char AgraphVersion[] = PACKAGE_VERSION;
 
 /*