From a021f49f604027db99291c5c37d5f6d57b76857f Mon Sep 17 00:00:00 2001 From: Lee Morgan Date: Thu, 2 Oct 2014 13:25:23 +0100 Subject: [PATCH] LLVM/Emscripten fixes Change-Id: I19ad59fdc3613ac19478613ee8103f56fe8d11ca --- .../dali/dali-test-suite-utils/test-gl-abstraction.h | 5 +++-- build/tizen/configure.ac | 2 +- dali/devel-api/common/map-wrapper.h | 18 ++++++++++++++++++ dali/devel-api/common/set-wrapper.h | 20 ++++++++++++++++++++ dali/integration-api/events/touch-event-combiner.cpp | 9 +++++---- dali/internal/event/actors/actor-impl.cpp | 2 +- .../event/animation/linear-constrainer-impl.h | 6 +++--- dali/internal/event/common/thread-local-storage.cpp | 4 ++++ dali/internal/event/common/type-registry-impl.cpp | 3 ++- dali/internal/event/images/image-factory.cpp | 12 ++++++------ .../render/data-providers/material-data-provider.h | 2 +- dali/internal/render/gl-resources/bitmap-texture.cpp | 3 +++ .../gl-resources/compressed-bitmap-texture.cpp | 3 +-- .../render/gl-resources/compressed-bitmap-texture.h | 1 - dali/internal/update/common/inherited-property.h | 1 + .../update/rendering/scene-graph-material.cpp | 1 - .../internal/update/rendering/scene-graph-material.h | 1 - dali/public-api/common/dali-common.cpp | 10 +++++----- dali/public-api/common/dali-vector.cpp | 4 ++-- dali/public-api/common/dali-vector.h | 13 ++++++++++++- dali/public-api/common/vector-wrapper.h | 18 ++++++++++++++++++ dali/public-api/dali-core-version.cpp | 4 ++++ 22 files changed, 110 insertions(+), 32 deletions(-) diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-gl-abstraction.h b/automated-tests/src/dali/dali-test-suite-utils/test-gl-abstraction.h index dea1c90..3d35394 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-gl-abstraction.h +++ b/automated-tests/src/dali/dali-test-suite-utils/test-gl-abstraction.h @@ -21,6 +21,7 @@ // EXTERNAL INCLUDES #include #include +#include #include #include #include // for strcmp @@ -350,11 +351,11 @@ public: inline void DeleteTextures(GLsizei n, const GLuint* textures) { std::stringstream out; - out << n << ", " << textures << " = [" ; + out << n << ", " << textures << " = ["; for(GLsizei i=0; i + +#undef _LIBCPP_INLINE_VISIBILITY +#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__)) +#undef _LIBCPP_EXTERN_TEMPLATE +#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__; + +#else + // ensure that default visibility is used with any class that is used as an exception type # include # include @@ -41,6 +57,8 @@ # undef _GLIBCXX_VISIBILITY_ATTR # define _GLIBCXX_VISIBILITY_ATTR(V) __attribute__ ((__visibility__ (#V))) // restore `_GLIBCXX_VISIBILITY_ATTR` +#endif //ifdef __clang__ + #endif //ifndef HIDE_DALI_INTERNALS diff --git a/dali/devel-api/common/set-wrapper.h b/dali/devel-api/common/set-wrapper.h index d3b3ab1..e2eb2a3 100644 --- a/dali/devel-api/common/set-wrapper.h +++ b/dali/devel-api/common/set-wrapper.h @@ -27,11 +27,29 @@ #else +#if defined(__clang__) + +#undef _LIBCPP_INLINE_VISIBILITY +#define _LIBCPP_INLINE_VISIBILITY +#undef _LIBCPP_EXTERN_TEMPLATE +#define _LIBCPP_EXTERN_TEMPLATE(...) + +#include + +#undef _LIBCPP_INLINE_VISIBILITY +#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__)) +#undef _LIBCPP_EXTERN_TEMPLATE +#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__; + +#else + + // ensure that default visibility is used with any class that is used as an exception type # include # include # include + # include # include # undef _GLIBCXX_VISIBILITY_ATTR @@ -40,6 +58,8 @@ # undef _GLIBCXX_VISIBILITY_ATTR # define _GLIBCXX_VISIBILITY_ATTR(V) __attribute__ ((__visibility__ (#V))) // restore `_GLIBCXX_VISIBILITY_ATTR` +#endif //ifdef __clang__ + #endif //ifndef HIDE_DALI_INTERNALS #endif /* __DALI_SET_H__ */ diff --git a/dali/integration-api/events/touch-event-combiner.cpp b/dali/integration-api/events/touch-event-combiner.cpp index b864e43..4e98ccf 100644 --- a/dali/integration-api/events/touch-event-combiner.cpp +++ b/dali/integration-api/events/touch-event-combiner.cpp @@ -20,6 +20,7 @@ // EXTERNAL INCLUDES #include +#include // abs // INTERNAL INCLUDES #include @@ -215,8 +216,8 @@ TouchEventCombiner::EventDispatchType TouchEventCombiner::GetNextTouchEvent( con break; } - if ( ( abs( point.screen.x - iter->point.screen.x ) < mMinMotionDistance.x ) && - ( abs( point.screen.y - iter->point.screen.y ) < mMinMotionDistance.y ) ) + if ( ( std::abs( point.screen.x - iter->point.screen.x ) < mMinMotionDistance.x ) && + ( std::abs( point.screen.y - iter->point.screen.y ) < mMinMotionDistance.y ) ) { // Not enough positional change from last event so ignore ignore = true; @@ -269,8 +270,8 @@ TouchEventCombiner::EventDispatchType TouchEventCombiner::GetNextTouchEvent( con break; } - if ( ( abs( point.screen.x - iter->point.screen.x ) < mMinMotionDistance.x ) && - ( abs( point.screen.y - iter->point.screen.y ) < mMinMotionDistance.y ) ) + if ( ( std::abs( point.screen.x - iter->point.screen.x ) < mMinMotionDistance.x ) && + ( std::abs( point.screen.y - iter->point.screen.y ) < mMinMotionDistance.y ) ) { // Not enough positional change from last event so ignore ignore = true; diff --git a/dali/internal/event/actors/actor-impl.cpp b/dali/internal/event/actors/actor-impl.cpp index 614c6e4..b32ce2c 100644 --- a/dali/internal/event/actors/actor-impl.cpp +++ b/dali/internal/event/actors/actor-impl.cpp @@ -2695,7 +2695,7 @@ void Actor::SetSceneGraphProperty( Property::Index index, const PropertyMetadata DALI_ASSERT_ALWAYS( false && "Property type enumeration out of bounds" ); // should not come here break; } - } + } // entry.GetType } Property::Value Actor::GetDefaultProperty( Property::Index index ) const diff --git a/dali/internal/event/animation/linear-constrainer-impl.h b/dali/internal/event/animation/linear-constrainer-impl.h index d9d607d..f824101 100644 --- a/dali/internal/event/animation/linear-constrainer-impl.h +++ b/dali/internal/event/animation/linear-constrainer-impl.h @@ -56,8 +56,8 @@ struct LinearConstraintFunctor /** * @brief Functor operator for float properties * - * @param[in,out] position Current value of the property - * @param[in] inputs Contains the input property used as the parameter for the path + * @param[out] value Current value of the property + * @param[in] inputs Contains the input property used as the parameter for the path * * @return The value of the linear map at the given parameter. */ @@ -106,7 +106,7 @@ struct LinearConstraintFunctor max = min+1; } - tLocal =(t - min*step) / step; + tLocal = (t - min*step) / step; } else { diff --git a/dali/internal/event/common/thread-local-storage.cpp b/dali/internal/event/common/thread-local-storage.cpp index ee99ba8..9202734 100644 --- a/dali/internal/event/common/thread-local-storage.cpp +++ b/dali/internal/event/common/thread-local-storage.cpp @@ -30,7 +30,11 @@ namespace Internal namespace { +#if defined(EMSCRIPTEN) +ThreadLocalStorage* threadLocal = NULL; +#else __thread ThreadLocalStorage* threadLocal = NULL; +#endif } ThreadLocalStorage::ThreadLocalStorage(Core* core) diff --git a/dali/internal/event/common/type-registry-impl.cpp b/dali/internal/event/common/type-registry-impl.cpp index d875fc5..540c099 100644 --- a/dali/internal/event/common/type-registry-impl.cpp +++ b/dali/internal/event/common/type-registry-impl.cpp @@ -301,7 +301,8 @@ Dali::TypeInfo TypeRegistry::GetTypeInfo(const Dali::BaseObject * const pBaseObj if(pCustom) { - type = GetTypeInfo( typeid( pCustom->GetImplementation() ) ); + const Dali::CustomActorImpl& custom = pCustom->GetImplementation(); + type = GetTypeInfo( typeid( custom ) ); } else { diff --git a/dali/internal/event/images/image-factory.cpp b/dali/internal/event/images/image-factory.cpp index c3ee746..999ba25 100644 --- a/dali/internal/event/images/image-factory.cpp +++ b/dali/internal/event/images/image-factory.cpp @@ -313,12 +313,12 @@ bool ImageFactory::CompareAttributes( const ImageAttributes& requested, // do not load image resource again if there is a similar resource loaded: // see explanation in image.h of what is deemed compatible return (requested.GetScalingMode() == actual.GetScalingMode()) && - ( - (requested.GetFilterMode() == actual.GetFilterMode()) || - (requested.GetFilterMode() == SamplingMode::DONT_CARE) - ) && - (fabsf(requested.GetWidth() - actual.GetWidth()) <= actual.GetWidth() * mMaxScale) && - (fabsf(requested.GetHeight() - actual.GetHeight()) <= actual.GetHeight() * mMaxScale); + ( + (requested.GetFilterMode() == actual.GetFilterMode()) || + (requested.GetFilterMode() == SamplingMode::DONT_CARE) + ) && + (fabsf(static_cast(requested.GetWidth()) - static_cast(actual.GetWidth())) <= actual.GetWidth() * mMaxScale) && + (fabsf(static_cast(requested.GetHeight()) - static_cast(actual.GetHeight())) <= actual.GetHeight() * mMaxScale); } Request* ImageFactory::InsertNewRequest( ResourceId resourceId, const std::string& filename, std::size_t urlHash, const ImageAttributes* attr ) diff --git a/dali/internal/render/data-providers/material-data-provider.h b/dali/internal/render/data-providers/material-data-provider.h index dd36105..2a55133 100644 --- a/dali/internal/render/data-providers/material-data-provider.h +++ b/dali/internal/render/data-providers/material-data-provider.h @@ -25,7 +25,7 @@ namespace Dali { namespace Internal { -class BlendingOptions; +struct BlendingOptions; namespace SceneGraph { diff --git a/dali/internal/render/gl-resources/bitmap-texture.cpp b/dali/internal/render/gl-resources/bitmap-texture.cpp index f1b65bf..c6c39fe 100644 --- a/dali/internal/render/gl-resources/bitmap-texture.cpp +++ b/dali/internal/render/gl-resources/bitmap-texture.cpp @@ -18,6 +18,9 @@ // CLASS HEADER #include +// EXTERNAL INCLUDES +#include + // INTERNAL INCLUDES #include #include diff --git a/dali/internal/render/gl-resources/compressed-bitmap-texture.cpp b/dali/internal/render/gl-resources/compressed-bitmap-texture.cpp index 3210a04..7a23adb 100644 --- a/dali/internal/render/gl-resources/compressed-bitmap-texture.cpp +++ b/dali/internal/render/gl-resources/compressed-bitmap-texture.cpp @@ -30,14 +30,13 @@ namespace Dali namespace Internal { -CompressedBitmapTexture::CompressedBitmapTexture(Internal::BitmapCompressed* const bitmap, Context& context, ResourcePolicy::Discardable discardPolicy) +CompressedBitmapTexture::CompressedBitmapTexture(Internal::BitmapCompressed* const bitmap, Context& context, ResourcePolicy::Discardable /*discardPolicy*/) : Texture(context, bitmap->GetImageWidth(), bitmap->GetImageHeight(), bitmap->GetImageWidth(), bitmap->GetImageHeight()), mBitmap(bitmap), - mDiscardPolicy(discardPolicy), mPixelFormat( bitmap->GetPixelFormat() ) { DALI_LOG_TRACE_METHOD(Debug::Filter::gImage); diff --git a/dali/internal/render/gl-resources/compressed-bitmap-texture.h b/dali/internal/render/gl-resources/compressed-bitmap-texture.h index 47f4009..035abb4 100644 --- a/dali/internal/render/gl-resources/compressed-bitmap-texture.h +++ b/dali/internal/render/gl-resources/compressed-bitmap-texture.h @@ -122,7 +122,6 @@ private: private: Internal::BitmapCompressedPtr mBitmap; ///< The Bitmap the Texture was created from (may be NULL) - ResourcePolicy::Discardable mDiscardPolicy; Pixel::Format mPixelFormat; // Changes scope, should be at end of class diff --git a/dali/internal/update/common/inherited-property.h b/dali/internal/update/common/inherited-property.h index 9e09a11..0c6cc8f 100644 --- a/dali/internal/update/common/inherited-property.h +++ b/dali/internal/update/common/inherited-property.h @@ -27,6 +27,7 @@ #include #include #include +#include // Clamp namespace Dali { diff --git a/dali/internal/update/rendering/scene-graph-material.cpp b/dali/internal/update/rendering/scene-graph-material.cpp index 4a34209..acd9ab7 100644 --- a/dali/internal/update/rendering/scene-graph-material.cpp +++ b/dali/internal/update/rendering/scene-graph-material.cpp @@ -48,7 +48,6 @@ Material::Material() mBlendPolicy( OPAQUE ), mResourcesReady( false ), mFinishedResourceAcquisition( false ), - mTexturesRequireBlending( false ), mMaterialChanged( true ) { // Observe own property-owner's uniform map diff --git a/dali/internal/update/rendering/scene-graph-material.h b/dali/internal/update/rendering/scene-graph-material.h index 29fa429..743d516 100644 --- a/dali/internal/update/rendering/scene-graph-material.h +++ b/dali/internal/update/rendering/scene-graph-material.h @@ -284,7 +284,6 @@ private: // Data BlendPolicy mBlendPolicy; ///< The blend policy as determined by PrepareRender bool mResourcesReady; ///< if the material is ready to be rendered bool mFinishedResourceAcquisition; ///< if resource loading is completed - bool mTexturesRequireBlending; ///< if material textures require blending bool mMaterialChanged; ///< if the material has changed since the last frame }; diff --git a/dali/public-api/common/dali-common.cpp b/dali/public-api/common/dali-common.cpp index ab03ff1..c2c16cc 100644 --- a/dali/public-api/common/dali-common.cpp +++ b/dali/public-api/common/dali-common.cpp @@ -33,16 +33,16 @@ // INTERNAL INCLUDES #include -namespace -{ -const int MAX_NUM_STACK_FRAMES = 25; -} - namespace Dali { #if defined(BACKTRACE_ENABLED) +namespace +{ +const int MAX_NUM_STACK_FRAMES = 25; +} + std::string Demangle(const char* symbol) { std::string result; diff --git a/dali/public-api/common/dali-vector.cpp b/dali/public-api/common/dali-vector.cpp index 084515e..9dd7d8c 100644 --- a/dali/public-api/common/dali-vector.cpp +++ b/dali/public-api/common/dali-vector.cpp @@ -53,7 +53,7 @@ void VectorBase::Release() SizeType* metadata = reinterpret_cast< SizeType* >( mData ); // TODO would be nice to memset to a bitpattern to catch illegal use of container after release // but that would require knowledge of the itemsize - free( metadata - 2u ); + delete [] ( metadata - 2u ); mData = 0u; } } @@ -75,7 +75,7 @@ void VectorBase::Reserve( SizeType capacity, SizeType elementSize ) if( capacity > oldCapacity ) { const SizeType wholeAllocation = sizeof(SizeType) * 2u + capacity * elementSize; - void* wholeData = (void*)malloc( wholeAllocation ); + void* wholeData = (void*) new unsigned char[ wholeAllocation ]; DALI_ASSERT_ALWAYS( wholeData && "VectorBase::Reserve - Memory allocation failed" ); #if defined( DEBUG_ENABLED ) diff --git a/dali/public-api/common/dali-vector.h b/dali/public-api/common/dali-vector.h index 39dcc31..7f2ada0 100644 --- a/dali/public-api/common/dali-vector.h +++ b/dali/public-api/common/dali-vector.h @@ -570,9 +570,20 @@ public: // API * @brief Resize the vector. Does not change capacity. * * @param count to resize to. + */ + void Resize( SizeType count ) + { + ItemType item = ItemType(); + Resize(count, item); + } + + /** + * @brief Resize the vector. Does not change capacity. + * + * @param count to resize to. * @param item to insert to the new indices. */ - void Resize( SizeType count, ItemType item = ItemType() ) + void Resize( SizeType count, const ItemType& item ) { const SizeType oldCount = VectorBase::Count(); if( count <= oldCount ) diff --git a/dali/public-api/common/vector-wrapper.h b/dali/public-api/common/vector-wrapper.h index 0606a1a..05d6b6c 100644 --- a/dali/public-api/common/vector-wrapper.h +++ b/dali/public-api/common/vector-wrapper.h @@ -35,6 +35,22 @@ #include #include +#if defined(__clang__) + +#undef _LIBCPP_INLINE_VISIBILITY +#define _LIBCPP_INLINE_VISIBILITY +#undef _LIBCPP_EXTERN_TEMPLATE +#define _LIBCPP_EXTERN_TEMPLATE(...) + +#include + +#undef _LIBCPP_INLINE_VISIBILITY +#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__)) +#undef _LIBCPP_EXTERN_TEMPLATE +#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__; + +#else + #include #undef _GLIBCXX_VISIBILITY_ATTR #define _GLIBCXX_VISIBILITY_ATTR(V) __attribute__ ((__visibility__ ("hidden"))) @@ -42,6 +58,8 @@ #undef _GLIBCXX_VISIBILITY_ATTR #define _GLIBCXX_VISIBILITY_ATTR(V) __attribute__ ((__visibility__ (#V))) // restore `_GLIBCXX_VISIBILITY_ATTR` +#endif //ifdef __clang__ + #endif //ifndef HIDE_DALI_INTERNALS #endif /* __VECTOR_WRAPPER__H__ */ diff --git a/dali/public-api/dali-core-version.cpp b/dali/public-api/dali-core-version.cpp index 8c9fd36..6610c49 100644 --- a/dali/public-api/dali-core-version.cpp +++ b/dali/public-api/dali-core-version.cpp @@ -31,6 +31,8 @@ const unsigned int CORE_MINOR_VERSION = 1; const unsigned int CORE_MICRO_VERSION = 13; const char * const CORE_BUILD_DATE = __DATE__ " " __TIME__; +#ifndef EMSCRIPTEN + #ifdef DEBUG_ENABLED namespace { @@ -46,4 +48,6 @@ PrintVersion CORE_VERSION; } // unnamed namespace #endif +#endif // EMSCRIPTEN + } // namespace Dali -- 2.7.4