Fix compile warnings
This commit is contained in:
parent
c36b495c36
commit
eeefc4ba3b
@ -204,6 +204,14 @@ typedef int (AMXAPI *AMX_IDLE)(struct tagAMX *amx, int AMXAPI Exec(struct tagAMX
|
||||
#define AMX_NO_ALIGN
|
||||
#endif
|
||||
|
||||
#if defined __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wattributes"
|
||||
#elif defined __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wignored-attributes"
|
||||
#endif
|
||||
|
||||
#if defined __GNUC__
|
||||
#define PACKED __attribute__((packed))
|
||||
#else
|
||||
@ -461,6 +469,12 @@ int AMXAPI amx_UTF8Put(char *string, char **endptr, int maxchars, cell value);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#elif defined __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -42,6 +42,14 @@ extern "C" {
|
||||
#define AMX_NO_ALIGN
|
||||
#endif
|
||||
|
||||
#if defined __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wattributes"
|
||||
#elif defined __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wignored-attributes"
|
||||
#endif
|
||||
|
||||
#if defined __GNUC__
|
||||
#define PACKED __attribute__((packed))
|
||||
#else
|
||||
@ -154,7 +162,6 @@ int AMXAPI dbg_GetTagName(AMX_DBG *amxdbg, int tag, const char **name);
|
||||
int AMXAPI dbg_GetVariable(AMX_DBG *amxdbg, const char *symname, ucell scopeaddr, const AMX_DBG_SYMBOL **sym);
|
||||
int AMXAPI dbg_GetArrayDim(AMX_DBG *amxdbg, const AMX_DBG_SYMBOL *sym, const AMX_DBG_SYMDIM **symdim);
|
||||
|
||||
|
||||
#if !defined AMX_NO_ALIGN
|
||||
#if defined LINUX || defined __FreeBSD__
|
||||
#pragma pack() /* reset default packing */
|
||||
@ -165,6 +172,12 @@ int AMXAPI dbg_GetArrayDim(AMX_DBG *amxdbg, const AMX_DBG_SYMBOL *sym, const AMX
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#elif defined __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -220,7 +220,7 @@ static OPCODE opcodelist[] = {
|
||||
|
||||
void print_opcode(FILE *ftxt,cell opcode,cell cip)
|
||||
{
|
||||
fprintf(ftxt,"%08lx %s ",cip,opcodelist[(int)(opcode &0x0000ffff)].name);
|
||||
fprintf(ftxt,"%08"PRIxC" %s ",cip,opcodelist[(int)(opcode &0x0000ffff)].name);
|
||||
}
|
||||
|
||||
void print_funcname(FILE *ftxt,cell address)
|
||||
@ -228,7 +228,7 @@ void print_funcname(FILE *ftxt,cell address)
|
||||
int idx,numpublics;
|
||||
AMX_FUNCSTUBNT func;
|
||||
char name[sNAMEMAX+1]={'\0'};
|
||||
char *dbgname;
|
||||
const char *dbgname;
|
||||
|
||||
/* first look up the address in the debug info and, if failed, find it
|
||||
* in the public function table */
|
||||
@ -260,35 +260,38 @@ cell parm0(FILE *ftxt,const cell *params,cell opcode,cell cip)
|
||||
cell parm1(FILE *ftxt,const cell *params,cell opcode,cell cip)
|
||||
{
|
||||
print_opcode(ftxt,opcode,cip);
|
||||
fprintf(ftxt,"%08lx\n",*params);
|
||||
fprintf(ftxt,"%08"PRIxC"\n",*params);
|
||||
return 2;
|
||||
}
|
||||
|
||||
cell parm2(FILE *ftxt,const cell *params,cell opcode,cell cip)
|
||||
{
|
||||
print_opcode(ftxt,opcode,cip);
|
||||
fprintf(ftxt,"%08lx %08lx\n",params[0],params[1]);
|
||||
fprintf(ftxt,"%08"PRIxC" %08"PRIxC"\n",params[0],params[1]);
|
||||
return 3;
|
||||
}
|
||||
|
||||
cell parm3(FILE *ftxt,const cell *params,cell opcode,cell cip)
|
||||
{
|
||||
print_opcode(ftxt,opcode,cip);
|
||||
fprintf(ftxt,"%08lx %08lx %08lx\n",params[0],params[1],params[2]);
|
||||
fprintf(ftxt,"%08"PRIxC" %08"PRIxC" %08"PRIxC"\n",
|
||||
params[0],params[1],params[2]);
|
||||
return 4;
|
||||
}
|
||||
|
||||
cell parm4(FILE *ftxt,const cell *params,cell opcode,cell cip)
|
||||
{
|
||||
print_opcode(ftxt,opcode,cip);
|
||||
fprintf(ftxt,"%08lx %08lx %08lx %08lx\n",params[0],params[1],params[2],params[3]);
|
||||
fprintf(ftxt,"%08"PRIxC" %08"PRIxC" %08"PRIxC" %08"PRIxC"\n",
|
||||
params[0],params[1],params[2],params[3]);
|
||||
return 5;
|
||||
}
|
||||
|
||||
cell parm5(FILE *ftxt,const cell *params,cell opcode,cell cip)
|
||||
{
|
||||
print_opcode(ftxt,opcode,cip);
|
||||
fprintf(ftxt,"%08lx %08lx %08lx %08lx %08lx\n",params[0],params[1],params[2],params[3],params[4]);
|
||||
fprintf(ftxt,"%08"PRIxC" %08"PRIxC" %08"PRIxC" %08"PRIxC" %08"PRIxC"\n",
|
||||
params[0],params[1],params[2],params[3],params[4]);
|
||||
return 6;
|
||||
}
|
||||
|
||||
@ -303,7 +306,7 @@ cell do_proc(FILE *ftxt,const cell *params,cell opcode,cell cip)
|
||||
cell do_call(FILE *ftxt,const cell *params,cell opcode,cell cip)
|
||||
{
|
||||
print_opcode(ftxt,opcode,cip);
|
||||
fprintf(ftxt,"%08lx",*params);
|
||||
fprintf(ftxt,"%08"PRIxC,*params);
|
||||
print_funcname(ftxt,*params);
|
||||
fputs("\n",ftxt);
|
||||
return 2;
|
||||
@ -312,7 +315,7 @@ cell do_call(FILE *ftxt,const cell *params,cell opcode,cell cip)
|
||||
cell do_jump(FILE *ftxt,const cell *params,cell opcode,cell cip)
|
||||
{
|
||||
print_opcode(ftxt,opcode,cip);
|
||||
fprintf(ftxt,"%08lx\n",*params);
|
||||
fprintf(ftxt,"%08"PRIxC"\n",*params);
|
||||
return 2;
|
||||
}
|
||||
|
||||
@ -338,7 +341,7 @@ cell do_sysreq(FILE *ftxt,const cell *params,cell opcode,cell cip)
|
||||
} /* if */
|
||||
|
||||
print_opcode(ftxt,opcode,cip);
|
||||
fprintf(ftxt,"%08lx",*params);
|
||||
fprintf(ftxt,"%08"PRIxC,*params);
|
||||
if (strlen(name)>0)
|
||||
fprintf(ftxt,"\t; %s",name);
|
||||
fprintf(ftxt,"\n");
|
||||
@ -348,7 +351,7 @@ cell do_sysreq(FILE *ftxt,const cell *params,cell opcode,cell cip)
|
||||
cell do_switch(FILE *ftxt,const cell *params,cell opcode,cell cip)
|
||||
{
|
||||
print_opcode(ftxt,opcode,cip);
|
||||
fprintf(ftxt,"%08lx\n",*params+cip);
|
||||
fprintf(ftxt,"%08"PRIxC"\n",*params+cip);
|
||||
return 2;
|
||||
}
|
||||
|
||||
@ -359,9 +362,10 @@ cell casetbl(FILE *ftxt,const cell *params,cell opcode,cell cip)
|
||||
|
||||
print_opcode(ftxt,opcode,cip);
|
||||
num=params[0]+1;
|
||||
fprintf(ftxt,"%08lx %08lx\n",params[0],params[1]);
|
||||
fprintf(ftxt,"%08"PRIxC" %08"PRIxC"\n",params[0],params[1]);
|
||||
for (idx=1; idx<num; idx++)
|
||||
fprintf(ftxt," %08lx %08lx\n",params[2*idx],params[2*idx+1]);
|
||||
fprintf(ftxt," %08"PRIxC" %08"PRIxC"\n",
|
||||
params[2*idx],params[2*idx+1]);
|
||||
return 2*num+1;
|
||||
}
|
||||
|
||||
@ -530,7 +534,7 @@ int main(int argc,char *argv[])
|
||||
dbg_LookupFile(&amxdbg,(cell)(cip-code)*sizeof(cell),&filename);
|
||||
dbg_LookupLine(&amxdbg,(cell)(cip-code)*sizeof(cell),&nline);
|
||||
if (filename!=NULL && nline!=nprevline) {
|
||||
fprintf(fplist,"%s:%d\n",filename,nline+1);
|
||||
fprintf(fplist,"%s:%ld\n",filename,nline+1);
|
||||
/* print the source code for lines in (nprevline,line] */
|
||||
fpsrc=fopen(filename,"r");
|
||||
if (fpsrc!=NULL) {
|
||||
@ -563,9 +567,9 @@ int main(int argc,char *argv[])
|
||||
fprintf(fplist," %s",name);
|
||||
name[0]='\0';
|
||||
} /* if */
|
||||
fprintf(fplist,"\n%08lx ",(cell)(cip-code)*sizeof(cell)-(amxhdr.dat-amxhdr.cod));
|
||||
fprintf(fplist,"\n%08"PRIxC" ",(cell)(cip-code)*sizeof(cell)-(amxhdr.dat-amxhdr.cod));
|
||||
} /* if */
|
||||
fprintf(fplist,"%08lx ",*cip);
|
||||
fprintf(fplist,"%08"PRIxC" ",*cip);
|
||||
addchars(name,*cip,count);
|
||||
count=(count+1) % 4;
|
||||
cip++;
|
||||
|
@ -832,4 +832,26 @@ SC_VDECL jmp_buf errbuf; /* target of longjmp() on a fatal error */
|
||||
|
||||
#endif /* SC_SKIP_VDECL */
|
||||
|
||||
/* These macros are adapted from LibDGG libdgg-int64.h, see
|
||||
* http://www.dennougedougakkai-ndd.org/pub/libdgg/
|
||||
*/
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__>=199901L
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#define __STDC_CONSTANT_MACROS
|
||||
#include <inttypes.h> /* automatically includes stdint.h */
|
||||
#elif (defined _MSC_VER || defined __BORLANDC__) && (defined _I64_MAX || defined HAVE_I64)
|
||||
#define PRId64 "I64d"
|
||||
#define PRIx64 "I64x"
|
||||
#else
|
||||
#define PRId64 "lld"
|
||||
#define PRIx64 "llx"
|
||||
#endif
|
||||
#if PAWN_CELL_SIZE==64
|
||||
#define PRIdC PRId64
|
||||
#define PRIxC PRIx64
|
||||
#else
|
||||
#define PRIdC "d"
|
||||
#define PRIxC "x"
|
||||
#endif
|
||||
|
||||
#endif /* SC_H_INCLUDED */
|
||||
|
@ -4171,7 +4171,7 @@ static void make_report(symbol *root,FILE *log,char *sourcefile)
|
||||
continue;
|
||||
if ((sym->usage & uREAD)==0)
|
||||
continue;
|
||||
fprintf(log,"\t\t<member name=\"T:%s\" value=\"%ld\">\n",funcdisplayname(symname,sym->name),sym->addr);
|
||||
fprintf(log,"\t\t<member name=\"T:%s\" value=\"%"PRIdC"\">\n",funcdisplayname(symname,sym->name),sym->addr);
|
||||
if (sym->tag!=0) {
|
||||
tagsym=find_tag_byval(sym->tag);
|
||||
assert(tagsym!=NULL);
|
||||
@ -4181,7 +4181,7 @@ static void make_report(symbol *root,FILE *log,char *sourcefile)
|
||||
if ((enumroot=sym->dim.enumlist)!=NULL) {
|
||||
enumroot=enumroot->next; /* skip root */
|
||||
while (enumroot!=NULL) {
|
||||
fprintf(log,"\t\t\t<member name=\"C:%s\" value=\"%ld\">\n",funcdisplayname(symname,enumroot->name),enumroot->value);
|
||||
fprintf(log,"\t\t\t<member name=\"C:%s\" value=\"%"PRIdC"\">\n",funcdisplayname(symname,enumroot->name),enumroot->value);
|
||||
/* find the constant with this name and get the tag */
|
||||
ref=findglb(enumroot->name,sGLOBAL);
|
||||
if (ref!=NULL) {
|
||||
@ -4217,7 +4217,7 @@ static void make_report(symbol *root,FILE *log,char *sourcefile)
|
||||
continue;
|
||||
if ((sym->usage & uREAD)==0 || (sym->usage & (uENUMFIELD | uENUMROOT))!=0)
|
||||
continue;
|
||||
fprintf(log,"\t\t<member name=\"C:%s\" value=\"%ld\">\n",funcdisplayname(symname,sym->name),sym->addr);
|
||||
fprintf(log,"\t\t<member name=\"C:%s\" value=\"%"PRIdC"\">\n",funcdisplayname(symname,sym->name),sym->addr);
|
||||
if (sym->tag!=0) {
|
||||
tagsym=find_tag_byval(sym->tag);
|
||||
assert(tagsym!=NULL);
|
||||
|
@ -638,7 +638,7 @@ static int htoi(cell *val,const unsigned char *curptr)
|
||||
}
|
||||
|
||||
#if defined __GNUC__
|
||||
static double pow10(int value)
|
||||
static double pow10(double value)
|
||||
{
|
||||
double res=1.0;
|
||||
while (value>=4) {
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
/* a "private" implementation of strdup(), so that porting
|
||||
* to other memory allocators becomes easier.
|
||||
* By Søren Hannibal.
|
||||
* By S<EFBFBD>ren Hannibal.
|
||||
*/
|
||||
SC_FUNC char* duplicatestring(const char* sourcestring)
|
||||
{
|
||||
@ -138,7 +138,7 @@ static int delete_stringpair(stringpair *root,stringpair *item)
|
||||
static stringlist *insert_string(stringlist *list,char *string)
|
||||
{
|
||||
stringlist newlist;
|
||||
|
||||
|
||||
assert(list!=NULL);
|
||||
assert(string!=NULL);
|
||||
if (list->data==NULL) {
|
||||
@ -193,7 +193,7 @@ static int delete_string(stringlist *list,int index)
|
||||
SC_FUNC void delete_stringtable(stringlist *list)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
assert(list!=NULL);
|
||||
for (i=0; i<list->size; i++)
|
||||
free(list->data[i]);
|
||||
@ -436,32 +436,6 @@ SC_FUNC void delete_heaplisttable(void)
|
||||
|
||||
|
||||
/* ----- debug information --------------------------------------- */
|
||||
|
||||
/* These macros are adapted from LibDGG libdgg-int64.h, see
|
||||
* http://www.dennougedougakkai-ndd.org/pub/libdgg/
|
||||
*/
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__>=199901L
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#define __STDC_CONSTANT_MACROS
|
||||
#include <inttypes.h> /* automatically includes stdint.h */
|
||||
#elif (defined _MSC_VER || defined __BORLANDC__) && (defined _I64_MAX || defined HAVE_I64)
|
||||
#define PRId64 "I64d"
|
||||
#define PRIx64 "I64x"
|
||||
#else
|
||||
#define PRId64 "lld"
|
||||
#define PRIx64 "llx"
|
||||
#endif
|
||||
#if PAWN_CELL_SIZE==64
|
||||
#define PRIdC PRId64
|
||||
#define PRIxC PRIx64
|
||||
#elif PAWN_CELL_SIZE==32
|
||||
#define PRIdC "ld"
|
||||
#define PRIxC "lx"
|
||||
#else
|
||||
#define PRIdC "d"
|
||||
#define PRIxC "x"
|
||||
#endif
|
||||
|
||||
static stringlist dbgstrings = {NULL, NULL, 0, 0};
|
||||
|
||||
SC_FUNC stringlist *insert_dbgfile(const char *filename)
|
||||
|
Loading…
x
Reference in New Issue
Block a user