From 241ad90b549e42542349964d1b78ce7334e35ad9 Mon Sep 17 00:00:00 2001 From: OBattler Date: Tue, 12 May 2020 13:36:47 +0200 Subject: [PATCH] Got rid of a lot of incorrect variable declaration and missing extern's, 86Box now successfully links when compiled with GCC 10.x. --- src/cpu/codegen_ops.h | 4 ++-- src/cpu_common/386_common.c | 11 ++++------ src/cpu_common/x87.c | 4 ++++ src/cpu_common/x87.h | 4 ++-- src/include/86box/mem.h | 2 +- src/include/86box/plat.h | 14 ++++++------- src/include/86box/video.h | 40 ++++++++++++++++++------------------- src/pc.c | 15 +++++++++++--- src/video/video.c | 1 - src/win/Makefile.mingw | 5 +---- src/win/Makefile_ndr.mingw | 5 +---- src/win/win_ui.c | 4 ++-- 12 files changed, 56 insertions(+), 53 deletions(-) diff --git a/src/cpu/codegen_ops.h b/src/cpu/codegen_ops.h index 53f5b34d2..fe54cb9a4 100644 --- a/src/cpu/codegen_ops.h +++ b/src/cpu/codegen_ops.h @@ -15,8 +15,8 @@ extern RecompOpFn recomp_opcodes_dc[512]; extern RecompOpFn recomp_opcodes_dd[512]; extern RecompOpFn recomp_opcodes_de[512]; extern RecompOpFn recomp_opcodes_df[512]; -RecompOpFn recomp_opcodes_REPE[512]; -RecompOpFn recomp_opcodes_REPNE[512]; +extern RecompOpFn recomp_opcodes_REPE[512]; +extern RecompOpFn recomp_opcodes_REPNE[512]; #define REG_EAX 0 #define REG_ECX 1 diff --git a/src/cpu_common/386_common.c b/src/cpu_common/386_common.c index c552faef3..47db7c5db 100644 --- a/src/cpu_common/386_common.c +++ b/src/cpu_common/386_common.c @@ -37,11 +37,6 @@ uint32_t dr[8]; uint32_t use32; int stack32; -int optype; - -int trap; - -uint32_t rmdat; uint32_t *eal_r, *eal_w; @@ -57,8 +52,10 @@ uint16_t cpu_cur_status = 0; uint32_t cpu_cur_status = 0; #endif -uint32_t pccache; -uint8_t *pccache2; +extern uint8_t *pccache2; + +extern int optype; +extern uint32_t pccache; int in_sys = 0; diff --git a/src/cpu_common/x87.c b/src/cpu_common/x87.c index 8183f2e3e..47ab0c844 100644 --- a/src/cpu_common/x87.c +++ b/src/cpu_common/x87.c @@ -17,6 +17,10 @@ #include "386_common.h" +uint32_t x87_pc_off,x87_op_off; +uint16_t x87_pc_seg,x87_op_seg; + + #ifdef ENABLE_FPU_LOG int fpu_do_log = ENABLE_FPU_LOG; diff --git a/src/cpu_common/x87.h b/src/cpu_common/x87.h index 106e8c23c..9436d0447 100644 --- a/src/cpu_common/x87.h +++ b/src/cpu_common/x87.h @@ -3,8 +3,8 @@ #define C2 (1<<10) #define C3 (1<<14) -uint32_t x87_pc_off,x87_op_off; -uint16_t x87_pc_seg,x87_op_seg; +extern uint32_t x87_pc_off,x87_op_off; +extern uint16_t x87_pc_seg,x87_op_seg; static __inline void x87_set_mmx() { diff --git a/src/include/86box/mem.h b/src/include/86box/mem.h index 14fc391a3..3abcdb44c 100644 --- a/src/include/86box/mem.h +++ b/src/include/86box/mem.h @@ -178,7 +178,7 @@ extern uintptr_t *writelookup2; extern int writelnext; extern uint32_t ram_mapped_addr[64]; -mem_mapping_t base_mapping, +extern mem_mapping_t base_mapping, ram_low_mapping, #if 1 ram_mid_mapping, diff --git a/src/include/86box/plat.h b/src/include/86box/plat.h index a2590350d..2033ef02f 100644 --- a/src/include/86box/plat.h +++ b/src/include/86box/plat.h @@ -62,17 +62,17 @@ extern "C" { #endif /* Global variables residing in the platform module. */ -GLOBAL int dopause, /* system is paused */ +extern int dopause, /* system is paused */ doresize, /* screen resize requested */ quited, /* system exit requested */ mouse_capture; /* mouse is captured in app */ -GLOBAL uint64_t timer_freq; -GLOBAL int infocus; -GLOBAL char emu_version[200]; /* version ID string */ -GLOBAL int rctrl_is_lalt; -GLOBAL int update_icons; +extern uint64_t timer_freq; +extern int infocus; +extern char emu_version[200]; /* version ID string */ +extern int rctrl_is_lalt; +extern int update_icons; -GLOBAL int unscaled_size_x, /* current unscaled size X */ +extern int unscaled_size_x, /* current unscaled size X */ unscaled_size_y; /* current unscaled size Y */ /* System-related functions. */ diff --git a/src/include/86box/video.h b/src/include/86box/video.h index 230d9623b..ecc4242e2 100644 --- a/src/include/86box/video.h +++ b/src/include/86box/video.h @@ -292,26 +292,26 @@ extern const device_t paradise_wd90c11_device; extern const device_t paradise_wd90c30_device; /* S3 9XX/8XX/Vision/Trio */ -const device_t s3_orchid_86c911_isa_device; -const device_t s3_metheus_premier_86c928_isa_device; -const device_t s3_metheus_premier_86c928_vlb_device; -const device_t s3_v7mirage_86c801_isa_device; -const device_t s3_phoenix_86c805_vlb_device; -const device_t s3_bahamas64_vlb_device; -const device_t s3_bahamas64_pci_device; -const device_t s3_9fx_vlb_device; -const device_t s3_9fx_pci_device; -const device_t s3_phoenix_trio32_vlb_device; -const device_t s3_phoenix_trio32_pci_device; -const device_t s3_phoenix_trio64_vlb_device; -const device_t s3_phoenix_trio64_onboard_pci_device; -const device_t s3_phoenix_trio64_pci_device; -const device_t s3_phoenix_vision864_pci_device; -const device_t s3_phoenix_vision864_vlb_device; -const device_t s3_diamond_stealth64_pci_device; -const device_t s3_diamond_stealth64_vlb_device; -const device_t s3_diamond_stealth64_964_pci_device; -const device_t s3_diamond_stealth64_964_vlb_device; +extern const device_t s3_orchid_86c911_isa_device; +extern const device_t s3_metheus_premier_86c928_isa_device; +extern const device_t s3_metheus_premier_86c928_vlb_device; +extern const device_t s3_v7mirage_86c801_isa_device; +extern const device_t s3_phoenix_86c805_vlb_device; +extern const device_t s3_bahamas64_vlb_device; +extern const device_t s3_bahamas64_pci_device; +extern const device_t s3_9fx_vlb_device; +extern const device_t s3_9fx_pci_device; +extern const device_t s3_phoenix_trio32_vlb_device; +extern const device_t s3_phoenix_trio32_pci_device; +extern const device_t s3_phoenix_trio64_vlb_device; +extern const device_t s3_phoenix_trio64_onboard_pci_device; +extern const device_t s3_phoenix_trio64_pci_device; +extern const device_t s3_phoenix_vision864_pci_device; +extern const device_t s3_phoenix_vision864_vlb_device; +extern const device_t s3_diamond_stealth64_pci_device; +extern const device_t s3_diamond_stealth64_vlb_device; +extern const device_t s3_diamond_stealth64_964_pci_device; +extern const device_t s3_diamond_stealth64_964_vlb_device; /* S3 ViRGE */ extern const device_t s3_virge_vlb_device; diff --git a/src/pc.c b/src/pc.c index 55c0f8356..9bc25aa54 100644 --- a/src/pc.c +++ b/src/pc.c @@ -78,6 +78,15 @@ #include <86box/plat_midi.h> +/* Stuff that used to be globally declared in plat.h but is now extern there + and declared here instead. */ +int dopause, /* system is paused */ + doresize, /* screen resize requested */ + quited; /* system exit requested */ +uint64_t timer_freq; +char emu_version[200]; /* version ID string */ + + /* Commandline options. */ int dump_on_exit = 0; /* (O) dump regs on exit */ int do_dump_config = 0; /* (O) dump config on load */ @@ -101,7 +110,7 @@ int window_w, window_h, /* (C) window size and */ window_x, window_y, /* position info */ window_remember, vid_resize, /* (C) allow resizing */ - invert_display, /* (C) invert the display */ + invert_display = 0, /* (C) invert the display */ suppress_overscan = 0; /* (C) suppress overscans */ int scale = 0; /* (C) screen scale factor */ int vid_api = 0; /* (C) video renderer */ @@ -141,8 +150,8 @@ extern int int fps, framecount; /* emulator % */ -int CPUID; -int output; +extern int CPUID; +extern int output; int atfullspeed; int clockrate; diff --git a/src/video/video.c b/src/video/video.c index 4a168d41c..ce77e9abf 100644 --- a/src/video/video.c +++ b/src/video/video.c @@ -109,7 +109,6 @@ int video_res_x = 0, video_res_y = 0, video_bpp = 0; static int video_force_resize; -int invert_display = 0; int video_grayscale = 0; int video_graytype = 0; static int vid_type; diff --git a/src/win/Makefile.mingw b/src/win/Makefile.mingw index cebd6d8d3..988516764 100644 --- a/src/win/Makefile.mingw +++ b/src/win/Makefile.mingw @@ -27,9 +27,6 @@ endif ifndef DEV_BUILD DEV_BUILD := n endif -ifndef FLTO -FLTO := full -endif ifeq ($(DEV_BUILD), y) ifndef DEBUG @@ -320,7 +317,7 @@ else ifeq ($(OPTIM), y) AOPTIM := -mtune=native ifndef COPTIM - COPTIM := -O3 -ffp-contract=fast -flto=$(FLTO) + COPTIM := -O3 -ffp-contract=fast -flto endif else ifndef COPTIM diff --git a/src/win/Makefile_ndr.mingw b/src/win/Makefile_ndr.mingw index e33767ad4..ef8cd30bc 100644 --- a/src/win/Makefile_ndr.mingw +++ b/src/win/Makefile_ndr.mingw @@ -27,9 +27,6 @@ endif ifndef DEV_BUILD DEV_BUILD := n endif -ifndef FLTO -FLTO := full -endif ifeq ($(DEV_BUILD), y) ifndef DEBUG @@ -317,7 +314,7 @@ else ifeq ($(OPTIM), y) AOPTIM := -mtune=native ifndef COPTIM - COPTIM := -O3 -ffp-contract=fast -flto=$(FLTO) + COPTIM := -O3 -ffp-contract=fast -flto endif else ifndef COPTIM diff --git a/src/win/win_ui.c b/src/win/win_ui.c index 814484a92..b33114ba2 100644 --- a/src/win/win_ui.c +++ b/src/win/win_ui.c @@ -59,8 +59,8 @@ int infocus = 1; int rctrl_is_lalt = 0; int user_resize = 0; -char openfilestring[512]; -WCHAR wopenfilestring[512]; +extern char openfilestring[512]; +extern WCHAR wopenfilestring[512]; /* Local data. */