Fix "format not a string literal" errors
authorBastien Nocera <hadess@hadess.net>
Sat, 01 Oct 2016 10:36:24 -0700
changeset 10396fa4e35434a9c
parent 10395 99bdc4fc41ba
child 10397 3126026a822b
Fix "format not a string literal" errors
With GCC 6.1.

https://bugzilla.libsdl.org/show_bug.cgi?id=3375
src/SDL_error.c
src/test/SDL_test_log.c
     1.1 --- a/src/SDL_error.c	Fri Jul 01 16:47:27 2016 +0100
     1.2 +++ b/src/SDL_error.c	Sat Oct 01 10:36:24 2016 -0700
     1.3 @@ -116,6 +116,8 @@
     1.4      return -1;
     1.5  }
     1.6  
     1.7 +#pragma GCC diagnostic push
     1.8 +#pragma GCC diagnostic ignored "-Wformat-nonliteral"
     1.9  /* This function has a bit more overhead than most error functions
    1.10     so that it supports internationalization and thread-safe errors.
    1.11  */
    1.12 @@ -216,6 +218,7 @@
    1.13      }
    1.14      return (errstr);
    1.15  }
    1.16 +#pragma GCC diagnostic pop
    1.17  
    1.18  /* Available for backwards compatibility */
    1.19  const char *
     2.1 --- a/src/test/SDL_test_log.c	Fri Jul 01 16:47:27 2016 +0100
     2.2 +++ b/src/test/SDL_test_log.c	Sat Oct 01 10:36:24 2016 -0700
     2.3 @@ -50,6 +50,8 @@
     2.4   *
     2.5   * \return Ascii representation of the timestamp in localtime in the format '08/23/01 14:55:02'
     2.6   */
     2.7 +#pragma GCC diagnostic push
     2.8 +#pragma GCC diagnostic ignored "-Wformat-nonliteral"
     2.9  char *SDLTest_TimestampToString(const time_t timestamp)
    2.10  {
    2.11      time_t copy;
    2.12 @@ -64,6 +66,7 @@
    2.13  
    2.14      return buffer;
    2.15  }
    2.16 +#pragma GCC diagnostic pop
    2.17  
    2.18  /*
    2.19   * Prints given message with a timestamp in the TEST category and INFO priority.