diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2019-01-02 23:57:49 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-02-27 12:08:53 +0300 |
commit | 4047a7ad3b2e87534116dba0c228a0f5f3ced537 (patch) | |
tree | 069941a23766364e87060e3a84383f995f7504e0 /include/linux/compiler-gcc.h | |
parent | 93f3f4c0fdeb084e5d46e379be7c1d49d97b1c57 (diff) | |
download | linux-4047a7ad3b2e87534116dba0c228a0f5f3ced537.tar.xz |
include/linux/compiler*.h: fix OPTIMIZER_HIDE_VAR
[ Upstream commit 3e2ffd655cc6a694608d997738989ff5572a8266 ]
Since commit 815f0ddb346c ("include/linux/compiler*.h: make compiler-*.h
mutually exclusive") clang no longer reuses the OPTIMIZER_HIDE_VAR macro
from compiler-gcc - instead it gets the version in
include/linux/compiler.h. Unfortunately that version doesn't actually
prevent compiler from optimizing out the variable.
Fix up by moving the macro out from compiler-gcc.h to compiler.h.
Compilers without incline asm support will keep working
since it's protected by an ifdef.
Also fix up comments to match reality since we are no longer overriding
any macros.
Build-tested with gcc and clang.
Fixes: 815f0ddb346c ("include/linux/compiler*.h: make compiler-*.h mutually exclusive")
Cc: Eli Friedman <efriedma@codeaurora.org>
Cc: Joe Perches <joe@perches.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include/linux/compiler-gcc.h')
-rw-r--r-- | include/linux/compiler-gcc.h | 4 |
1 files changed, 0 insertions, 4 deletions
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h index 0242f6eec4ea..a8ff0ca0c321 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h @@ -58,10 +58,6 @@ (typeof(ptr)) (__ptr + (off)); \ }) -/* Make the optimizer believe the variable can be manipulated arbitrarily. */ -#define OPTIMIZER_HIDE_VAR(var) \ - __asm__ ("" : "=r" (var) : "0" (var)) - /* * A trick to suppress uninitialized variable warning without generating any * code |