shithub: libvpx

Download patch

ref: 2ed1830ca5bae0e8cd2e63dddbcc32261e838231
parent: 4529dc848332b78421c04408c8f8fe698ea0c21e
author: Johann <[email protected]>
date: Mon Nov 25 03:00:50 EST 2019

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

--- 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))