Similar to __has_feature, __has_attribute needs to be defined away on unsupported platforms. BUG=chromium:1020220,chromium:977230
Unified · Split
| @@ -51,13 +51,19 @@ · 50 unmodified lines | |||
| 51 | #define VPX_WITH_ASAN 0 | 51 | #define VPX_WITH_ASAN 0 |
| 52 | #endif // __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__) | 52 | #endif // __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__) |
| 53 | 53 | ||
| 54 | #if !defined(__has_attribute) | ||
| 55 | #define __has_attribute(x) 0 | ||
| 56 | #endif // !defined(__has_attribute) | ||
| 57 | |||
| 54 | #if __has_attribute(uninitialized) | 58 | #if __has_attribute(uninitialized) |
| 55 | // Attribute disables -ftrivial-auto-var-init=pattern for specific variables. | 59 | // Attribute "uninitialized" disables -ftrivial-auto-var-init=pattern for |
| 60 | // the specified variable. | ||
| 61 | // | ||
| 56 | // -ftrivial-auto-var-init is security risk mitigation feature, so attribute | 62 | // -ftrivial-auto-var-init is security risk mitigation feature, so attribute |
| 57 | // should not be used "just in case", but only to fix real performance | 63 | // should not be used "just in case", but only to fix real performance |
| 58 | // bottlenecks when other approaches do not work. In general compiler is quite | 64 | // bottlenecks when other approaches do not work. In general the compiler is |
| 59 | // effective eleminating unneeded initializations introduced by the flag, e.g. | 65 | // quite effective at eliminating unneeded initializations introduced by the |
| 60 | // when they are followed by actual initialization by a program. | 66 | // flag, e.g. when they are followed by actual initialization by a program. |
| 61 | // However if compiler optimization fails and code refactoring is hard, the | 67 | // However if compiler optimization fails and code refactoring is hard, the |
| 62 | // attribute can be used as a workaround. | 68 | // attribute can be used as a workaround. |
| 63 | #define VPX_UNINITIALIZED __attribute__((uninitialized)) | 69 | #define VPX_UNINITIALIZED __attribute__((uninitialized)) |