Bläddra i källkod

Silence some pedantic compilation warnings.

Markus F.X.J. Oberhumer 9 år sedan
förälder
incheckning
026671b3d5
6 ändrade filer med 10 tillägg och 10 borttagningar
  1. 2 2
      include/sqconfig.h
  2. 2 3
      sq/sq.c
  3. 1 1
      sqstdlib/sqstdrex.cpp
  4. 3 3
      sqstdlib/sqstdstring.cpp
  5. 1 0
      squirrel/sqcompiler.cpp
  6. 1 1
      squirrel/sqopcodes.h

+ 2 - 2
include/sqconfig.h

@@ -60,10 +60,10 @@ typedef wchar_t SQChar;
 
 
 #define scstrcmp    wcscmp
-#ifdef _MSC_VER
+#ifdef _WIN32
 #define scsprintf   _snwprintf
 #else
-#define scsprintf   snwprintf
+#define scsprintf   swprintf
 #endif
 #define scstrlen    wcslen
 #define scstrtod    wcstod

+ 2 - 3
sq/sq.c

@@ -87,10 +87,10 @@ int getargs(HSQUIRRELVM v,int argc, char* argv[],SQInteger *retval)
 {
     int i;
     int compiles_only = 0;
+#ifdef SQUNICODE
     static SQChar temp[500];
-    const SQChar *ret=NULL;
+#endif
     char * output = NULL;
-    int lineinfo=0;
     *retval = 0;
     if(argc>1)
     {
@@ -307,7 +307,6 @@ int main(int argc, char* argv[])
 {
     HSQUIRRELVM v;
     SQInteger retval = 0;
-    const SQChar *filename=NULL;
 #if defined(_MSC_VER) && defined(_DEBUG)
     _CrtSetAllocHook(MemAllocHook);
 #endif

+ 1 - 1
sqstdlib/sqstdrex.cpp

@@ -550,7 +550,7 @@ static const SQChar *sqstd_rex_matchnode(SQRex* exp,SQRexNode *node,const SQChar
 /* public api */
 SQRex *sqstd_rex_compile(const SQChar *pattern,const SQChar **error)
 {
-    SQRex *exp = (SQRex *)sq_malloc(sizeof(SQRex));
+    SQRex * volatile exp = (SQRex *)sq_malloc(sizeof(SQRex)); // "volatile" is needed for setjmp()
     exp->_eol = exp->_bol = NULL;
     exp->_p = pattern;
     exp->_nallocated = (SQInteger)scstrlen(pattern) * sizeof(SQChar);

+ 3 - 3
sqstdlib/sqstdstring.cpp

@@ -94,9 +94,9 @@ SQRESULT sqstd_format(HSQUIRRELVM v,SQInteger nformatstringidx,SQInteger *outlen
             if(n < 0) return -1;
             SQInteger addlen = 0;
             SQInteger valtype = 0;
-            const SQChar *ts;
-            SQInteger ti;
-            SQFloat tf;
+            const SQChar *ts = NULL;
+            SQInteger ti = 0;
+            SQFloat tf = 0;
             switch(format[n]) {
             case 's':
                 if(SQ_FAILED(sq_getstring(v,nparam,&ts)))

+ 1 - 0
squirrel/sqcompiler.cpp

@@ -983,6 +983,7 @@ public:
             SQInteger key = _fs->PopTarget();
             SQInteger attrs = hasattrs ? _fs->PopTarget():-1;
             assert((hasattrs && (attrs == key-1)) || !hasattrs);
+            (void)attrs; // UNUSED
             unsigned char flags = (hasattrs?NEW_SLOT_ATTRIBUTES_FLAG:0)|(isstatic?NEW_SLOT_STATIC_FLAG:0);
             SQInteger table = _fs->TopTarget(); //<<BECAUSE OF THIS NO COMMON EMIT FUNC IS POSSIBLE
             if(separator == _SC(',')) { //hack recognizes a table from the separator

+ 1 - 1
squirrel/sqopcodes.h

@@ -110,7 +110,7 @@ struct SQInstruction
 {
     SQInstruction(){};
     SQInstruction(SQOpcode _op,SQInteger a0=0,SQInteger a1=0,SQInteger a2=0,SQInteger a3=0)
-    {   op = _op;
+    {   op = (unsigned char)_op;
         _arg0 = (unsigned char)a0;_arg1 = (SQInt32)a1;
         _arg2 = (unsigned char)a2;_arg3 = (unsigned char)a3;
     }