ref: b8549ed8895303019730da9e7ffa7945d3ac4d0d
parent: 8d211a3969ecf2d942edd5063a6d19317e5c28ec
parent: 2ed1830ca5bae0e8cd2e63dddbcc32261e838231
author: Johann Koenig <johannkoenig@google.com>
date: Tue Nov 26 09:44:15 EST 2019
Merge "fix __has_attribute in visual studio"
--- 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))