1
0
mirror of https://github.com/simh/simh.git synced 2026-01-13 23:35:57 +00:00

Makefile and readline fix and additional compiler nits missed earlier

This commit is contained in:
Mark Pizzolato 2012-03-25 15:08:18 -07:00
parent 66c264d678
commit 8ebabd5f69
18 changed files with 83 additions and 70 deletions

View File

@ -122,7 +122,7 @@ DEVICE ptp_dev = {
/* service routine - actually gets char & places in buffer */
int32 sio_svc (UNIT *uptr)
t_stat sio_svc (UNIT *uptr)
{
int32 temp;
@ -139,12 +139,12 @@ int32 sio_svc (UNIT *uptr)
}
int32 ptr_svc (UNIT *uptr)
t_stat ptr_svc (UNIT *uptr)
{
return SCPE_OK;
}
int32 ptp_svc (UNIT *uptr)
t_stat ptp_svc (UNIT *uptr)
{
return SCPE_OK;
}
@ -152,7 +152,7 @@ int32 ptp_svc (UNIT *uptr)
/* Reset routine */
int32 sio_reset (DEVICE *dptr)
t_stat sio_reset (DEVICE *dptr)
{
sio_unit.buf = 0; /* Data */
sio_unit.u3 = 0x02; /* Status */
@ -161,7 +161,7 @@ int32 sio_reset (DEVICE *dptr)
}
int32 ptr_reset (DEVICE *dptr)
t_stat ptr_reset (DEVICE *dptr)
{
ptr_unit.buf = 0;
ptr_unit.u3 = 0x02;
@ -169,7 +169,7 @@ int32 ptr_reset (DEVICE *dptr)
return SCPE_OK;
}
int32 ptp_reset (DEVICE *dptr)
t_stat ptp_reset (DEVICE *dptr)
{
ptp_unit.buf = 0;
ptp_unit.u3 = 0x02;

View File

@ -197,7 +197,7 @@ int32 int_mask; /* current active interrupt mask (ipl sensitive) */
int32 mem_mask; /* mask for memory address bits based on current memory size */
int32 cpu_dsw = 0; /* CPU device status word */
int32 ibkpt_addr = -1; /* breakpoint addr */
int32 sim_gui = TRUE; /* enable gui */
t_bool sim_gui = TRUE; /* enable gui */
t_bool running = FALSE; /* TRUE if CPU is running */
t_bool power = TRUE; /* TRUE if CPU power is on */
t_bool cgi = FALSE; /* TRUE if we are running as a CGI program */
@ -222,7 +222,7 @@ t_stat cpu_set_type (UNIT *uptr, int32 value, char *cptr, void *desc);
void calc_ints (void);
extern t_stat ts_wr (int32 data, int32 addr, int32 access);
extern t_stat detach_cmd (int flags, char *cptr);
extern t_stat detach_cmd (int32 flags, char *cptr);
extern UNIT cr_unit;
extern int32 sim_switches;
@ -230,7 +230,7 @@ extern int32 sim_switches;
static void archive_backtrace(char *inst);
static void reset_backtrace (void);
static void show_backtrace (int nshow);
static t_stat backtrace_cmd (int flag, char *cptr);
static t_stat backtrace_cmd (int32 flag, char *cptr);
#else
#define archive_backtrace(inst)
#define reset_backtrace()
@ -245,7 +245,7 @@ extern int32 sim_switches;
static void init_console_window (void);
static void destroy_console_window (void);
static t_stat view_cmd (int flag, char *cptr);
static t_stat view_cmd (int32 flag, char *cptr);
static t_stat cpu_attach (UNIT *uptr, char *cptr);
static t_bool bsctest (int32 DSPLC, t_bool reset_V);
static void exit_irq (void);
@ -1556,7 +1556,7 @@ static void show_backtrace (int nshow)
putchar('\n');
}
static t_stat backtrace_cmd (int flag, char *cptr)
static t_stat backtrace_cmd (int32 flag, char *cptr)
{
int n;
@ -1854,7 +1854,7 @@ void debug_print (char *fmt, ...)
/* view_cmd - let user view and/or edit a file (e.g. a printer output file, script, or source deck) */
static t_stat view_cmd (int flag, char *cptr)
static t_stat view_cmd (int32 flag, char *cptr)
{
#ifdef _WIN32
char cmdline[256];

View File

@ -951,7 +951,7 @@ t_stat load_cr_boot (int drvno, int switches)
return SCPE_OK;
}
t_stat cr_boot (int unitno, DEVICE *dptr)
t_stat cr_boot (int32 unitno, DEVICE *dptr)
{
t_stat rval;
int i;

View File

@ -27,7 +27,7 @@
#define MAX(a,b) (((a) >= (b)) ? (a) : (b))
#ifndef _WIN32
int strnicmp (const char *a, const char *b, int n);
int strnicmp (const char *a, const char *b, size_t n);
int strcmpi (const char *a, const char *b);
#endif
@ -47,7 +47,7 @@
extern int cgi; /* TRUE if we are running as a CGI program */
extern int cgiwritable; /* TRUE if we can write the disk images back to the image file in CGI mode */
extern int sim_gui;
extern t_bool sim_gui;
extern uint16 M[]; /* core memory, up to 32Kwords (note: don't even think about trying 64K) */
extern uint16 ILSW[]; /* interrupt level status words */
@ -269,7 +269,7 @@ void xio_error (char *msg);
void bail (char *msg);
t_stat load_cr_boot (int drv, int switches);
t_stat cr_boot (int unitno, DEVICE *dptr);
t_stat cr_boot (int32 unitno, DEVICE *dptr);
t_stat cr_rewind (void);
t_stat cr_detach (UNIT *uptr);
void calc_ints (void); /* recalculate interrupt bitmask */

View File

@ -43,9 +43,9 @@ extern int32 sim_switches;
extern int32 sim_quiet;
static int trace_dms = 0;
static void tracesector (int iswrite, int nwords, int addr, int sector);
static t_stat where_cmd (int flag, char *ptr);
static t_stat phdebug_cmd (int flag, char *ptr);
static t_stat fdump_cmd (int flags, char *cptr);
static t_stat where_cmd (int32 flag, char *ptr);
static t_stat phdebug_cmd (int32 flag, char *ptr);
static t_stat fdump_cmd (int32 flags, char *cptr);
static void enable_dms_tracing (int newsetting);
#endif
@ -91,7 +91,7 @@ static t_stat dsk_svc (UNIT *uptr);
static t_stat dsk_reset (DEVICE *dptr);
static t_stat dsk_attach (UNIT *uptr, char *cptr);
static t_stat dsk_detach (UNIT *uptr);
static t_stat dsk_boot (int unitno, DEVICE *dptr);
static t_stat dsk_boot (int32 unitno, DEVICE *dptr);
static void diskfail (UNIT *uptr, int dswflag, int unitflag, t_bool do_interrupt);
@ -571,7 +571,7 @@ static t_stat dsk_detach (UNIT *uptr)
/* boot routine - if they type BOOT DSK, load the standard boot card. */
static t_stat dsk_boot (int unitno, DEVICE *dptr)
static t_stat dsk_boot (int32 unitno, DEVICE *dptr)
{
t_stat rval;
@ -644,7 +644,7 @@ char * saywhere (int addr)
static int phdebug_lo = -1, phdebug_hi = -1;
static t_stat phdebug_cmd (int flag, char *ptr)
static t_stat phdebug_cmd (int32 flag, char *ptr)
{
int val1, val2;
@ -671,7 +671,7 @@ static t_stat phdebug_cmd (int flag, char *ptr)
return SCPE_OK;
}
static t_stat where_cmd (int flag, char *ptr)
static t_stat where_cmd (int32 flag, char *ptr)
{
int addr;
char *where;
@ -836,7 +836,7 @@ done:
savesector(addr, offset, nwords, phid, name);
}
static t_stat fdump_cmd (int flags, char *cptr)
static t_stat fdump_cmd (int32 flags, char *cptr)
{
int addr = 0x7a24; /* address of next statement */
int sofst = 0x7a26, symaddr;

View File

@ -637,7 +637,7 @@ static t_stat prt1403_svc(UNIT *uptr)
/* delete_cmd - SCP command to delete a file */
static t_stat delete_cmd (int flag, char *cptr)
static t_stat delete_cmd (int32 flag, char *cptr)
{
char gbuf[CBUFSIZE];
int status;

View File

@ -37,7 +37,7 @@ static t_stat ptr_svc (UNIT *uptr);
static t_stat ptr_reset (DEVICE *dptr);
static t_stat ptr_attach (UNIT *uptr, char *cptr);
static t_stat ptr_detach (UNIT *uptr);
static t_stat ptr_boot (int unitno, DEVICE *dptr);
static t_stat ptr_boot (int32 unitno, DEVICE *dptr);
static t_stat ptp_svc (UNIT *uptr);
static t_stat ptp_reset (DEVICE *dptr);
static t_stat ptp_attach (UNIT *uptr, char *cptr);
@ -228,7 +228,7 @@ static t_stat ptr_detach (UNIT *uptr)
/* ptr_attach - perform paper tape initial program load */
static t_stat ptr_boot (int unitno, DEVICE *dptr)
static t_stat ptr_boot (int32 unitno, DEVICE *dptr)
{
int ch, nch, val, addr;
t_bool leader = TRUE, start = FALSE;

View File

@ -5957,12 +5957,12 @@ int32 Debug_Entry(int32 PC, int32 inst, int32 inst2, int32 AC0, int32 AC1, int32
return 0;
}
int32 Debug_Dump(UNIT *uptr, int32 val, char *cptr, void *desc)
t_stat Debug_Dump(UNIT *uptr, int32 val, char *cptr, void *desc)
{
return SCPE_OK;
}
int32 Dump_History (FILE *st, UNIT *uptr, int32 val, void *desc)
t_stat Dump_History (FILE *st, UNIT *uptr, int32 val, void *desc)
{
char debmap[4], debion[4];
t_value simeval[20];

View File

@ -228,14 +228,14 @@
struct ndev {
int32 mask; /* done/busy mask */
int32 pi; /* assigned pi bit */
int32 (*routine)(); /* dispatch routine */
int32 (*routine)(int32, int32, int32); /* dispatch routine */
};
typedef struct {
int32 dnum; /* device number */
int32 mask; /* done/busy mask */
int32 pi; /* assigned pi bit */
int32 (*routine)(); /* dispatch routine */
int32 (*routine)(int32, int32, int32); /* dispatch routine */
} DIB;
/* Device flags (simulator representation)

View File

@ -861,7 +861,8 @@ return SCPE_ARG;
char *get_addr (char *cptr, t_addr addr, t_bool ext, int32 cflag, int32 *val)
{
int32 d, r, x, pflag;
int32 d, x, pflag;
t_stat r;
char gbuf[CBUFSIZE];
int32 dmax, dsign;

View File

@ -446,24 +446,24 @@ const d10 bytemask[64] = { 0,
ONES, ONES, ONES, ONES, ONES, ONES, ONES, ONES, ONES
};
static t_bool (*io700d[16])() = {
static t_bool (*io700d[16])(a10, int32) = {
&aprid, NULL, NULL, NULL, &wrapr, &rdapr, &czapr, &coapr,
NULL, NULL, NULL, NULL, &wrpi, &rdpi, &czpi, &copi
};
static t_bool (*io701d[16])() = {
static t_bool (*io701d[16])(a10, int32) = {
NULL, &rdubr, &clrpt, &wrubr, &wrebr, &rdebr, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
};
static t_bool (*io702d[16])() = {
static t_bool (*io702d[16])(a10, int32) = {
&rdspb, &rdcsb, &rdpur, &rdcstm, &rdtim, &rdint, &rdhsb, NULL,
&wrspb, &wrcsb, &wrpur, &wrcstm, &wrtim, &wrint, &wrhsb, NULL
};
#define io700i io700d
static t_bool (*io701i[16])() = {
static t_bool (*io701i[16])(a10, int32) = {
&clrcsh, &rdubr, &clrpt, &wrubr, &wrebr, &rdebr, NULL, NULL,
NULL, &rdpcst, NULL, &wrpcst, NULL, NULL, NULL, NULL
};
static t_bool (*io702i[16])() = {
static t_bool (*io702i[16])(a10, int32) = {
&sdbr1, &sdbr2, &sdbr3, &sdbr4, &rdtim, &rdint, &rdhsb, &spm,
&ldbr1, &ldbr2, &ldbr3, &ldbr4, &wrtim, &wrint, &wrhsb, &lpmr
};
@ -697,7 +697,7 @@ for ( ;; ) { /* loop until ABORT */
int32 op, ac, i, st, xr, xct_cnt, its_2pr, pflgs;
a10 ea;
d10 inst, mb, indrct, rs[2];
t_bool (*fptr)();
t_bool (*fptr)(int32, int32);
pager_PC = PC; /* update pager PC */
pager_tc = FALSE; /* not in trap cycle */

View File

@ -67,7 +67,7 @@
struct ndev {
int32 level; /* interrupt level */
int32 pri; /* Device priority */
int32 (*routine)(); /* dispatch routine */
int32 (*routine)(int32, int32, int32, int32); /* dispatch routine */
};
/* Structure to define operation codes */

View File

@ -214,7 +214,7 @@ t_stat (*iodispW[IOPAGESIZE >> 1])(int32 dat, int32 ad, int32 md);
/* Unibus interrupt request to interrupt action map */
int32 (*int_ack[IPL_HLVL][32])(); /* int ack routines */
int32 (*int_ack[IPL_HLVL][32])(void); /* int ack routines */
/* Unibus interrupt request to vector map */

View File

@ -188,7 +188,7 @@ t_stat (*iodispW[IOPAGESIZE >> 1])(int32 dat, int32 ad, int32 md);
/* Interrupt request to interrupt action map */
int32 (*int_ack[IPL_HLVL][32])(); /* int ack routines */
int32 (*int_ack[IPL_HLVL][32])(void); /* int ack routines */
/* Interrupt request to vector map */

View File

@ -378,7 +378,7 @@ HP2100_SOURCE1 = $(HP2100_DIR)HP2100_STDDEV.C,$(HP2100_DIR)HP2100_DP.C,\
$(HP2100_DIR)HP2100_CPU6.C,$(HP2100_DIR)HP2100_CPU7.C
HP2100_LIB2 = $(LIB_DIR)HP2100L2-$(ARCH).OLB
HP2100_SOURCE2 = $(HP2100_DIR)HP2100_FP1.C,$(HP2100_DIR)HP2100_BACI.C,\
$(HP2100_DIR)HP2100_MPX.C,$(HP2100_DIR)HP2100_PIF.C \
$(HP2100_DIR)HP2100_MPX.C,$(HP2100_DIR)HP2100_PIF.C,\
$(HP2100_DIR)HP2100_DI.C,$(HP2100_DIR)HP2100_DI_DA.C,\
$(HP2100_DIR)HP_DISCLIB.C
.IFDEF ALPHA_OR_IA64

View File

@ -28,18 +28,18 @@
# building the pdp11, or any vax simulator could use networking support
# No Asynch I/O support for now.
NOASYNCH = 1
BUILD_SINGLE := $(MAKECMDGOALS) $(BLANK_PREFIX)
ifneq (,$(or $(findstring pdp11,$(MAKECMDGOALS)),$(findstring vax,$(MAKECMDGOALS)),$(findstring all,$(MAKECMDGOALS))))
NETWORK_USEFUL = true
ifneq (,$(findstring all,$(MAKECMDGOALS))$(word 2,$(MAKECMDGOALS)))
BUILD_MULTIPLE = (s)
else
BUILD_SINGLE := $(MAKECMDGOALS) $(BUILD_SINGLE)
BUILD_MULTIPLE = s
endif
else
ifeq ($(MAKECMDGOALS),)
# default target is all
NETWORK_USEFUL = true
BUILD_MULTIPLE = (s)
BUILD_MULTIPLE = s
BUILD_SINGLE := all $(BLANK_PREFIX)
endif
endif
ifeq ($(WIN32),) #*nix Environments (&& cygwin)
@ -58,7 +58,7 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin)
OSTYPE = cygwin
OSNAME = windows-build
endif
GCC_VERSION = $(shell $(GCC) --version /dev/null | grep GCC | awk '{ print $$3 }')
GCC_VERSION = $(shell $(GCC) -v /dev/null 2>&1 | grep 'gcc version' | awk '{ print $$3 }')
LTO_EXCLUDE_VERSIONS =
PCAPLIB = pcap
ifeq (agcc,$(findstring agcc,$(GCC))) # Android target build?
@ -74,6 +74,8 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin)
ifeq (Darwin,$(OSTYPE))
OSNAME = OSX
LIBEXT = dylib
GCC_OPTIMIZERS_CMD = $(GCC) -v --help 2>&1
GCC_WARNINGS_CMD = $(GCC) -v --help 2>&1
else
ifeq (Linux,$(OSTYPE))
LIBPATH := $(sort $(foreach lib,$(shell /sbin/ldconfig -p | grep ' => /' | sed 's/^.* => //'),$(dir $(lib))))
@ -202,8 +204,8 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin)
else
$(error using libpcap: $(call find_lib,$(PCAPLIB)) missing pcap.h)
endif
LIBEXT = $(LIBEXTSAVE)
endif
LIBEXT = $(LIBEXTSAVE)
endif
ifneq (,$(findstring USE_NETWORK,$(NETWORK_CCDEFS))$(findstring USE_SHARED,$(NETWORK_CCDEFS)))
# Given we have libpcap components, consider other network connections as well
@ -294,31 +296,34 @@ else
LDFLAGS_O =
GCC_MAJOR_VERSION = $(firstword $(subst ., ,$(GCC_VERSION)))
ifneq (3,$(GCC_MAJOR_VERSION))
GCC_OPTIMIZERS = $(shell $(GCC) --help=optimizers)
ifeq (,$(GCC_OPTIMIZERS_CMD))
GCC_OPTIMIZERS_CMD = $(GCC) --help=optimizers
endif
GCC_OPTIMIZERS = $(shell $(GCC_OPTIMIZERS_CMD))
endif
ifneq (,$(findstring $(GCC_VERSION),$(LTO_EXCLUDE_VERSIONS)))
NO_LTO = 1
endif
ifneq (,$(findstring inline-functions,$(GCC_OPTIMIZERS)))
ifneq (,$(findstring -finline-functions,$(GCC_OPTIMIZERS)))
CFLAGS_O += -finline-functions
endif
ifneq (,$(findstring gcse-after-reload,$(GCC_OPTIMIZERS)))
ifneq (,$(findstring -fgcse-after-reload,$(GCC_OPTIMIZERS)))
CFLAGS_O += -fgcse-after-reload
endif
ifneq (,$(findstring predictive-commoning,$(GCC_OPTIMIZERS)))
ifneq (,$(findstring -fpredictive-commoning,$(GCC_OPTIMIZERS)))
CFLAGS_O += -fpredictive-commoning
endif
ifneq (,$(findstring ipa-cp-clone,$(GCC_OPTIMIZERS)))
ifneq (,$(findstring -fipa-cp-clone,$(GCC_OPTIMIZERS)))
CFLAGS_O += -fipa-cp-clone
endif
ifneq (,$(findstring unsafe-loop-optimizations,$(GCC_OPTIMIZERS)))
ifneq (,$(findstring -funsafe-loop-optimizations,$(GCC_OPTIMIZERS)))
CFLAGS_O += -fno-unsafe-loop-optimizations
endif
ifneq (,$(findstring strict-overflow,$(GCC_OPTIMIZERS)))
ifneq (,$(findstring -fstrict-overflow,$(GCC_OPTIMIZERS)))
CFLAGS_O += -fno-strict-overflow
endif
ifeq (,$(NO_LTO))
ifneq (,$(findstring lto,$(GCC_OPTIMIZERS)))
ifneq (,$(findstring -flto,$(GCC_OPTIMIZERS)))
CFLAGS_O += -flto -fwhole-program
LDFLAGS_O += -flto -fwhole-program
endif
@ -326,18 +331,23 @@ else
BUILD_FEATURES = - compiler optimizations and no debugging support
endif
ifneq (3,$(GCC_MAJOR_VERSION))
ifneq (,$(findstring unused-result,$(shell $(GCC) --help=warnings)))
ifeq (,$(GCC_WARNINGS_CMD))
GCC_WARNINGS_CMD = $(GCC) --help=warnings
endif
ifneq (,$(findstring -Wunused-result,$(shell $(GCC_WARNINGS_CMD))))
CFLAGS_O += -Wno-unused-result
endif
endif
BUILD_FEATURES := $(BUILD_FEATURES). GCC Version: $(GCC_VERSION)
$(info ***)
$(info *** $(BUILD_SINGLE)Simulator$(BUILD_MULTIPLE) being built with:)
$(info *** $(BUILD_FEATURES).)
ifneq (,$(NETWORK_FEATURES))
$(info *** $(NETWORK_FEATURES).)
ifneq (clean,$(MAKECMDGOALS))
BUILD_FEATURES := $(BUILD_FEATURES). GCC Version: $(GCC_VERSION)
$(info ***)
$(info *** $(BUILD_SINGLE)Simulator$(BUILD_MULTIPLE) being built with:)
$(info *** $(BUILD_FEATURES).)
ifneq (,$(NETWORK_FEATURES))
$(info *** $(NETWORK_FEATURES).)
endif
$(info ***)
endif
$(info ***)
ifneq ($(DONT_USE_READER_THREAD),)
NETWORK_OPT += -DDONT_USE_READER_THREAD
endif

2
scp.c
View File

@ -3463,6 +3463,8 @@ if (!initialized) {
handle = dlopen("libreadline." __STR(HAVE_DLOPEN), RTLD_NOW|RTLD_GLOBAL);
if (!handle)
handle = dlopen("libreadline." __STR(HAVE_DLOPEN) ".6", RTLD_NOW|RTLD_GLOBAL);
if (!handle)
handle = dlopen("libreadline." __STR(HAVE_DLOPEN) ".5", RTLD_NOW|RTLD_GLOBAL);
if (handle) {
p_readline = dlsym(handle, "readline");
p_add_history = dlsym(handle, "add_history");

View File

@ -114,7 +114,7 @@ int32 ptp_flag = 0, ptr_flag = 0;
/* console input service routine */
int32 sio_svc (UNIT *uptr)
t_stat sio_svc (UNIT *uptr)
{
int32 temp;
@ -132,21 +132,21 @@ int32 sio_svc (UNIT *uptr)
/* paper tape reader input service routine */
int32 ptr_svc (UNIT *uptr)
t_stat ptr_svc (UNIT *uptr)
{
return SCPE_OK;
}
/* paper tape punch output service routine */
int32 ptp_svc (UNIT *uptr)
t_stat ptp_svc (UNIT *uptr)
{
return SCPE_OK;
}
/* Reset console */
int32 sio_reset (DEVICE *dptr)
t_stat sio_reset (DEVICE *dptr)
{
sio_unit.buf = 0; // Data buffer
sio_unit.u3 = 0x02; // Status buffer
@ -156,7 +156,7 @@ int32 sio_reset (DEVICE *dptr)
/* Reset paper tape reader */
int32 ptr_reset (DEVICE *dptr)
t_stat ptr_reset (DEVICE *dptr)
{
ptr_unit.buf = 0;
ptr_unit.u3 = 0x02;
@ -166,7 +166,7 @@ int32 ptr_reset (DEVICE *dptr)
/* Reset paper tape punch */
int32 ptp_reset (DEVICE *dptr)
t_stat ptp_reset (DEVICE *dptr)
{
ptp_unit.buf = 0;
ptp_unit.u3 = 0x02;