diff options
author | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2014-09-02 22:03:14 +0200 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2014-09-11 18:18:09 -0700 |
commit | 7a0c79c8c478bf22ee71c1ea35886a6f555ef2bb (patch) | |
tree | e9ea160a94ef8cb302d3ba3604b08db0aa6cccda /os | |
parent | da4bad620a6f1a58978f5279fda74da3c1c1d443 (diff) |
os/log: adjust gcc version conditions for #pragma
In commit e67f2d7e0f9189beb2907fa06cff5ecc7f35f922 ("gcc 4.2.1 doesn't
support #pragma GCC diagnostic ignored"), some compile time
conditionals were added around the #pragma usage. Those conditionals
ensure that the #pragma are not used on gcc <= 4.2.
However, the usage of #pragma diagnostic inside functions was only
added in gcc 4.6, and a build failure is therefore experienced with
gcc 4.5:
log.c: In function 'LogInit':
log.c:199:9: error: #pragma GCC diagnostic not allowed inside functions
log.c:201:9: warning: format not a string literal, argument types not checked
log.c:212:9: error: #pragma GCC diagnostic not allowed inside functions
log.c:214:17: warning: format not a string literal, argument types not checked
$ ./host/usr/bin/powerpc-linux-gnu-gcc -v
[...]
gcc version 4.5.2 (Sourcery G++ Lite 2011.03-38)
This patch therefore adjusts the compile time conditionals to make
sure the #pragma is not used on gcc <= 4.5, and only used on gcc >=
4.6.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'os')
-rw-r--r-- | os/log.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -195,7 +195,7 @@ LogInit(const char *fname, const char *backup) char *logFileName = NULL; if (fname && *fname) { -#if __GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ > 2 +#if __GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ > 5 #pragma GCC diagnostic ignored "-Wformat-nonliteral" #endif if (asprintf(&logFileName, fname, display) == -1) @@ -208,7 +208,7 @@ LogInit(const char *fname, const char *backup) char *suffix; char *oldLog; -#if __GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ > 2 +#if __GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ > 5 #pragma GCC diagnostic ignored "-Wformat-nonliteral" #endif if ((asprintf(&suffix, backup, display) == -1) || |