Skip to content

Commit

Permalink
Fix "format not a string literal" errors
Browse files Browse the repository at this point in the history
  • Loading branch information
hadess committed Oct 1, 2016
1 parent 461336a commit 7edd226
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/SDL_error.c
Expand Up @@ -116,6 +116,8 @@ SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
return -1;
}

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
/* This function has a bit more overhead than most error functions
so that it supports internationalization and thread-safe errors.
*/
Expand Down Expand Up @@ -216,6 +218,7 @@ SDL_GetErrorMsg(char *errstr, int maxlen)
}
return (errstr);
}
#pragma GCC diagnostic pop

/* Available for backwards compatibility */
const char *
Expand Down
3 changes: 3 additions & 0 deletions src/test/SDL_test_log.c
Expand Up @@ -50,6 +50,8 @@
*
* \return Ascii representation of the timestamp in localtime in the format '08/23/01 14:55:02'
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
char *SDLTest_TimestampToString(const time_t timestamp)
{
time_t copy;
Expand All @@ -64,6 +66,7 @@ char *SDLTest_TimestampToString(const time_t timestamp)

return buffer;
}
#pragma GCC diagnostic pop

/*
* Prints given message with a timestamp in the TEST category and INFO priority.
Expand Down

0 comments on commit 7edd226

Please sign in to comment.