xserver: Move 'pragma GCC diagnostic' outside functions
$ gcc --version gcc (Gentoo 4.4.3-r2 p1.2) 4.4.3 /jhbuild/checkout/xorg/xserver/os/log.c: In function ‘LogInit’: /jhbuild/checkout/xorg/xserver/os/log.c:199: error: #pragma GCC diagnostic not allowed inside functions /jhbuild/checkout/xorg/xserver/os/log.c:201: warning: format not a string literal, argument types not checked /jhbuild/checkout/xorg/xserver/os/log.c:212: error: #pragma GCC diagnostic not allowed inside functions /jhbuild/checkout/xorg/xserver/os/log.c:214: warning: format not a string literal, argument types not checked etc. Reviewed-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk> Signed-off-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
parent
7e6bd54684
commit
28337cb14e
|
@ -76,6 +76,9 @@ switch_to(int vt, const char *from)
|
||||||
FatalError("%s: VT_WAITACTIVE failed: %s\n", from, strerror(errno));
|
FatalError("%s: VT_WAITACTIVE failed: %s\n", from, strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||||
|
|
||||||
void
|
void
|
||||||
xf86OpenConsole(void)
|
xf86OpenConsole(void)
|
||||||
{
|
{
|
||||||
|
@ -166,7 +169,6 @@ xf86OpenConsole(void)
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while (vcs[i] != NULL) {
|
while (vcs[i] != NULL) {
|
||||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
|
||||||
snprintf(vtname, sizeof(vtname), vcs[i], xf86Info.vtno); /* /dev/tty1-64 */
|
snprintf(vtname, sizeof(vtname), vcs[i], xf86Info.vtno); /* /dev/tty1-64 */
|
||||||
if ((xf86Info.consoleFd = open(vtname, O_RDWR | O_NDELAY, 0)) >= 0)
|
if ((xf86Info.consoleFd = open(vtname, O_RDWR | O_NDELAY, 0)) >= 0)
|
||||||
break;
|
break;
|
||||||
|
@ -272,6 +274,8 @@ xf86OpenConsole(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
void
|
void
|
||||||
xf86CloseConsole(void)
|
xf86CloseConsole(void)
|
||||||
{
|
{
|
||||||
|
|
10
os/log.c
10
os/log.c
|
@ -189,15 +189,15 @@ strlen_sigsafe(const char *s)
|
||||||
* string.
|
* string.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
LogInit(const char *fname, const char *backup)
|
LogInit(const char *fname, const char *backup)
|
||||||
{
|
{
|
||||||
char *logFileName = NULL;
|
char *logFileName = NULL;
|
||||||
|
|
||||||
if (fname && *fname) {
|
if (fname && *fname) {
|
||||||
#if __GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ > 5
|
|
||||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
|
||||||
#endif
|
|
||||||
if (asprintf(&logFileName, fname, display) == -1)
|
if (asprintf(&logFileName, fname, display) == -1)
|
||||||
FatalError("Cannot allocate space for the log file name\n");
|
FatalError("Cannot allocate space for the log file name\n");
|
||||||
|
|
||||||
|
@ -208,9 +208,6 @@ LogInit(const char *fname, const char *backup)
|
||||||
char *suffix;
|
char *suffix;
|
||||||
char *oldLog;
|
char *oldLog;
|
||||||
|
|
||||||
#if __GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ > 5
|
|
||||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
|
||||||
#endif
|
|
||||||
if ((asprintf(&suffix, backup, display) == -1) ||
|
if ((asprintf(&suffix, backup, display) == -1) ||
|
||||||
(asprintf(&oldLog, "%s%s", logFileName, suffix) == -1))
|
(asprintf(&oldLog, "%s%s", logFileName, suffix) == -1))
|
||||||
FatalError("Cannot allocate space for the log file name\n");
|
FatalError("Cannot allocate space for the log file name\n");
|
||||||
|
@ -254,6 +251,7 @@ LogInit(const char *fname, const char *backup)
|
||||||
|
|
||||||
return logFileName;
|
return logFileName;
|
||||||
}
|
}
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
void
|
void
|
||||||
LogClose(enum ExitCode error)
|
LogClose(enum ExitCode error)
|
||||||
|
|
|
@ -113,12 +113,13 @@ double float_tests[] = { 0, 5, 0.1, 0.01, 5.2342, 10.2301,
|
||||||
-1, -2.00, -0.6023, -1203.30
|
-1, -2.00, -0.6023, -1203.30
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Woverflow"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
number_formatting(void)
|
number_formatting(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic ignored "-Woverflow"
|
|
||||||
long unsigned int unsigned_tests[] = { 0,/* Zero */
|
long unsigned int unsigned_tests[] = { 0,/* Zero */
|
||||||
5, /* Single digit number */
|
5, /* Single digit number */
|
||||||
12, /* Two digit decimal number */
|
12, /* Two digit decimal number */
|
||||||
|
@ -141,7 +142,6 @@ number_formatting(void)
|
||||||
-0x15D027BF211B37A, /* Large > 32 bit number */
|
-0x15D027BF211B37A, /* Large > 32 bit number */
|
||||||
-0x7FFFFFFFFFFFFFFF, /* Maximum 64-bit signed number */
|
-0x7FFFFFFFFFFFFFFF, /* Maximum 64-bit signed number */
|
||||||
} ;
|
} ;
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
|
|
||||||
for (i = 0; i < sizeof(unsigned_tests) / sizeof(unsigned_tests[0]); i++)
|
for (i = 0; i < sizeof(unsigned_tests) / sizeof(unsigned_tests[0]); i++)
|
||||||
assert(check_number_format_test(unsigned_tests[i]));
|
assert(check_number_format_test(unsigned_tests[i]));
|
||||||
|
@ -152,6 +152,7 @@ number_formatting(void)
|
||||||
for (i = 0; i < sizeof(float_tests) / sizeof(float_tests[0]); i++)
|
for (i = 0; i < sizeof(float_tests) / sizeof(float_tests[0]); i++)
|
||||||
assert(check_float_format_test(float_tests[i]));
|
assert(check_float_format_test(float_tests[i]));
|
||||||
}
|
}
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wformat-security"
|
#pragma GCC diagnostic ignored "-Wformat-security"
|
||||||
|
|
Loading…
Reference in New Issue