lkml.org 
[lkml]   [2016]   [May]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/2] test/hash: Fix warning in preprocessor symbol evaluation
> But here's an alternative.  Geert, what do you think of this?

Never mind; that doesn't work. Plain gcc-4.9 passes, it, but it's the
"-Wundef" flag that the kernel uses that triggers it.

So we're back to Geert's original suggestion.
Acked-by: George Spelvin <linux@sciencehorizons.net>

==>$ cat foo.c
#ifndef FOO
This is a test.
#elif FOO == 1
This is another test
#elif FOO + 0 == 1
who knows
#endif

==>$ gcc-6 -W -Wall -Wundef -E foo.c
# 1 "foo.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 31 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 32 "<command-line>" 2
# 1 "foo.c"

This is a test.

==>$ gcc-4.9 -W -Wall -Wundef -E foo.c
# 1 "foo.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 1 "<command-line>" 2
# 1 "foo.c"

foo.c:3:7: warning: "FOO" is not defined [-Wundef]
#elif FOO == 1
^
foo.c:5:7: warning: "FOO" is not defined [-Wundef]
#elif FOO + 0 == 1
^
This is a test.

\
 
 \ /
  Last update: 2016-05-29 21:21    [W:0.043 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site