Reduce clang warnings from ncg
If a .c file included "types.h" before "mach.h", then it missed the declaration of mach_option(). Fix by adding "xmach.h". Fix mach/powerpc/ncg/mach.h and mach/vc4/ncg/mach.h to use the correct type in their printf() format strings.
This commit is contained in:
parent
0576641cae
commit
7ab4794a05
|
@ -16,7 +16,7 @@ static char rcs_mh[]= ID_MH ;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
con_part(sz,w) register sz; word w; {
|
con_part(int sz, word w) {
|
||||||
|
|
||||||
while (part_size % sz)
|
while (part_size % sz)
|
||||||
part_size++;
|
part_size++;
|
||||||
|
|
|
@ -14,7 +14,7 @@ static char rcs_mh[]= ID_MH ;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
con_part(sz,w) register sz; word w; {
|
con_part(int sz, word w) {
|
||||||
|
|
||||||
while (part_size % sz)
|
while (part_size % sz)
|
||||||
part_size++;
|
part_size++;
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include <stb.h>
|
#include <stb.h>
|
||||||
|
|
||||||
void
|
void
|
||||||
con_part(sz,w) register sz; word w; {
|
con_part(int sz, word w) {
|
||||||
|
|
||||||
while (part_size % sz)
|
while (part_size % sz)
|
||||||
part_size++;
|
part_size++;
|
||||||
|
@ -88,7 +88,7 @@ regscore(off,size,typ,score,totyp)
|
||||||
return score;
|
return score;
|
||||||
}
|
}
|
||||||
struct regsav_t {
|
struct regsav_t {
|
||||||
char *rs_reg; /* e.g. "a3" or "d5" */
|
const char *rs_reg; /* e.g. "a3" or "d5" */
|
||||||
long rs_off; /* offset of variable */
|
long rs_off; /* offset of variable */
|
||||||
int rs_size; /* 2 or 4 bytes */
|
int rs_size; /* 2 or 4 bytes */
|
||||||
} regsav[9];
|
} regsav[9];
|
||||||
|
|
|
@ -9,10 +9,10 @@
|
||||||
#define newilb(x) fprintf(codefile,"%s:\n",x)
|
#define newilb(x) fprintf(codefile,"%s:\n",x)
|
||||||
#define newdlb(x) fprintf(codefile,"%s:\n",x)
|
#define newdlb(x) fprintf(codefile,"%s:\n",x)
|
||||||
#define dlbdlb(x,y) fprintf(codefile,"%s = %s\n",x,y)
|
#define dlbdlb(x,y) fprintf(codefile,"%s = %s\n",x,y)
|
||||||
#define newlbss(l,x) fprintf(codefile,".comm %s,%u\n",l,x);
|
#define newlbss(l,x) fprintf(codefile,".comm %s,%ld\n",l,x);
|
||||||
|
|
||||||
#define cst_fmt "%d"
|
#define cst_fmt "%ld"
|
||||||
#define off_fmt "%d"
|
#define off_fmt "%ld"
|
||||||
#define ilb_fmt "I%x_%x"
|
#define ilb_fmt "I%x_%x"
|
||||||
#define dlb_fmt "_%d"
|
#define dlb_fmt "_%d"
|
||||||
#define hol_fmt "hol%d"
|
#define hol_fmt "hol%d"
|
||||||
|
|
|
@ -20,6 +20,7 @@ definerule("build_ncg",
|
||||||
"mach/proto/ncg/result.h",
|
"mach/proto/ncg/result.h",
|
||||||
"mach/proto/ncg/state.h",
|
"mach/proto/ncg/state.h",
|
||||||
"mach/proto/ncg/types.h",
|
"mach/proto/ncg/types.h",
|
||||||
|
"mach/proto/ncg/xmach.h",
|
||||||
"mach/"..e.arch.."/ncg/mach.c",
|
"mach/"..e.arch.."/ncg/mach.c",
|
||||||
"mach/"..e.arch.."/ncg/*.h",
|
"mach/"..e.arch.."/ncg/*.h",
|
||||||
}
|
}
|
||||||
|
|
|
@ -706,7 +706,7 @@ unsigned codegen(byte* codep, int ply, int toplevel, unsigned costlimit, int for
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
npos = exactmatch = 0;
|
npos = exactmatch = 0;
|
||||||
for (rpp = reglist[propno]; rp = *rpp; rpp++)
|
for (rpp = reglist[propno]; (rp = *rpp) != NULL; rpp++)
|
||||||
if (getrefcount((int)(rp - machregs), FALSE) == 0)
|
if (getrefcount((int)(rp - machregs), FALSE) == 0)
|
||||||
{
|
{
|
||||||
pos[npos++] = rp - machregs;
|
pos[npos++] = rp - machregs;
|
||||||
|
|
|
@ -23,6 +23,9 @@ static char rcsid2[] = "$Id$";
|
||||||
#include "regvar.h"
|
#include "regvar.h"
|
||||||
#include <em_reg.h>
|
#include <em_reg.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef USE_TES
|
||||||
|
#include "label.h"
|
||||||
|
#endif
|
||||||
#include "extern.h"
|
#include "extern.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -80,10 +83,16 @@ static int regallowed=0;
|
||||||
extern char em_flag[];
|
extern char em_flag[];
|
||||||
extern short em_ptyp[];
|
extern short em_ptyp[];
|
||||||
|
|
||||||
/* machine dependent */
|
/*
|
||||||
|
* Declare the machine dependent functions.
|
||||||
|
*
|
||||||
|
* These functions now return void, which is not compatible with
|
||||||
|
* traditional K&R C. Old mach.c files stop working until one fixes
|
||||||
|
* them to return void, not int.
|
||||||
|
*/
|
||||||
void con_part(int, word);
|
void con_part(int, word);
|
||||||
void con_mult(word);
|
void con_mult(word);
|
||||||
void con_float(void); /* actually returns void, but need K&R C compatibility */
|
void con_float(void);
|
||||||
void prolog(full nlocals);
|
void prolog(full nlocals);
|
||||||
void mes(word);
|
void mes(word);
|
||||||
|
|
||||||
|
@ -706,8 +715,8 @@ static void savelab(void) {
|
||||||
}
|
}
|
||||||
p = argstr;
|
p = argstr;
|
||||||
q = labstr;
|
q = labstr;
|
||||||
while (*q++ = *p++)
|
while ((*q++ = *p++) != '\0')
|
||||||
;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dumplab(void) {
|
static void dumplab(void) {
|
||||||
|
|
|
@ -13,7 +13,7 @@ static char rcsid[] = "$Id$";
|
||||||
#include "result.h"
|
#include "result.h"
|
||||||
#include "extern.h"
|
#include "extern.h"
|
||||||
#ifdef USE_TES
|
#ifdef USE_TES
|
||||||
#include "mach.h"
|
#include "xmach.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -6,7 +6,7 @@ static char rcsid[] = "$Id$";
|
||||||
#include "param.h"
|
#include "param.h"
|
||||||
#include "tables.h"
|
#include "tables.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "mach.h"
|
#include "xmach.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||||
|
|
|
@ -67,7 +67,3 @@ void garbage_collect(void);
|
||||||
void itokcost(void);
|
void itokcost(void);
|
||||||
void error(const char *s, ...);
|
void error(const char *s, ...);
|
||||||
void fatal(const char *s, ...);
|
void fatal(const char *s, ...);
|
||||||
|
|
||||||
#ifdef MACH_OPTIONS
|
|
||||||
void mach_option(char *); /* machine dependent */
|
|
||||||
#endif
|
|
||||||
|
|
15
mach/proto/ncg/xmach.h
Normal file
15
mach/proto/ncg/xmach.h
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
/*
|
||||||
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||||
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Include "mach.h", then if "mach.h" defines MACH_OPTIONS, also
|
||||||
|
* declare mach_option(), a machine dependent function.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mach.h"
|
||||||
|
|
||||||
|
#ifdef MACH_OPTIONS
|
||||||
|
void mach_option(char *);
|
||||||
|
#endif
|
|
@ -11,10 +11,10 @@
|
||||||
#define newilb(x) fprintf(codefile,"%s:\n",x)
|
#define newilb(x) fprintf(codefile,"%s:\n",x)
|
||||||
#define newdlb(x) fprintf(codefile,"%s:\n",x)
|
#define newdlb(x) fprintf(codefile,"%s:\n",x)
|
||||||
#define dlbdlb(x,y) fprintf(codefile,"%s = %s\n",x,y)
|
#define dlbdlb(x,y) fprintf(codefile,"%s = %s\n",x,y)
|
||||||
#define newlbss(l,x) fprintf(codefile,".comm %s,%u\n",l,x);
|
#define newlbss(l,x) fprintf(codefile,".comm %s,%ld\n",l,x);
|
||||||
|
|
||||||
#define cst_fmt "%d"
|
#define cst_fmt "%ld"
|
||||||
#define off_fmt "%d"
|
#define off_fmt "%ld"
|
||||||
#define ilb_fmt "I%x_%x"
|
#define ilb_fmt "I%x_%x"
|
||||||
#define dlb_fmt "_%d"
|
#define dlb_fmt "_%d"
|
||||||
#define hol_fmt "hol%d"
|
#define hol_fmt "hol%d"
|
||||||
|
|
Loading…
Reference in a new issue