Don't redefine standard macros, use SDL specific macros instead to avoid compiler warnings
authorSam Lantinga <slouken@libsdl.org>
Mon, 23 Jun 2014 11:06:50 -0700
changeset 891723182cf59f1c
parent 8916 96d944f74851
child 8919 c9be8299ba6b
Don't redefine standard macros, use SDL specific macros instead to avoid compiler warnings
include/SDL_stdinc.h
src/test/SDL_test_harness.c
test/testgesture.c
     1.1 --- a/include/SDL_stdinc.h	Mon Jun 23 10:09:15 2014 -0700
     1.2 +++ b/include/SDL_stdinc.h	Mon Jun 23 11:06:50 2014 -0700
     1.3 @@ -168,18 +168,22 @@
     1.4  /* Make sure we have macros for printing 64 bit values.
     1.5   * <stdint.h> should define these but this is not true all platforms.
     1.6   * (for example win32) */
     1.7 -#ifndef PRIs64
     1.8 -#ifdef __WIN32__
     1.9 -#define PRIs64 "I64"
    1.10 +#ifndef SDL_PRIs64
    1.11 +#ifdef PRIs64
    1.12 +#define SDL_PRIs64 PRIs64
    1.13 +#elif defined(__WIN32__)
    1.14 +#define SDL_PRIs64 "I64"
    1.15  #else
    1.16 -#define PRIs64 "lld"
    1.17 +#define SDL_PRIs64 "lld"
    1.18  #endif
    1.19  #endif
    1.20 -#ifndef PRIu64
    1.21 -#ifdef __WIN32__
    1.22 -#define PRIu64 "I64u"
    1.23 +#ifndef SDL_PRIu64
    1.24 +#ifdef PRIu64
    1.25 +#define SDL_PRIu64 PRIu64
    1.26 +#elif defined(__WIN32__)
    1.27 +#define SDL_PRIu64 "I64u"
    1.28  #else
    1.29 -#define PRIu64 "llu"
    1.30 +#define SDL_PRIu64 "llu"
    1.31  #endif
    1.32  #endif
    1.33  
     2.1 --- a/src/test/SDL_test_harness.c	Mon Jun 23 10:09:15 2014 -0700
     2.2 +++ b/src/test/SDL_test_harness.c	Mon Jun 23 11:06:50 2014 -0700
     2.3 @@ -564,7 +564,7 @@
     2.4                              execKey = SDLTest_GenerateExecKey((char *)runSeed, testSuite->name, testCase->name, iterationCounter);
     2.5                          }
     2.6  
     2.7 -                        SDLTest_Log("Test Iteration %i: execKey %" PRIu64, iterationCounter, execKey);
     2.8 +                        SDLTest_Log("Test Iteration %i: execKey %" SDL_PRIu64, iterationCounter, execKey);
     2.9                          testResult = SDLTest_RunTest(testSuite, testCase, execKey);
    2.10  
    2.11                          if (testResult == TEST_RESULT_PASSED) {
     3.1 --- a/test/testgesture.c	Mon Jun 23 10:09:15 2014 -0700
     3.2 +++ b/test/testgesture.c	Mon Jun 23 11:06:50 2014 -0700
     3.3 @@ -244,19 +244,19 @@
     3.4          break;
     3.5        case SDL_FINGERMOTION:
     3.6  #if VERBOSE
     3.7 -        SDL_Log("Finger: %"PRIs64",x: %f, y: %f",event.tfinger.fingerId,
     3.8 +        SDL_Log("Finger: %"SDL_PRIs64",x: %f, y: %f",event.tfinger.fingerId,
     3.9                 event.tfinger.x,event.tfinger.y);
    3.10  #endif
    3.11          break;
    3.12        case SDL_FINGERDOWN:
    3.13  #if VERBOSE
    3.14 -        SDL_Log("Finger: %"PRIs64" down - x: %f, y: %f",
    3.15 +        SDL_Log("Finger: %"SDL_PRIs64" down - x: %f, y: %f",
    3.16             event.tfinger.fingerId,event.tfinger.x,event.tfinger.y);
    3.17  #endif
    3.18          break;
    3.19        case SDL_FINGERUP:
    3.20  #if VERBOSE
    3.21 -        SDL_Log("Finger: %"PRIs64" up - x: %f, y: %f",
    3.22 +        SDL_Log("Finger: %"SDL_PRIs64" up - x: %f, y: %f",
    3.23                 event.tfinger.fingerId,event.tfinger.x,event.tfinger.y);
    3.24  #endif
    3.25          break;
    3.26 @@ -275,12 +275,12 @@
    3.27          knob.r += event.mgesture.dDist;
    3.28          break;
    3.29        case SDL_DOLLARGESTURE:
    3.30 -        SDL_Log("Gesture %"PRIs64" performed, error: %f",
    3.31 +        SDL_Log("Gesture %"SDL_PRIs64" performed, error: %f",
    3.32             event.dgesture.gestureId,
    3.33             event.dgesture.error);
    3.34          break;
    3.35        case SDL_DOLLARRECORD:
    3.36 -        SDL_Log("Recorded gesture: %"PRIs64"",event.dgesture.gestureId);
    3.37 +        SDL_Log("Recorded gesture: %"SDL_PRIs64"",event.dgesture.gestureId);
    3.38          break;
    3.39        }
    3.40        }