git: e3df77b3abbd - main - cad/geda: make the port's code consumable by contemporary compilers

From: Alexey Dokuchaev <danfe_at_FreeBSD.org>
Date: Thu, 23 Feb 2023 13:23:15 UTC
The branch main has been updated by danfe:

URL: https://cgit.FreeBSD.org/ports/commit/?id=e3df77b3abbd33bed8c5c7cacad4a3a242bde13f

commit e3df77b3abbd33bed8c5c7cacad4a3a242bde13f
Author:     Alexey Dokuchaev <danfe@FreeBSD.org>
AuthorDate: 2023-02-23 13:20:00 +0000
Commit:     Alexey Dokuchaev <danfe@FreeBSD.org>
CommitDate: 2023-02-23 13:20:00 +0000

    cad/geda: make the port's code consumable by contemporary compilers
    
    Ensure that there is only one variable definition per each object, as
    the C (and C++) standards mandated for years and compilers started to
    enforce as of recently (Clang 11, GCC 10).
---
 cad/geda/files/patch-gattrib_include_globals.h    | 45 +++++++++++++++++++++++
 cad/geda/files/patch-gattrib_src_gtksheet__2__2.c | 19 ++++++++++
 cad/geda/files/patch-gschem_include_globals.h     | 11 ++++++
 cad/geda/files/patch-gschem_src_x__menus.c        | 10 +++++
 4 files changed, 85 insertions(+)

diff --git a/cad/geda/files/patch-gattrib_include_globals.h b/cad/geda/files/patch-gattrib_include_globals.h
new file mode 100644
index 000000000000..718645dda80a
--- /dev/null
+++ b/cad/geda/files/patch-gattrib_include_globals.h
@@ -0,0 +1,45 @@
+--- gattrib/include/globals.h.orig	2013-08-18 17:02:48 UTC
++++ gattrib/include/globals.h
+@@ -76,7 +76,7 @@
+  * structs.h
+  */
+ /*------------------------------------------------------------------*/
+-TOPLEVEL *pr_current;
++extern TOPLEVEL *pr_current;
+ 
+ /*------------------------------------------------------------------*/
+ /*!
+@@ -85,7 +85,7 @@ TOPLEVEL *pr_current;
+  * callbacks.  It is defined in structs.h
+  */
+ /*------------------------------------------------------------------*/
+-SHEET_DATA *sheet_head;
++extern SHEET_DATA *sheet_head;
+ 
+ /*------------------------------------------------------------------
+  * GTKsheet includes: stuff for dealing with windows.
+@@ -94,18 +94,14 @@ SHEET_DATA *sheet_head;
+ #define DEFAULT_SPACE 8
+ #define NUM_SHEETS 3            /* Components, Nets, and Pins */
+ 
+-GtkWidget *window;              /* Main window */
+-GtkWidget *notebook;
++extern GtkWidget *window;       /* Main window */
++extern GtkWidget *notebook;
+ 
+-GtkSheet **sheets;             /* These are the spreadsheet widgets themselves */
++extern GtkSheet **sheets;      /* These are the spreadsheet widgets themselves */
+ 
+-GtkWidget **scrolled_windows;
+-GtkWidget *entry;
+-GtkWidget *location;
+-GtkWidget *left_button;
+-GtkWidget *center_button;
+-GtkWidget *right_button;
+-GtkWidget *label;
++extern GtkWidget **scrolled_windows;
++extern GtkWidget *entry;
++extern GtkWidget *label;
+ 
+ /* command line switch settings */
+ extern int verbose_mode;
diff --git a/cad/geda/files/patch-gattrib_src_gtksheet__2__2.c b/cad/geda/files/patch-gattrib_src_gtksheet__2__2.c
new file mode 100644
index 000000000000..570f38d55957
--- /dev/null
+++ b/cad/geda/files/patch-gattrib_src_gtksheet__2__2.c
@@ -0,0 +1,19 @@
+--- gattrib/src/gtksheet_2_2.c.orig	2013-09-25 20:59:27 UTC
++++ gattrib/src/gtksheet_2_2.c
+@@ -57,6 +57,16 @@
+ #include "../include/prototype.h"  /* function prototypes */
+ #include "../include/globals.h"
+ 
++TOPLEVEL *pr_current;
++SHEET_DATA *sheet_head;
++
++GtkWidget *window;
++GtkWidget *notebook;
++GtkSheet **sheets;
++GtkWidget **scrolled_windows;
++GtkWidget *entry;
++GtkWidget *label;
++
+ #ifdef HAVE_LIBDMALLOC
+ #include <dmalloc.h>
+ #endif
diff --git a/cad/geda/files/patch-gschem_include_globals.h b/cad/geda/files/patch-gschem_include_globals.h
new file mode 100644
index 000000000000..d1f7c3773ede
--- /dev/null
+++ b/cad/geda/files/patch-gschem_include_globals.h
@@ -0,0 +1,11 @@
+--- gschem/include/globals.h.orig	2013-08-18 17:02:48 UTC
++++ gschem/include/globals.h
+@@ -27,7 +27,7 @@
+ extern GList *global_window_list;
+ 
+ /* Manager for recently used files */
+-GtkRecentManager *recent_manager;
++extern GtkRecentManager *recent_manager;
+ 
+ /* colors */
+ extern GdkColor white;
diff --git a/cad/geda/files/patch-gschem_src_x__menus.c b/cad/geda/files/patch-gschem_src_x__menus.c
new file mode 100644
index 000000000000..095d13c8f874
--- /dev/null
+++ b/cad/geda/files/patch-gschem_src_x__menus.c
@@ -0,0 +1,10 @@
+--- gschem/src/x_menus.c.orig	2013-09-25 20:59:27 UTC
++++ gschem/src/x_menus.c
+@@ -58,6 +58,7 @@ static GtkItemFactoryEntry popup_items[] = {
+   {N_("/Up"),             NULL, i_callback_hierarchy_up,             0, NULL},
+ };  
+ 
++GtkRecentManager *recent_manager;
+ int npopup_items = sizeof(popup_items) / sizeof(popup_items[0]);
+ 
+ /*! \todo Finish function documentation!!!