From 76316d4013d907a7f63a9b10048d0f58d4b47474 Mon Sep 17 00:00:00 2001
From: James Zern <[EMAIL REDACTED]>
Date: Thu, 15 Aug 2024 16:21:14 -0700
Subject: [PATCH] remove redundant `&& __GNUC__` preproc check
`#if defined(__GNUC__)` is enough if a specific version isn't being
looked for.
Bug: aomedia:356832974
Change-Id: I3fcbecf9d547c6a2d89d7b5456e83ee08ddc6f5e
---
aom/aom_codec.h | 6 +++---
aom_ports/mem.h | 2 +-
aom_ports/x86.h | 12 ++++++------
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/aom/aom_codec.h b/aom/aom_codec.h
index de22d7fb03..1e589ca574 100644
--- a/aom/aom_codec.h
+++ b/aom/aom_codec.h
@@ -102,7 +102,7 @@ extern "C" {
/*!\brief Decorator indicating a function is deprecated */
#ifndef AOM_DEPRECATED
-#if defined(__GNUC__) && __GNUC__
+#if defined(__GNUC__)
#define AOM_DEPRECATED __attribute__((deprecated))
#elif defined(_MSC_VER)
#define AOM_DEPRECATED
@@ -112,7 +112,7 @@ extern "C" {
#endif /* AOM_DEPRECATED */
#ifndef AOM_DECLSPEC_DEPRECATED
-#if defined(__GNUC__) && __GNUC__
+#if defined(__GNUC__)
#define AOM_DECLSPEC_DEPRECATED /**< \copydoc #AOM_DEPRECATED */
#elif defined(_MSC_VER)
/*!\brief \copydoc #AOM_DEPRECATED */
@@ -132,7 +132,7 @@ extern "C" {
/*!\brief Decorator indicating that given struct/union/enum is packed */
#ifndef ATTRIBUTE_PACKED
-#if defined(__GNUC__) && __GNUC__
+#if defined(__GNUC__)
#define ATTRIBUTE_PACKED __attribute__((packed))
#elif defined(_MSC_VER)
#define ATTRIBUTE_PACKED
diff --git a/aom_ports/mem.h b/aom_ports/mem.h
index fd33290330..df736a1846 100644
--- a/aom_ports/mem.h
+++ b/aom_ports/mem.h
@@ -15,7 +15,7 @@
#include "aom/aom_integer.h"
#include "config/aom_config.h"
-#if (defined(__GNUC__) && __GNUC__) || defined(__SUNPRO_C)
+#if defined(__GNUC__) || defined(__SUNPRO_C)
#define DECLARE_ALIGNED(n, typ, val) typ val __attribute__((aligned(n)))
#elif defined(_MSC_VER)
#define DECLARE_ALIGNED(n, typ, val) __declspec(align(n)) typ val
diff --git a/aom_ports/x86.h b/aom_ports/x86.h
index 1d2acefc59..3d27a2e83a 100644
--- a/aom_ports/x86.h
+++ b/aom_ports/x86.h
@@ -43,7 +43,7 @@ typedef enum {
AOM_CPU_LAST
} aom_cpu_t;
-#if defined(__GNUC__) && __GNUC__ || defined(__ANDROID__)
+#if defined(__GNUC__) || defined(__ANDROID__)
#if AOM_ARCH_X86_64
#define cpuid(func, func2, ax, bx, cx, dx) \
__asm__ __volatile__("cpuid \n\t" \
@@ -249,7 +249,7 @@ static inline int x86_simd_caps(void) {
// x86_readtsc64 to read the timestamp counter in a 64-bit integer. The
// out-of-order leakage that can occur is minimal compared to total runtime.
static inline unsigned int x86_readtsc(void) {
-#if defined(__GNUC__) && __GNUC__
+#if defined(__GNUC__)
unsigned int tsc;
__asm__ __volatile__("rdtsc\n\t" : "=a"(tsc) :);
return tsc;
@@ -267,7 +267,7 @@ static inline unsigned int x86_readtsc(void) {
}
// 64-bit CPU cycle counter
static inline uint64_t x86_readtsc64(void) {
-#if defined(__GNUC__) && __GNUC__
+#if defined(__GNUC__)
uint32_t hi, lo;
__asm__ __volatile__("rdtsc" : "=a"(lo), "=d"(hi));
return ((uint64_t)hi << 32) | lo;
@@ -286,7 +286,7 @@ static inline uint64_t x86_readtsc64(void) {
// 32-bit CPU cycle counter with a partial fence against out-of-order execution.
static inline unsigned int x86_readtscp(void) {
-#if defined(__GNUC__) && __GNUC__
+#if defined(__GNUC__)
unsigned int tscp;
__asm__ __volatile__("rdtscp\n\t" : "=a"(tscp) :);
return tscp;
@@ -331,7 +331,7 @@ static inline unsigned int x86_tsc_end(void) {
return v;
}
-#if defined(__GNUC__) && __GNUC__
+#if defined(__GNUC__)
#define x86_pause_hint() __asm__ __volatile__("pause \n\t")
#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
#define x86_pause_hint() asm volatile("pause \n\t")
@@ -343,7 +343,7 @@ static inline unsigned int x86_tsc_end(void) {
#endif
#endif
-#if defined(__GNUC__) && __GNUC__
+#if defined(__GNUC__)
static void x87_set_control_word(unsigned short mode) {
__asm__ __volatile__("fldcw %0" : : "m"(*&mode));
}