Fix Clang build on Android.

The optimize attribute is not supported with Clang/ARM r161757.

This warning, turned into an error, is emitted by -Wattribute (implicitly set).
Review URL: https://codereview.appspot.com/6489045

git-svn-id: http://skia.googlecode.com/svn/trunk@5316 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
digit@google.com 2012-08-28 15:22:37 +00:00
parent 0dd5ceb6d6
commit 536079b209
2 changed files with 29 additions and 2 deletions

View File

@ -189,5 +189,32 @@
# define SK_PURE_FUNC /* nothing */
#endif
//////////////////////////////////////////////////////////////////////
/**
* SK_HAS_ATTRIBUTE(<name>) should return true iff the compiler
* supports __attribute__((<name>)). Mostly important because
* Clang doesn't support all of GCC attributes.
*/
#if defined(__has_attribute)
# define SK_HAS_ATTRIBUTE(x) __has_attribute(x)
#elif defined(__GNUC__)
# define SK_HAS_ATTRIBUTE(x) 1
#else
# define SK_HAS_ATTRIBUTE(x) 0
#endif
/**
* SK_ATTRIBUTE_OPTIMIZE_O1 can be used as a function attribute
* to specify individual optimization level of -O1, if the compiler
* supports it.
*
* NOTE: Clang/ARM (r161757) does not support the 'optimize' attribute.
*/
#if SK_HAS_ATTRIBUTE(optimize)
# define SK_ATTRIBUTE_OPTIMIZE_O1 __attribute__((optimize("O1")))
#else
# define SK_ATTRIBUTE_OPTIMIZE_O1 /* nothing */
#endif
#endif

View File

@ -16,7 +16,7 @@ void SI8_D16_nofilter_DX_arm(
const SkBitmapProcState& s,
const uint32_t* SK_RESTRICT xy,
int count,
uint16_t* SK_RESTRICT colors) __attribute__((optimize("O1")));
uint16_t* SK_RESTRICT colors) SK_ATTRIBUTE_OPTIMIZE_O1;
void SI8_D16_nofilter_DX_arm(const SkBitmapProcState& s,
const uint32_t* SK_RESTRICT xy,
@ -107,7 +107,7 @@ void SI8_opaque_D32_nofilter_DX_arm(
const SkBitmapProcState& s,
const uint32_t* SK_RESTRICT xy,
int count,
SkPMColor* SK_RESTRICT colors) __attribute__((optimize("O1")));
SkPMColor* SK_RESTRICT colors) SK_ATTRIBUTE_OPTIMIZE_O1;
void SI8_opaque_D32_nofilter_DX_arm(const SkBitmapProcState& s,
const uint32_t* SK_RESTRICT xy,