]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - libs/splines/util_str.cpp
Centralise compile checks
[xonotic/netradiant.git] / libs / splines / util_str.cpp
index 8ac9dea3a8f5a80781f18ff1013898304dcbbe73..c64ca73b7f52acac1edbb1bbb07c2ee3e36efafb 100644 (file)
@@ -27,7 +27,7 @@
 #include <stdio.h>
 #include <stdarg.h>
 
-#ifdef _WIN32
+#if GDEF_COMPILER_MSVC
 #pragma warning(disable : 4244)     // 'conversion' conversion from 'type1' to 'type2', possible loss of data
 #pragma warning(disable : 4710)     // function 'blah' not inlined
 #endif
@@ -455,7 +455,7 @@ void idStr::snprintf
        strncpy( dst, buffer, size - 1 );
 }
 
-#ifdef _WIN32
+#if GDEF_COMPILER_MSVC
 #pragma warning(disable : 4189)     // local variable is initialized but not referenced
 #endif
 
@@ -475,21 +475,20 @@ void TestStringClass
        void
 ){
        char ch;                            // ch == ?
+       (void) ch;
        idStr   *t;                         // t == ?
        idStr a;                                // a.len == 0, a.data == "\0"
        idStr b;                                // b.len == 0, b.data == "\0"
        idStr c( "test" );                  // c.len == 4, c.data == "test\0"
        idStr d( c );                       // d.len == 4, d.data == "test\0"
-       idStr e( reinterpret_cast<const char *>( NULL ) );
+       idStr e( static_cast<const char *>( NULL ) );
        // e.len == 0, e.data == "\0"                                   ASSERT!
        int i;                              // i == ?
+       (void) i;
 
        i = a.length();                 // i == 0
        i = c.length();                 // i == 4
 
-       const char *s1 = a.c_str(); // s1 == "\0"
-       const char *s2 = c.c_str(); // s2 == "test\0"
-
        t = new idStr();                        // t->len == 0, t->data == "\0"
        delete t;                           // t == ?
 
@@ -502,14 +501,14 @@ void TestStringClass
        a = NULL;                           // a.len == 0, a.data == "\0"                                       ASSERT!
        a = c + d;                          // a.len == 8, a.data == "testtest\0"
        a = c + "wow";                      // a.len == 7, a.data == "testwow\0"
-       a = c + reinterpret_cast<const char *>( NULL );
+       a = c + static_cast<const char *>( NULL );
        // a.len == 4, a.data == "test\0"                       ASSERT!
        a = "this" + d;                 // a.len == 8, a.data == "thistest\0"
-       a = reinterpret_cast<const char *>( NULL ) + d;
+       a = static_cast<const char *>( NULL ) + d;
        // a.len == 4, a.data == "test\0"                       ASSERT!
        a += c;                             // a.len == 8, a.data == "testtest\0"
        a += "wow";                         // a.len == 11, a.data == "testtestwow\0"
-       a += reinterpret_cast<const char *>( NULL );
+       a += static_cast<const char *>( NULL );
        // a.len == 11, a.data == "testtestwow\0"       ASSERT!
 
        a = "test";                         // a.len == 4, a.data == "test\0"
@@ -572,7 +571,7 @@ void TestStringClass
        a[1] = '1';                  // a.data = "t1st", b.data = "test"
 }
 
-#ifdef _WIN32
+#if GDEF_COMPILER_MSVC
 #pragma warning(default : 4189)     // local variable is initialized but not referenced
 #pragma warning(disable : 4514)     // unreferenced inline function has been removed
 #endif