From c2073823b4d69652580691b73b01ed87619e20be Mon Sep 17 00:00:00 2001 From: Frank Barchard Date: Mon, 24 Oct 2016 18:02:48 -0700 Subject: [PATCH] use __OPTIMIZE__ macro to determine debug vs release. Debug builds of x86 gcc/clang can run out of register. Previously NDEBUG or _DEBUG was used to detect a debug build. But those macros are not set by gentoo builds. This CL switches to the compiler predefine __OPTIMIZE__ which is built into clang and gcc. BUG=libyuv:602 TEST=untested R=wangcheng@google.com Review URL: https://codereview.chromium.org/2451503002 . --- README.chromium | 2 +- include/libyuv/row.h | 5 ++--- include/libyuv/version.h | 2 +- source/row_gcc.cc | 6 +++--- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/README.chromium b/README.chromium index c14ba8429..e1f081edb 100644 --- a/README.chromium +++ b/README.chromium @@ -1,6 +1,6 @@ Name: libyuv URL: http://code.google.com/p/libyuv/ -Version: 1630 +Version: 1631 License: BSD License File: LICENSE diff --git a/include/libyuv/row.h b/include/libyuv/row.h index 04ef2250b..1187a1ed2 100644 --- a/include/libyuv/row.h +++ b/include/libyuv/row.h @@ -174,8 +174,7 @@ extern "C" { // The following functions fail on gcc/clang 32 bit with fpic and framepointer. // caveat: clangcl uses row_win.cc which works. -#if defined(NDEBUG) || !(defined(_DEBUG) && defined(__i386__)) || \ - !defined(__i386__) || defined(_MSC_VER) +#if defined(__x86_64__) || defined(__OPTIMIZE__) || defined(_MSC_VER) // TODO(fbarchard): fix build error on android_full_debug=1 // https://code.google.com/p/libyuv/issues/detail?id=517 #define HAS_I422ALPHATOARGBROW_SSSE3 @@ -235,7 +234,7 @@ extern "C" { #define HAS_ARGBUNATTENUATEROW_AVX2 #define HAS_BLENDPLANEROW_AVX2 -#if !(defined(_DEBUG) && defined(__i386__)) +#if defined(__x86_64__) || defined(__OPTIMIZE__) || defined(_MSC_VER) // TODO(fbarchard): fix build error on android_full_debug=1 // https://code.google.com/p/libyuv/issues/detail?id=517 #define HAS_I422ALPHATOARGBROW_AVX2 diff --git a/include/libyuv/version.h b/include/libyuv/version.h index 17a9c6660..3c0cc02c6 100644 --- a/include/libyuv/version.h +++ b/include/libyuv/version.h @@ -11,6 +11,6 @@ #ifndef INCLUDE_LIBYUV_VERSION_H_ #define INCLUDE_LIBYUV_VERSION_H_ -#define LIBYUV_VERSION 1630 +#define LIBYUV_VERSION 1631 #endif // INCLUDE_LIBYUV_VERSION_H_ diff --git a/source/row_gcc.cc b/source/row_gcc.cc index bc15c7719..1f76abd7f 100644 --- a/source/row_gcc.cc +++ b/source/row_gcc.cc @@ -1708,7 +1708,7 @@ void OMITFP I422ToRGB24Row_SSSE3(const uint8* y_buf, [u_buf]"+r"(u_buf), // %[u_buf] [v_buf]"+r"(v_buf), // %[v_buf] [dst_rgb24]"+r"(dst_rgb24), // %[dst_rgb24] -#if defined(__i386__) && defined(__pic__) +#if defined(__i386__) [width]"+m"(width) // %[width] #else [width]"+rm"(width) // %[width] @@ -1772,7 +1772,7 @@ void OMITFP I422AlphaToARGBRow_SSSE3(const uint8* y_buf, [v_buf]"+r"(v_buf), // %[v_buf] [a_buf]"+r"(a_buf), // %[a_buf] [dst_argb]"+r"(dst_argb), // %[dst_argb] -#if defined(__i386__) && defined(__pic__) +#if defined(__i386__) [width]"+m"(width) // %[width] #else [width]"+rm"(width) // %[width] @@ -2152,7 +2152,7 @@ void OMITFP I422AlphaToARGBRow_AVX2(const uint8* y_buf, [v_buf]"+r"(v_buf), // %[v_buf] [a_buf]"+r"(a_buf), // %[a_buf] [dst_argb]"+r"(dst_argb), // %[dst_argb] -#if defined(__i386__) && defined(__pic__) +#if defined(__i386__) [width]"+m"(width) // %[width] #else [width]"+rm"(width) // %[width]