Merge pull request #264 from davidgiven/dtrg-fixes

Fix or silence a lot of annoying build warnings.
This commit is contained in:
David Given 2022-08-01 22:37:19 +02:00 committed by GitHub
commit 50d3354ccb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 118 additions and 98 deletions

View file

@ -288,7 +288,10 @@ void con_float(void)
fprintf(codefile, "!float %s sz %d\n", str, (int)argval);
if (rval == 2)
{
fprintf(stderr, "Warning: overflow in floating point constant %s\n", str);
/* If this is enabled, it causes huge amounts of build system spam, so
* I've silenced it. dtrg 2022-08-01 */
/* fprintf(stderr, "Warning: overflow in floating point constant %s\n", str);*/
}
fprintf(codefile, ".data1 0%o", buf[0] & 0377);
for (i = 1; i < (int)argval; i++)

View file

@ -37,6 +37,7 @@ extern struct tm* localtime(const time_t *_timer);
extern size_t strftime(char *_s, size_t _maxsize,
const char *_format,
const struct tm *_timeptr);
extern void tzset(void);
/* Extensions not in the standard */

View file

@ -23,5 +23,6 @@ extern struct tm *gmtime();
extern struct tm *localtime();
extern char *asctime();
extern char *ctime();
extern void tzset(void);
#endif /* _TIME_H */

View file

@ -93,8 +93,7 @@ long di_off;
int firstreg;
int
regscore(off, size, typ, score, totyp)
long off;
regscore(long off, int size, int typ, int score, int totyp)
{
if (size != 4) return -1;
score -= 1;
@ -137,9 +136,7 @@ f_regsave()
}
void
regsave(regstr, off, size)
const char *regstr;
long off;
regsave(const char* regstr, long off, int size)
{
if (strcmp(regstr, "esi") == 0) {
if (! firstreg) firstreg = -1;

View file

@ -83,8 +83,7 @@ long di_off;
int firstreg;
int
regscore(off, size, typ, score, totyp)
long off;
regscore(long off, int size, int typ, int score, int totyp)
{
if (size != 2) return -1;
score -= 1;
@ -133,9 +132,7 @@ f_regsave()
}
void
regsave(regstr, off, size)
const char *regstr;
long off;
regsave(const char* regstr, long off, int size)
{
if (strcmp(regstr, "si") == 0) {
if (! firstreg) firstreg = -1;

View file

@ -1,7 +1,6 @@
#include <em_abs.h>
char *
_trpstr(d)
char* _trpstr(int d)
{
switch(d)
{

View file

@ -60,8 +60,7 @@ con_mult(word sz) {
#include <con_float>
int
regscore(off,size,typ,score,totyp)
long off;
regscore(long off, int size, int typ, int score, int totyp)
{
if (score == 0) return -1;
switch(typ) {
@ -183,9 +182,7 @@ f_regsave()
}
void
regsave(s,off,size)
const char *s;
long off;
regsave(const char* s, long off, int size)
{
assert (regnr < 9);
regsav[regnr].rs_reg = s;

View file

@ -11,6 +11,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <unistd.h>
#include <sys/stat.h>
@ -53,10 +54,10 @@ int outputfile_created;
FILE *output;
int rom_in_text;
static cv_int2();
static fatal();
static emits();
static emit_symtab();
static void cv_int2(int n);
static void fatal(const char* s, ...);
static void emits(struct outsect*);
static void emit_symtab(void);
char *program ;
@ -71,9 +72,7 @@ char flag ;
#define LSECT BSSSG+1
#define NSECT LSECT+1
main(argc, argv)
int argc;
char *argv[];
int main(int argc, char* argv[])
{
register struct exec *e = &exec;
@ -189,7 +188,7 @@ main(argc, argv)
return 0;
}
cv_int2(n)
void cv_int2(int n)
{
putc(n, output);
putc((n>>8), output);
@ -209,7 +208,7 @@ cv_long(l)
/*
* Transfer the emitted byted from one file to another.
*/
emits(section) struct outsect *section ; {
void emits(struct outsect* section) {
register long n ;
register int blk;
char buffer[BUFSIZ];
@ -234,7 +233,7 @@ emits(section) struct outsect *section ; {
}
}
emit_symtab()
void emit_symtab(void)
{
struct outname ACK_name; /* symbol table entry in ACK format */
struct nlist PDP_name; /* symbol table entry in PDP V7 format */
@ -303,17 +302,21 @@ emit_symtab()
}
/* VARARGS1 */
fatal(s, a1, a2)
char *s;
void fatal(const char* s, ...)
{
va_list ap;
fprintf(stderr,"%s: ",program) ;
fprintf(stderr, s, a1, a2);
va_start(ap, s);
vfprintf(stderr, s, ap);
va_end(ap);
if (outputfile_created)
unlink(output_file);
exit(1);
}
rd_fatal()
void rd_fatal(void)
{
fatal("read error\n");
}

View file

@ -88,8 +88,11 @@ char *salloc(int size)
return(p);
}
int compar(char **p1, char **p2)
int compar(const void* pp1, const void* pp2)
{
const char **p1 = (const char**) pp1;
const char **p2 = (const char**) pp2;
assert(*p1 != *p2);
if (*p1 < *p2)
return(-1);

View file

@ -10,11 +10,11 @@
#include "types.h"
string myalloc(int size);
void myfree(void* p);
void popstr(int nnstab);
char *salloc(int size);
int compar(char **p1, char **p2);
void garbage_collect(void);
extern string myalloc(int size);
extern void myfree(void* p);
extern void popstr(int nnstab);
extern char *salloc(int size);
extern int compar(const void* pp1, const void* pp2);
extern void garbage_collect(void);
#endif /* SALLOC_H_ */

View file

@ -6,7 +6,7 @@
static label_p label_list = (label_p)0;
void add_label(num, height, flth)
void add_label(int num, int height, int flth)
{
label_p lbl = (label_p)0;

View file

@ -12,7 +12,7 @@ static void extend(struct array* array)
struct array* newarray = realloc(array->item, newmax * sizeof(*newarray));
array->max = newmax;
array->item = newarray;
array->item = (void**) newarray;
}
}

View file

@ -5,7 +5,7 @@
#define INCR_SIZE 8
static void append(void* mapp, char* key, void* value)
static void append(void* mapp, const char* key, void* value)
{
struct smap* map = mapp;
struct smap_node* node;
@ -26,7 +26,7 @@ static void append(void* mapp, char* key, void* value)
}
void smap_put(struct smap *mapp, char* key, void* value)
void smap_put(struct smap *mapp, const char* key, void* value)
{
struct smap* map = mapp;
int i;
@ -71,7 +71,7 @@ void smap_free(struct smap *mapp, int free_key, int free_value)
free(mapp->item);
}
void smap_add(struct smap *mapp, char* key, void* value)
void smap_add(struct smap *mapp, const char* key, void* value)
{
struct smap* map = mapp;
int i;

View file

@ -36,11 +36,11 @@ extern void smap_init(struct smap *mapp);
* it does not already exist, otherwise replaces the
* value `value` associated with the existing `key`.
*/
extern void smap_put(struct smap *mapp, char* key, void* value);
extern void smap_put(struct smap *mapp, const char* key, void* value);
/** Adds a new item in a string map only if `key` does
* not already exist in the string map.
*/
extern void smap_add(struct smap *mapp, char* key, void* value);
extern void smap_add(struct smap *mapp, const char* key, void* value);
/** Returns the value associated with the specified `key`, returns
* NULL if `key` is not present in the string map.
*

View file

@ -69,7 +69,7 @@ char* stringlist_get(struct stringlist *list, int index)
i++;
}
return i;
return NULL;
}

View file

@ -3,7 +3,7 @@
struct stringfragment
{
const char* data;
char* data;
struct stringfragment* next;
};

View file

@ -37,7 +37,7 @@ uint8_t cpm_parse_filename(FCB* fcb, const char* filename)
c = *filename++;
if (isdigit(c))
{
user = strtol(filename-1, &filename, 10);
user = strtol(filename-1, (char**) &filename, 10);
c = *filename++;
}
c = toupper(c);

View file

@ -116,4 +116,8 @@ struct tchars {
#define EXTA 14
#define EXTB 15
extern int ioctl(int fd, unsigned int request, ...);
extern int gtty(int fildes, struct sgttyb* argp);
extern int stty(int fildes, struct sgttyb* argp);
#endif /* _SGTTY_H */

View file

@ -1,6 +1,6 @@
/* $Id$ */
#include <sgtty.h>
int
gtty(fildes,argp) int fildes ; struct sgttyb *argp ; {
int gtty(int fildes, struct sgttyb* argp) {
return ioctl(fildes,TIOCGETP,argp) ;
}

View file

@ -1,5 +1,6 @@
/* $Id$ */
isatty(f)
#include <sgtty.h>
int isatty(int fd)
{
char buf[128];
/* not a sgttyb struct; it might not be large enough;
@ -7,6 +8,6 @@ isatty(f)
where gtty is an ioctl(..., TCGETA, ...)
*/
if (gtty(f, buf) < 0) return 0;
if (gtty(fd, (void*) buf) < 0) return 0;
return 1;
}

View file

@ -1,14 +1,14 @@
/* $Id$ */
#include <signal.h>
typedef void (*callvec)() ;
extern void _setsig(int (*)(int));
static callvec vector[16] = {
static sighandler_t vector[16] = {
SIG_DFL, SIG_DFL, SIG_DFL, SIG_DFL, SIG_DFL, SIG_DFL, SIG_DFL, SIG_DFL,
SIG_DFL, SIG_DFL, SIG_DFL, SIG_DFL, SIG_DFL, SIG_DFL, SIG_DFL, SIG_DFL
} ;
static char mapvec[] = {
static const char mapvec[] = {
0, /* EARRAY */
0, /* ERANGE */
0, /* ESET */
@ -42,16 +42,17 @@ static char mapvec[] = {
#define VECBASE 128
static firsttime = 1 ;
static int catchtrp() ;
static int procesig() ;
extern int sigtrp(int mapval, int sig) ;
static int catchtrp(int trapno) ;
static int procesig(int signo) ;
callvec signal(sig,func) int sig ; callvec func ; {
sighandler_t signal(int sig, sighandler_t func) {
register index, i ;
callvec prev ;
sighandler_t prev ;
index= sig-1 ;
if ( index<0 || index>=(sizeof vector/sizeof vector[0]) ) {
return (callvec) -1 ;
return (sighandler_t) -1 ;
}
if ( firsttime ) {
firsttime= 0 ;
@ -68,13 +69,13 @@ callvec signal(sig,func) int sig ; callvec func ; {
} else {
mapval=VECBASE+sig;
}
if ( sigtrp(mapval,sig)== -1 ) return (callvec) -1;
if ( sigtrp(mapval,sig)== -1 ) return (sighandler_t) -1;
}
return prev ;
}
static int catchtrp(trapno) int trapno ; {
static int catchtrp(int trapno) {
if ( trapno>VECBASE &&
trapno<=VECBASE + (sizeof vector/sizeof vector[0]) ) {
return procesig(trapno-VECBASE) ;
@ -86,9 +87,9 @@ static int catchtrp(trapno) int trapno ; {
return 0 ; /* Failed to handle the trap */
}
static int procesig(sig) int sig ; {
static int procesig(int sig) {
register index ;
callvec trf ;
sighandler_t trf ;
index= sig-1 ;
trf= vector[index] ;

View file

@ -1,6 +1,6 @@
/* $Id$ */
#include <sgtty.h>
int
stty(fildes,argp) int fildes ; struct sgttyb *argp ; {
int stty(int fildes, struct sgttyb* argp) {
return ioctl(fildes,TIOCSETP,argp) ;
}

View file

@ -3,9 +3,9 @@
* return offset in file.
*/
long lseek();
long lseek(int fd, int offset, int whence);
long tell(f)
long tell(int fd)
{
return(lseek(f, 0L, 1));
return(lseek(fd, 0L, 1));
}

View file

@ -1,8 +1,10 @@
/* $Id$ */
#include <sys/types.h>
#include <sys/timeb.h>
time_t
time(timpt) time_t *timpt ; {
extern void ftime(struct timeb* buf);
time_t time(time_t* timpt) {
struct timeb buf ;
ftime(&buf) ;

View file

@ -1,3 +1,3 @@
_cleanup()
void _cleanup(void)
{
}

View file

@ -1,4 +1,7 @@
exit(n)
extern void _cleanup(void);
extern void _exit(int n);
void exit(int n)
{
_cleanup();
_exit(n);

View file

@ -1,7 +1,7 @@
int
gtty(fildes,argp)
int fildes ;
char *argp ;
extern int ioctl(int fd, unsigned int request, ...);
extern int _ioctl(int fd, int ioc, void* ptr);
int gtty(int fildes, char* argp)
{
return ioctl(fildes,/*TIOCGETP*/(('t'<<8)|8),argp) ;
}

View file

@ -1,3 +1,5 @@
extern int ioctl(int fd, unsigned int request, ...);
int isatty(int fd)
{
unsigned u;

View file

@ -1,7 +1,6 @@
int
stty(fildes,argp)
int fildes ;
char *argp;
extern int _ioctl(int fd, int ioc, void* ptr);
int stty(int fildes, char* argp)
{
return _ioctl(fildes,/*TIOCSETP*/(('t'<<8)|9),argp) ;
}

View file

@ -4,6 +4,7 @@
*/
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <sys/types.h>
#include "em_spec.h"
#include "as_spec.h"

View file

@ -28,7 +28,7 @@ cons_t nicepr(int typ, addr_u *ap)
case CONST:
return (ap->ad_i);
case LOCSYM:
return (int_cast ap->ad_lp);
return (int_cast (intptr_t)ap->ad_lp);
case GLOOFF:
return (ap->ad_df.df_gp - mglobs);
case GLOSYM:
@ -135,7 +135,7 @@ void dump(int n)
if (lbp->l_defined != EMPTY)
printf(" %8d%8d%8d%8d %-s\n",
lbp->l_hinum * LOCLABSIZE + i,
int_cast lbp, lbp->l_min, lbp->l_max,
int_cast (intptr_t)lbp, lbp->l_min, lbp->l_max,
labstr[(unsigned char)lbp->l_defined]);
}
}

View file

@ -21,6 +21,7 @@ static void initio(void);
static int eqregclass(int r1, int r2);
static void compueq(void);
static int want_verbose = 0;
char *myalloc(int n)
@ -297,6 +298,9 @@ int main(int argc, char *argv[])
case 'c':
cname = &argv[0][2];
break;
case 'v':
want_verbose = 1;
break;
default:
fprintf(stderr, "Bad flag %s\n", argv[0]);
break;
@ -316,8 +320,10 @@ int main(int argc, char *argv[])
compueq();
hashpatterns();
finishio();
if (want_verbose)
verbose();
}
if (want_verbose)
debug();
exit(nerrors);
}
@ -777,7 +783,6 @@ static void outregvar(void)
static void verbose(void)
{
fprintf(stderr, "Codebytes %d\n", codebytes);
fprintf(stderr, "Registers %d(%d)\n", nmachregs, MAXREGS);
fprintf(stderr, "Properties %d(%d)\n", nprops, MAXPROPS);

View file

@ -83,7 +83,7 @@ lab_id instr_lab(short number)
/* symlookup */
STATIC unsigned hash(const char *string) {
register char *p;
register const char *p;
register unsigned i,sum;
for (sum=i=0,p=string;*p;i += 3)

View file

@ -12,6 +12,7 @@
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <em_spec.h>
#include "types.h"
#include "def.h"
@ -69,7 +70,7 @@ void OUTVERBOSE(const char *s, int n1, int n2)
void VA(short *a) {
if (a == (short *) 0) error("VA: 0 argument");
if ( ((unsigned) a & 01) == 01) {
if ( ((intptr_t) a & 01) == 01) {
/* MACHINE DEPENDENT TEST */
error("VA: odd argument");
}

View file

@ -100,7 +100,7 @@ int do_sigtrp(
}
else if (tn >= 0 && tn <= 252)
{/* legal tn */
if ((int) signal(sn, HndlEmSig) == -1)
if (signal(sn, HndlEmSig) == SIG_ERR)
{
sig_map[sn] = old_tn;
return (-1);

View file

@ -128,7 +128,7 @@ PRIVATE size buf_cnt[5]; /* Current sizes of the buffers */
PRIVATE char *buf[5]; /* Pointers to the buffers */
PRIVATE check_buf();
PRIVATE int savestr();
PRIVATE int savestr(int n, ptr addr);
PRIVATE int vec();
void moncall(void)
@ -702,7 +702,7 @@ void moncall(void)
#ifdef SYS_V /* from system.h */
utimbuf.x = actime;
utimbuf.y = modtime;
if (!savestr(0, dsp1) || utime(buf[0], &utimbuf) == -1) {
if (!savestr(0, dsp1) || utime(buf[0], (struct utimbuf*) &utimbuf) == -1) {
#else /* SYS_V */
utimbuf[0] = actime;
utimbuf[1] = modtime;
@ -1037,9 +1037,7 @@ PRIVATE check_buf(n, sz)
}
}
PRIVATE int savestr(n, addr)
int n;
ptr addr;
PRIVATE int savestr(int n, ptr addr)
{
register size len;
register char *cp, ch;

View file

@ -65,10 +65,12 @@ int main(int argc, char **argv)
if (nerrors == 0)
{
finishio();
statistics();
if (verbose)
{
statistics();
hallverbose();
}
}
else
{
errorexit();

View file

@ -123,7 +123,7 @@ void printpatterns(void) {
i++;
}
fputs("};\n", genc);
fputs("int\ncheck_constraint(patno){\n\tint r;\n\tswitch(patno){\n",genc);
fputs("int\ncheck_constraint(int patno){\n\tint r;\n\tswitch(patno){\n",genc);
p = pattable;
while (p < current) {
if (p->p_constraint) {