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).
This commit is contained in:
Alexey Dokuchaev 2023-02-23 13:20:00 +00:00
parent 60194bbd3a
commit e3df77b3ab
4 changed files with 85 additions and 0 deletions

View file

@ -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;

View file

@ -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

View file

@ -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;

View file

@ -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!!!