LLVM/Emscripten fixes 88/44188/19
authorLee Morgan <Lee.morgan@partner.samsung.com>
Thu, 2 Oct 2014 12:25:23 +0000 (13:25 +0100)
committerLee Morgan <Lee.morgan@partner.samsung.com>
Fri, 11 Dec 2015 13:52:28 +0000 (05:52 -0800)
Change-Id: I19ad59fdc3613ac19478613ee8103f56fe8d11ca

22 files changed:
automated-tests/src/dali/dali-test-suite-utils/test-gl-abstraction.h
build/tizen/configure.ac
dali/devel-api/common/map-wrapper.h
dali/devel-api/common/set-wrapper.h
dali/integration-api/events/touch-event-combiner.cpp
dali/internal/event/actors/actor-impl.cpp
dali/internal/event/animation/linear-constrainer-impl.h
dali/internal/event/common/thread-local-storage.cpp
dali/internal/event/common/type-registry-impl.cpp
dali/internal/event/images/image-factory.cpp
dali/internal/render/data-providers/material-data-provider.h
dali/internal/render/gl-resources/bitmap-texture.cpp
dali/internal/render/gl-resources/compressed-bitmap-texture.cpp
dali/internal/render/gl-resources/compressed-bitmap-texture.h
dali/internal/update/common/inherited-property.h
dali/internal/update/rendering/scene-graph-material.cpp
dali/internal/update/rendering/scene-graph-material.h
dali/public-api/common/dali-common.cpp
dali/public-api/common/dali-vector.cpp
dali/public-api/common/dali-vector.h
dali/public-api/common/vector-wrapper.h
dali/public-api/dali-core-version.cpp

index dea1c90..3d35394 100644 (file)
@@ -21,6 +21,7 @@
 // EXTERNAL INCLUDES
 #include <sstream>
 #include <string>
+#include <cstring>
 #include <map>
 #include <cstdio>
 #include <cstring> // 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<n; i++)
     {
-      out << textures[i] << ", " ;
+      out << textures[i] << ", ";
       mDeletedTextureIds.push_back(textures[i]);
     }
     out << "]";
index ae2b942..bebc98a 100644 (file)
@@ -78,7 +78,7 @@ fi
 
 if test "x$enable_emscripten" = "xyes"; then
   DALI_CFLAGS="$DALI_CFLAGS -DEMSCRIPTEN -std=c++11"
-  # Automatically turn off backtrace support
+  # Automatically turn off backtrace support and mutex locks
   enable_backtrace="no"
   enable_lock_backtrace="no"
 fi
index 070f0e9..dc363c1 100644 (file)
 
 #else
 
+#if defined(__clang__)
+
+#undef _LIBCPP_INLINE_VISIBILITY
+#define _LIBCPP_INLINE_VISIBILITY
+#undef _LIBCPP_EXTERN_TEMPLATE
+#define _LIBCPP_EXTERN_TEMPLATE(...)
+
+#include <map>
+
+#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 <memory>
 # include <new>
@@ -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
 
 
index d3b3ab1..e2eb2a3 100644 (file)
 
 #else
 
+#if defined(__clang__)
+
+#undef _LIBCPP_INLINE_VISIBILITY
+#define _LIBCPP_INLINE_VISIBILITY
+#undef _LIBCPP_EXTERN_TEMPLATE
+#define _LIBCPP_EXTERN_TEMPLATE(...)
+
+#include <set>
+
+#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 <memory>
 # include <new>
 # include <stdexcept>
 
+
 # include <bits/c++config.h>
 # include <bits/stl_tree.h>
 # 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__ */
index b864e43..4e98ccf 100644 (file)
@@ -20,6 +20,7 @@
 
 // EXTERNAL INCLUDES
 #include <algorithm>
+#include <cmath> // abs<float>
 
 // INTERNAL INCLUDES
 #include <dali/integration-api/events/touch-event-integ.h>
@@ -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;
index 614c6e4..b32ce2c 100644 (file)
@@ -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
index d9d607d..f824101 100644 (file)
@@ -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
       {
index ee99ba8..9202734 100644 (file)
@@ -30,7 +30,11 @@ namespace Internal
 
 namespace
 {
+#if defined(EMSCRIPTEN)
+ThreadLocalStorage* threadLocal = NULL;
+#else
 __thread ThreadLocalStorage* threadLocal = NULL;
+#endif
 }
 
 ThreadLocalStorage::ThreadLocalStorage(Core* core)
index d875fc5..540c099 100644 (file)
@@ -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
   {
index c3ee746..999ba25 100644 (file)
@@ -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<float>(requested.GetWidth())  -  static_cast<float>(actual.GetWidth()))  <= actual.GetWidth()  * mMaxScale) &&
+    (fabsf(static_cast<float>(requested.GetHeight()) -  static_cast<float>(actual.GetHeight())) <= actual.GetHeight() * mMaxScale);
 }
 
 Request* ImageFactory::InsertNewRequest( ResourceId resourceId, const std::string& filename, std::size_t urlHash, const ImageAttributes* attr )
index dd36105..2a55133 100644 (file)
@@ -25,7 +25,7 @@ namespace Dali
 {
 namespace Internal
 {
-class BlendingOptions;
+struct BlendingOptions;
 
 namespace SceneGraph
 {
index f1b65bf..c6c39fe 100644 (file)
@@ -18,6 +18,9 @@
 // CLASS HEADER
 #include <dali/internal/render/gl-resources/bitmap-texture.h>
 
+// EXTERNAL INCLUDES
+#include <cstring>
+
 // INTERNAL INCLUDES
 #include <dali/public-api/common/dali-vector.h>
 #include <dali/integration-api/debug.h>
index 3210a04..7a23adb 100644 (file)
@@ -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);
index 47f4009..035abb4 100644 (file)
@@ -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
index 9e09a11..0c6cc8f 100644 (file)
@@ -27,6 +27,7 @@
 #include <dali/public-api/object/property.h>
 #include <dali/public-api/object/property-input.h>
 #include <dali/public-api/object/property-types.h>
+#include <dali/public-api/math/math-utils.h> // Clamp
 
 namespace Dali
 {
index 4a34209..acd9ab7 100644 (file)
@@ -48,7 +48,6 @@ Material::Material()
   mBlendPolicy( OPAQUE ),
   mResourcesReady( false ),
   mFinishedResourceAcquisition( false ),
-  mTexturesRequireBlending( false ),
   mMaterialChanged( true )
 {
   // Observe own property-owner's uniform map
index 29fa429..743d516 100644 (file)
@@ -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
 };
 
index ab03ff1..c2c16cc 100644 (file)
 // INTERNAL INCLUDES
 #include <dali/integration-api/debug.h>
 
-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;
index 084515e..9dd7d8c 100644 (file)
@@ -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 )
index 39dcc31..7f2ada0 100644 (file)
@@ -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 )
index 0606a1a..05d6b6c 100644 (file)
 #include <new>
 #include <stdexcept>
 
+#if defined(__clang__)
+
+#undef _LIBCPP_INLINE_VISIBILITY
+#define _LIBCPP_INLINE_VISIBILITY
+#undef _LIBCPP_EXTERN_TEMPLATE
+#define _LIBCPP_EXTERN_TEMPLATE(...)
+
+#include <vector>
+
+#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 <bits/c++config.h>
 #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__ */
index 8c9fd36..6610c49 100644 (file)
@@ -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