summaryrefslogtreecommitdiff
path: root/vpx_ports
diff options
context:
space:
mode:
authorJohann <johannkoenig@google.com>2019-11-25 08:00:50 -0800
committerJohann <johannkoenig@google.com>2019-11-25 08:01:23 -0800
commit2ed1830ca5bae0e8cd2e63dddbcc32261e838231 (patch)
tree3e034da8c216dceaaaa2c9f4f76495fb5e888c2d /vpx_ports
parent4529dc848332b78421c04408c8f8fe698ea0c21e (diff)
downloadlibvpx-2ed1830ca5bae0e8cd2e63dddbcc32261e838231.tar
libvpx-2ed1830ca5bae0e8cd2e63dddbcc32261e838231.tar.gz
libvpx-2ed1830ca5bae0e8cd2e63dddbcc32261e838231.tar.bz2
libvpx-2ed1830ca5bae0e8cd2e63dddbcc32261e838231.zip
fix __has_attribute in visual studio
Similar to __has_feature, __has_attribute needs to be defined away on unsupported platforms. BUG=chromium:1020220,chromium:977230 Change-Id: I803fff0fef2b18b535604f3b7f9f8300e45f7ef8
Diffstat (limited to 'vpx_ports')
-rw-r--r--vpx_ports/mem.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/vpx_ports/mem.h b/vpx_ports/mem.h
index 737e9e071..4e9041304 100644
--- a/vpx_ports/mem.h
+++ b/vpx_ports/mem.h
@@ -51,13 +51,19 @@
#define VPX_WITH_ASAN 0
#endif // __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
+#if !defined(__has_attribute)
+#define __has_attribute(x) 0
+#endif // !defined(__has_attribute)
+
#if __has_attribute(uninitialized)
-// Attribute disables -ftrivial-auto-var-init=pattern for specific variables.
+// Attribute "uninitialized" disables -ftrivial-auto-var-init=pattern for
+// the specified variable.
+//
// -ftrivial-auto-var-init is security risk mitigation feature, so attribute
// should not be used "just in case", but only to fix real performance
-// bottlenecks when other approaches do not work. In general compiler is quite
-// effective eleminating unneeded initializations introduced by the flag, e.g.
-// when they are followed by actual initialization by a program.
+// bottlenecks when other approaches do not work. In general the compiler is
+// quite effective at eliminating unneeded initializations introduced by the
+// flag, e.g. when they are followed by actual initialization by a program.
// However if compiler optimization fails and code refactoring is hard, the
// attribute can be used as a workaround.
#define VPX_UNINITIALIZED __attribute__((uninitialized))