From d3da389f9f9b3a470bf83aa47275b7aa493d2d7b Mon Sep 17 00:00:00 2001 From: Fyren Date: Fri, 6 Mar 2015 06:27:37 +0000 Subject: [PATCH] Signed comparison warning fixes. --- sourcepawn/compiler/AMBuilder | 1 - sourcepawn/compiler/sc.h | 12 ++++++------ sourcepawn/compiler/sc2.cpp | 20 +++++++++++--------- sourcepawn/compiler/sc3.cpp | 3 ++- sourcepawn/compiler/sc4.cpp | 3 ++- sourcepawn/compiler/sc5-in.scp | 2 +- sourcepawn/compiler/sc5.cpp | 2 +- sourcepawn/compiler/sc6.cpp | 2 +- sourcepawn/compiler/sc7-in.scp | 2 +- sourcepawn/compiler/sc7.cpp | 6 +++--- sourcepawn/compiler/scexpand.cpp | 4 ++-- sourcepawn/compiler/sclist.cpp | 2 +- sourcepawn/include/smx/smx-v1-opcodes.h | 4 +++- sourcepawn/jit/file-utils.cpp | 2 +- sourcepawn/jit/stack-frames.cpp | 8 ++++---- sourcepawn/jit/stack-frames.h | 10 +++++----- 16 files changed, 44 insertions(+), 39 deletions(-) diff --git a/sourcepawn/compiler/AMBuilder b/sourcepawn/compiler/AMBuilder index ad687627..b716d6bd 100644 --- a/sourcepawn/compiler/AMBuilder +++ b/sourcepawn/compiler/AMBuilder @@ -53,7 +53,6 @@ compiler.sourcedeps += packed_includes if compiler.cc.behavior == 'gcc': compiler.cflags += ['-Wno-format'] - compiler.cflags += ['-Wno-error=sign-compare'] compiler.c_only_flags += ['-std=c99'] if builder.target_platform == 'linux': compiler.postlink += ['-lm'] diff --git a/sourcepawn/compiler/sc.h b/sourcepawn/compiler/sc.h index 9399ed47..ae1b06e3 100644 --- a/sourcepawn/compiler/sc.h +++ b/sourcepawn/compiler/sc.h @@ -565,12 +565,12 @@ typedef enum s_optmark { #define suSLEEP_INSTR 0x01 /* the "sleep" instruction was used */ -#define FIXEDTAG 0x40000000Lu -#define FUNCTAG 0x20000000Lu -#define OBJECTTAG 0x10000000Lu -#define ENUMTAG 0x08000000Lu -#define METHODMAPTAG 0x04000000Lu -#define STRUCTTAG 0x02000000Lu +#define FIXEDTAG 0x40000000 +#define FUNCTAG 0x20000000 +#define OBJECTTAG 0x10000000 +#define ENUMTAG 0x08000000 +#define METHODMAPTAG 0x04000000 +#define STRUCTTAG 0x02000000 #define TAGTYPEMASK (FUNCTAG | OBJECTTAG | ENUMTAG | METHODMAPTAG | STRUCTTAG) #define TAGFLAGMASK (FIXEDTAG | TAGTYPEMASK) #define TAGID(tag) ((tag) & ~(TAGFLAGMASK)) diff --git a/sourcepawn/compiler/sc2.cpp b/sourcepawn/compiler/sc2.cpp index ebbf3986..f2523586 100644 --- a/sourcepawn/compiler/sc2.cpp +++ b/sourcepawn/compiler/sc2.cpp @@ -150,7 +150,7 @@ int plungequalifiedfile(char *name) void *fp; char *ext; - int ext_idx; + size_t ext_idx; ext_idx=0; do { @@ -258,7 +258,8 @@ static void doinclude(int silent) { char name[_MAX_PATH]; char c; - int i, result; + size_t i; + int result; while (*lptr<=' ' && *lptr!='\0') /* skip leading whitespace */ lptr++; @@ -276,7 +277,7 @@ static void doinclude(int silent) name[i++]=*lptr++; while (i>0 && name[i-1]<=' ') i--; /* strip trailing whitespace */ - assert(i>=0 && i0); } /* for */ diff --git a/sourcepawn/compiler/sc7-in.scp b/sourcepawn/compiler/sc7-in.scp index ddbfb9b8..7cd69b54 100644 --- a/sourcepawn/compiler/sc7-in.scp +++ b/sourcepawn/compiler/sc7-in.scp @@ -22,7 +22,7 @@ * Version: $Id$ */ -int strexpand(char *dest, unsigned char *source, int maxlen, unsigned char pairtable[128][2]); +size_t strexpand(char *dest, unsigned char *source, size_t maxlen, unsigned char pairtable[128][2]); #define SCPACK_TERMINATOR , /* end each section with a comma */ diff --git a/sourcepawn/compiler/sc7.cpp b/sourcepawn/compiler/sc7.cpp index 99763956..8b417eee 100644 --- a/sourcepawn/compiler/sc7.cpp +++ b/sourcepawn/compiler/sc7.cpp @@ -400,7 +400,7 @@ static SEQUENCE *sequences; int phopt_init(void) { - int number, i, len; + size_t number, i, len; char str[160]; /* count number of sequences */ @@ -422,13 +422,13 @@ int phopt_init(void) for (i=0; i 0); len = 1; /* already 1 byte for '\0' */ diff --git a/sourcepawn/compiler/sclist.cpp b/sourcepawn/compiler/sclist.cpp index bcf7192b..a8cec15a 100644 --- a/sourcepawn/compiler/sclist.cpp +++ b/sourcepawn/compiler/sclist.cpp @@ -359,7 +359,7 @@ int delete_subst(char *name,int length) void delete_substtable(void) { - int i; + size_t i; delete_stringpairtable(&substpair); for (i=0; i bytes(new uint8_t[size]); - if (!bytes || fread(bytes, sizeof(uint8_t), size, fp) != size) + if (!bytes || fread(bytes, sizeof(uint8_t), size, fp) != (size_t)size) return; buffer_ = bytes.take(); diff --git a/sourcepawn/jit/stack-frames.cpp b/sourcepawn/jit/stack-frames.cpp index c14ca03e..40206cff 100644 --- a/sourcepawn/jit/stack-frames.cpp +++ b/sourcepawn/jit/stack-frames.cpp @@ -21,7 +21,7 @@ using namespace ke; using namespace sp; using namespace SourcePawn; -InvokeFrame::InvokeFrame(PluginContext *cx, cell_t entry_cip) +InvokeFrame::InvokeFrame(PluginContext *cx, ucell_t entry_cip) : prev_(Environment::get()->top()), cx_(cx), prev_exit_frame_(Environment::get()->exit_frame()), @@ -82,7 +82,7 @@ FrameIterator::nextInvokeFrame() assert(sp_stop_ >= sp_iter_); runtime_ = ivk_->cx()->runtime(); - function_cip_ = -1; + function_cip_ = kInvalidCip; pc_ = nullptr; cip_ = kInvalidCip; @@ -170,7 +170,7 @@ FrameIterator::findCip() const unsigned FrameIterator::LineNumber() const { - cell_t cip = findCip(); + ucell_t cip = findCip(); if (cip == kInvalidCip) return 0; @@ -184,7 +184,7 @@ FrameIterator::LineNumber() const const char * FrameIterator::FilePath() const { - cell_t cip = findCip(); + ucell_t cip = findCip(); if (cip == kInvalidCip) return runtime_->image()->LookupFile(function_cip_); diff --git a/sourcepawn/jit/stack-frames.h b/sourcepawn/jit/stack-frames.h index 6269cb48..2ab3b0da 100644 --- a/sourcepawn/jit/stack-frames.h +++ b/sourcepawn/jit/stack-frames.h @@ -64,7 +64,7 @@ class ExitFrame class InvokeFrame { public: - InvokeFrame(PluginContext *cx, cell_t cip); + InvokeFrame(PluginContext *cx, ucell_t cip); ~InvokeFrame(); InvokeFrame *prev() const { @@ -80,7 +80,7 @@ class InvokeFrame const intptr_t *entry_sp() const { return entry_sp_; } - cell_t entry_cip() const { + ucell_t entry_cip() const { return entry_cip_; } @@ -93,7 +93,7 @@ class InvokeFrame InvokeFrame *prev_; PluginContext *cx_; ExitFrame prev_exit_frame_; - cell_t entry_cip_; + ucell_t entry_cip_; const intptr_t *entry_sp_; }; @@ -125,8 +125,8 @@ class FrameIterator : public SourcePawn::IFrameIterator PluginRuntime *runtime_; const intptr_t *sp_iter_; const intptr_t *sp_stop_; - cell_t function_cip_; - mutable cell_t cip_; + ucell_t function_cip_; + mutable ucell_t cip_; void *pc_; };