1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-02-22 00:29:01 +00:00

suppress GCC warnings

This commit is contained in:
Peter Ferrie 2017-01-06 15:08:28 -08:00
parent a5215e3309
commit afe3b284ed
4 changed files with 14 additions and 14 deletions

View File

@ -258,10 +258,10 @@ int fixup_new(int tag, int type, int size)
#define INIT 16 #define INIT 16
#define SYSFLAGS 32 #define SYSFLAGS 32
static int outflags = 0; static int outflags = 0;
static char *DB = ".BYTE"; static const char *DB = ".BYTE";
static char *DW = ".WORD"; static const char *DW = ".WORD";
static char *DS = ".RES"; static const char *DS = ".RES";
static char LBL = ':'; static char LBL = (char) ':';
char *supper(char *s) char *supper(char *s)
{ {
static char su[80]; static char su[80];
@ -467,7 +467,7 @@ int emit_data(int vartype, int consttype, long constval, int constsize)
else if (consttype & STRING_TYPE) else if (consttype & STRING_TYPE)
{ {
datasize = constsize; datasize = constsize;
str = (char *)constval; str = (char *)(uintptr_t)constval;
printf("\t%s\t$%02X\n", DB, --constsize); printf("\t%s\t$%02X\n", DB, --constsize);
while (constsize-- > 0) while (constsize-- > 0)
{ {
@ -518,7 +518,7 @@ int emit_data(int vartype, int consttype, long constval, int constsize)
} }
return (datasize); return (datasize);
} }
void emit_def(char *name, int is_bytecode) void emit_def(const char *name, int is_bytecode)
{ {
if (!(outflags & MODULE)) if (!(outflags & MODULE))
{ {

View File

@ -12,7 +12,7 @@ void emit_idlocal(char *name, int value);
void emit_idglobal(int value, int size, char *name); void emit_idglobal(int value, int size, char *name);
void emit_idfunc(int tag, int type, char *name); void emit_idfunc(int tag, int type, char *name);
void emit_idconst(char *name, int value); void emit_idconst(char *name, int value);
void emit_def(char *name, int is_bytecode); void emit_def(const char *name, int is_bytecode);
int emit_data(int vartype, int consttype, long constval, int constsize); int emit_data(int vartype, int consttype, long constval, int constsize);
void emit_codetag(int tag); void emit_codetag(int tag);
void emit_const(int cval); void emit_const(int cval);

View File

@ -15,7 +15,7 @@
#include "tokens.h" #include "tokens.h"
#include "symbols.h" #include "symbols.h"
char *statement, *tokenstr, *scanpos = ""; char *statement, *tokenstr, *scanpos = (char*) "";
t_token scantoken, prevtoken; t_token scantoken, prevtoken;
int tokenlen; int tokenlen;
long constval; long constval;
@ -65,7 +65,7 @@ t_token keywords[] = {
EOL_TOKEN EOL_TOKEN
}; };
void parse_error(char *errormsg) void parse_error(const char *errormsg)
{ {
char *error_carrot = statement; char *error_carrot = statement;
@ -229,7 +229,7 @@ t_token scan(void)
* String constant. * String constant.
*/ */
scantoken = STRING_TOKEN; scantoken = STRING_TOKEN;
constval = (long)++scanpos; constval = (long)(uintptr_t)(++scanpos);
while (*scanpos && *scanpos != '\"') while (*scanpos && *scanpos != '\"')
{ {
if (*scanpos == '\\') if (*scanpos == '\\')
@ -418,7 +418,7 @@ int next_line(void)
if (inputfile == NULL) { if (inputfile == NULL) {
// First-time init // First-time init
inputfile = stdin; inputfile = stdin;
filename = "<stdin>"; filename = (char*) "<stdin>";
} }
if (*scanpos == ';') if (*scanpos == ';')
{ {
@ -470,8 +470,8 @@ int next_line(void)
outer_inputfile = inputfile; outer_inputfile = inputfile;
outer_filename = filename; outer_filename = filename;
outer_lineno = lineno; outer_lineno = lineno;
new_filename = malloc(tokenlen-1); new_filename = (char*) malloc(tokenlen-1);
strncpy(new_filename, (char*)constval, tokenlen-2); strncpy(new_filename, (char*)(uintptr_t)constval, tokenlen-2);
new_filename[tokenlen-2] = 0; new_filename[tokenlen-2] = 0;
inputfile = fopen(new_filename, "r"); inputfile = fopen(new_filename, "r");
if (inputfile == NULL) { if (inputfile == NULL) {

View File

@ -3,7 +3,7 @@ extern t_token scantoken, prevtoken;
extern int tokenlen; extern int tokenlen;
extern long constval; extern long constval;
extern char inputline[]; extern char inputline[];
void parse_error(char *errormsg); void parse_error(const char *errormsg);
int next_line(void); int next_line(void);
void scan_rewind(char *backptr); void scan_rewind(char *backptr);
int scan_lookahead(void); int scan_lookahead(void);