summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohann Koenig <johannkoenig@google.com>2019-11-26 14:44:15 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2019-11-26 14:44:15 +0000
commitb8549ed8895303019730da9e7ffa7945d3ac4d0d (patch)
treecc379acad411499d80b61ed2bbfbeb5840ab67b2
parent8d211a3969ecf2d942edd5063a6d19317e5c28ec (diff)
parent2ed1830ca5bae0e8cd2e63dddbcc32261e838231 (diff)
downloadlibvpx-b8549ed8895303019730da9e7ffa7945d3ac4d0d.tar.gz
Merge "fix __has_attribute in visual studio"
-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))