]> OCCT Git - occt-copy.git/commitdiff
0022980: Fixed Standard_Atomic.hxx
authorRoman Lygin <roman.lygin@gmail.com>
Tue, 18 Dec 2012 18:35:43 +0000 (22:35 +0400)
committerRoman Lygin <roman.lygin@gmail.com>
Tue, 18 Dec 2012 18:35:43 +0000 (22:35 +0400)
Standard_Atomic, prefer gcc built-ins rather than WinAPI calls (revert previous change of order)
Raise compiler error if no implementation found for atomic operations.
Add new draw command for testing this bug
Fix for compilation with TBB disabled
Adding CSF_TBB_INCLUDES macro in edl files
Correction of *.edl files
Update of EXTERNLIB files with CSF_TBB
Adding EXTERNLIB file

28 files changed:
src/Draw/Draw_CMPLRS.edl
src/Draw/EXTERNLIB
src/QABugs/EXTERNLIB [new file with mode: 0755]
src/QABugs/FILES
src/QABugs/QABugs_10.cxx [changed mode: 0644->0755]
src/QABugs/QABugs_12.cxx [changed mode: 0644->0755]
src/QABugs/QABugs_13.cxx [changed mode: 0644->0755]
src/QABugs/QABugs_15.cxx [changed mode: 0644->0755]
src/QABugs/QABugs_16.cxx [changed mode: 0644->0755]
src/QABugs/QABugs_17.cxx [changed mode: 0644->0755]
src/QABugs/QABugs_18.cxx [changed mode: 0644->0755]
src/QABugs/QABugs_19.cxx [changed mode: 0644->0755]
src/QABugs/QABugs_2.cxx [changed mode: 0644->0755]
src/QABugs/QABugs_4.cxx [changed mode: 0644->0755]
src/QABugs/QABugs_5.cxx [changed mode: 0644->0755]
src/QABugs/QABugs_6.cxx [changed mode: 0644->0755]
src/QABugs/QABugs_7.cxx [changed mode: 0644->0755]
src/QABugs/QABugs_8.cxx [changed mode: 0644->0755]
src/QABugs/QABugs_9.cxx [changed mode: 0644->0755]
src/QABugs/QABugs_CMPLRS.edl [changed mode: 0644->0755]
src/QANCollection/QANCollection1.cxx
src/QANCollection/QANCollection2.cxx
src/QANCollection/QANCollection3.cxx
src/Standard/Standard_Atomic.hxx
src/Standard/Standard_CMPLRS.edl
src/TKDraw/EXTERNLIB
src/TKQADraw/EXTERNLIB
tests/bugs/fclasses/bug22980 [new file with mode: 0755]

index 9cc253879b3cc004bb0914afdd8377be98acd9ca..735c86d45df5200a379cbd30ef52310910ba613b 100755 (executable)
@@ -20,5 +20,5 @@
 @uses "CSF.edl";
 
 ---@string %CMPLRS_CXX_Options += " -I"%CSF_TCL_INCLUDE" -DUSE_TK";
-@string %CMPLRS_CXX_Options += " -I"%CSF_TCL_INCLUDE;
+@string %CMPLRS_CXX_Options += " -I"%CSF_TCL_INCLUDE" -I"%CSF_TBB_INCLUDES ;
 
index d5607c1225d60be2b270c6c6ed17eb98e9840676..923d2d7aaaa8607ef29e7cd42c1b7d4fdc4e4be9 100755 (executable)
@@ -3,4 +3,4 @@ CSF_TclTkLibs
 CSF_gdi32
 CSF_advapi32
 CSF_user32
-
+CSF_TBB
diff --git a/src/QABugs/EXTERNLIB b/src/QABugs/EXTERNLIB
new file mode 100755 (executable)
index 0000000..50eb2e2
--- /dev/null
@@ -0,0 +1 @@
+CSF_TBB
index b5b239144d8bebf619ac8a4de3c5e189e9086efb..8b6f44ef46b6199e8096470ccb637bbf78f25ab3 100644 (file)
@@ -18,3 +18,4 @@ QABugs_17.cxx
 QABugs_18.cxx
 QABugs_19.cxx
 QABugs_CMPLRS.edl
+EXTERNLIB
old mode 100644 (file)
new mode 100755 (executable)
index b0ab73f..15132d0
@@ -1169,7 +1169,7 @@ static Standard_Integer OCC828 (Draw_Interpretor& di,Standard_Integer argc, cons
 }
 
 void QABugs::Commands_10(Draw_Interpretor& theCommands) {
-  char *group = "QABugs";
+  const char *group = "QABugs";
 
   theCommands.Add ("OCC426", "OCC426 shape1 shape2 shape3 shape4 shape5 shape6 [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__, OCC426, group);
 
old mode 100644 (file)
new mode 100755 (executable)
index e486b91..e06e636
@@ -126,7 +126,7 @@ static Standard_Integer OCC895 (Draw_Interpretor& di, Standard_Integer argc, con
 }
 
 void QABugs::Commands_12(Draw_Interpretor& theCommands) {
-  char *group = "QABugs";
+  const char *group = "QABugs";
 
   theCommands.Add ("OCC895", "OCC895 result [angle [reverse [order]]]", __FILE__, OCC895, group);
 
old mode 100644 (file)
new mode 100755 (executable)
index 9ea0efd..12179f4
@@ -1061,7 +1061,7 @@ static Standard_Integer OCC817 (Draw_Interpretor& di, Standard_Integer argc, con
 }
 
 void QABugs::Commands_13(Draw_Interpretor& theCommands) {
-  char *group = "QABugs";
+  const char *group = "QABugs";
 
   theCommands.Add ("OCC332", "OCC332 [wall_thickness [dia1 [dia2 [length [major_radius]]]]]", __FILE__, OCC332bug, group);
   //////theCommands.Add("OCC544", "OCC544 [[[[[wT [[[[d1 [[[d2 [[R [length]]]]]", __FILE__, OCC544, group);
old mode 100644 (file)
new mode 100755 (executable)
index bf5fb2a..6185371
@@ -69,6 +69,6 @@ static Standard_Integer BUC60720 (Draw_Interpretor& di,Standard_Integer argc,con
 
 void QABugs::Commands_15(Draw_Interpretor& theCommands)
 {
-  char *group = "QABugs";
+  const char *group = "QABugs";
   theCommands.Add("BUC60720","BUC60720 0/1",__FILE__,BUC60720,group);
 }
old mode 100644 (file)
new mode 100755 (executable)
index 4f04054..350d3bc
@@ -853,7 +853,7 @@ static Standard_Integer OCC904 (Draw_Interpretor& di, Standard_Integer argc, con
 }
 
 void QABugs::Commands_16(Draw_Interpretor& theCommands) {
-  char *group = "QABugs";
+  const char *group = "QABugs";
 
   theCommands.Add ("BUC60848", "BUC60848 shape", __FILE__, BUC60848, group);
   theCommands.Add ("BUC60828", "BUC60828", __FILE__, BUC60828, group);
old mode 100644 (file)
new mode 100755 (executable)
index 6d7a4fa..7bcd44c
@@ -2252,7 +2252,7 @@ Standard_Integer OCC17480(Draw_Interpretor& di,   Standard_Integer n,   const ch
 }
 
 void QABugs::Commands_17(Draw_Interpretor& theCommands) {
-  char *group = "QABugs";
+  const char *group = "QABugs";
 
   theCommands.Add ("BUC60842", "BUC60842", __FILE__, BUC60842, group);
   theCommands.Add ("BUC60843", "BUC60843 result_shape name_of_circle name_of_curve [ par1 [ tol ] ]", __FILE__, BUC60843, group);
old mode 100644 (file)
new mode 100755 (executable)
index a64b924..db0a3f7
@@ -429,7 +429,7 @@ static Standard_Integer OCC404bug (Draw_Interpretor& di, Standard_Integer argc,
 }
 
 void QABugs::Commands_18(Draw_Interpretor& theCommands) {
-  char *group = "QABugs";
+  const char *group = "QABugs";
 
   theCommands.Add("BUC60851", "BUC60851", __FILE__, BUC60851, group);
   theCommands.Add("OCC216", "OCC216", __FILE__, OCC216, group);
old mode 100644 (file)
new mode 100755 (executable)
index b11142a..81c6b11
@@ -47,7 +47,6 @@
 #include <BRepPrimAPI_MakeSphere.hxx>
 #include <BRepAlgo_Cut.hxx>
 
-//static Standard_Integer OCC230 (Draw_Interpretor& /*di*/, Standard_Integer /*argc*/, const char ** /*argv*/)
 static Standard_Integer OCC230 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
 {
   if ( argc != 4) {
@@ -148,13 +147,82 @@ static Standard_Integer OCC23237 (Draw_Interpretor& di, Standard_Integer /*argc*
   return 0;
 }
 
+#ifdef HAVE_TBB
+
+#include <Standard_Atomic.hxx>
+#include <tbb/blocked_range.h>
+#include <tbb/parallel_for.h>
+
+class IncrementerDecrementer
+{
+public:
+    IncrementerDecrementer (Standard_Integer* theVal, Standard_Boolean thePositive) : myVal (theVal), myPositive (thePositive)
+    {}
+    void operator() (const tbb::blocked_range<size_t>& r) const
+    {
+        if (myPositive)
+            for (size_t i = r.begin(); i != r.end(); ++i)
+                Standard_Atomic_Increment (myVal);
+        else
+            for (size_t i = r.begin(); i != r.end(); ++i)
+                Standard_Atomic_Decrement (myVal);
+    }
+private:
+    Standard_Integer*   myVal;
+    Standard_Boolean   myPositive;
+};
+#endif
+
+#define QCOMPARE(val1, val2) \
+  di << "Checking " #val1 " == " #val2 << \
+        ((val1) == (val2) ? ": OK\n" : ": Error\n")
+
+#ifdef HAVE_TBB
+static Standard_Integer OCC22980 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
+{
+  int aSum = 0;
+
+  //check returned value
+  QCOMPARE (Standard_Atomic_Decrement (&aSum), -1);
+  QCOMPARE (Standard_Atomic_Increment (&aSum), 0);
+  QCOMPARE (Standard_Atomic_Increment (&aSum), 1);
+  QCOMPARE (Standard_Atomic_Increment (&aSum), 2);
+//  QCOMPARE (Standard_Atomic_DecrementTest (&aSum), 0);
+//  QCOMPARE (Standard_Atomic_DecrementTest (&aSum), 1);
+
+  //check atomicity 
+  aSum = 0;
+  const int N = 1 << 24; //big enough to ensure concurrency
+
+  //increment
+  tbb::parallel_for (tbb::blocked_range<size_t> (0, N), IncrementerDecrementer (&aSum, true));
+  QCOMPARE (aSum, N);
+
+  //decrement
+  tbb::parallel_for (tbb::blocked_range<size_t> (0, N), IncrementerDecrementer (&aSum, false));
+  QCOMPARE (aSum, 0);
+
+  return 0;
+}
+
+#else /* HAVE_TBB */
+
+static Standard_Integer OCC22980 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char **argv)
+{
+  di << "Test skipped: command " << argv[0] << " requires TBB library\n";
+  return 0;
+}
+
+#endif /* HAVE_TBB */
+
 void QABugs::Commands_19(Draw_Interpretor& theCommands) {
-  char *group = "QABugs";
+  const char *group = "QABugs";
 
   theCommands.Add ("OCC230", "OCC230 TrimmedCurve Pnt2d Pnt2d", __FILE__, OCC230, group);
   theCommands.Add ("OCC142", "OCC142", __FILE__, OCC142, group);
   theCommands.Add ("OCC23361", "OCC23361", __FILE__, OCC23361, group);
-  theCommands.Add("OCC23237", "OCC23237", __FILE__, OCC23237, group); 
+  theCommands.Add ("OCC23237", "OCC23237", __FILE__, OCC23237, group); 
+  theCommands.Add ("OCC22980", "OCC22980", __FILE__, OCC22980, group);
 
   return;
 }
old mode 100644 (file)
new mode 100755 (executable)
index e467df7..637f31b
@@ -200,7 +200,7 @@ static Standard_Integer OCC1048 (Draw_Interpretor& di, Standard_Integer argc, co
 }
 
 void QABugs::Commands_2(Draw_Interpretor& theCommands) {
-  char *group = "QABugs";
+  const char *group = "QABugs";
 
   //theCommands.Add("OCC527", "OCC527 shape", __FILE__, OCC527, group);  
   theCommands.Add("OCC527", "OCC527 shape [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__, OCC527, group);  
old mode 100644 (file)
new mode 100755 (executable)
index ea0ee22..08977e5
@@ -145,7 +145,7 @@ static int BUC60627(Draw_Interpretor& di, Standard_Integer argc, const char ** a
 }
 
 void QABugs::Commands_4(Draw_Interpretor& theCommands) {
-  char *group = "QABugs";
+  const char *group = "QABugs";
 
   theCommands.Add("BUC60738","BUC60738",__FILE__,BUC60738,group);
   theCommands.Add("BUC60606","BUC60606 name",__FILE__,BUC60606,group);
old mode 100644 (file)
new mode 100755 (executable)
index c31774d..b440068
@@ -118,7 +118,7 @@ static Standard_Integer OCC5696 (Draw_Interpretor& di, Standard_Integer argc, co
 }
 
 void QABugs::Commands_5(Draw_Interpretor& theCommands) {
-  char *group = "QABugs";
+  const char *group = "QABugs";
 
   theCommands.Add ("OCC6001", "OCC6001 name curve/wire surface\n\t\tintersect curve by surface", 
                    __FILE__, OCC6001, group);
old mode 100644 (file)
new mode 100755 (executable)
index 69e92bb..dfbe9b5
@@ -122,7 +122,7 @@ static Standard_Integer OCC281bug (Draw_Interpretor& di, Standard_Integer argc,
 }
 
 void QABugs::Commands_6(Draw_Interpretor& theCommands) {
-  char *group = "QABugs";
+  const char *group = "QABugs";
 
   theCommands.Add ("OCC281", "OCC281 x y TypeOfMarker(0-12)", __FILE__, OCC281bug, group);
 
old mode 100644 (file)
new mode 100755 (executable)
index 5321f3a..66f117d
@@ -323,7 +323,7 @@ static Standard_Integer OCC862 (Draw_Interpretor& di, Standard_Integer argc, con
 }
 
 void QABugs::Commands_7(Draw_Interpretor& theCommands) {
-  char *group = "QABugs";
+  const char *group = "QABugs";
 
   theCommands.Add("OCC862", "OCC862 curve1 curve2", __FILE__, OCC862, group);  
   return;
old mode 100644 (file)
new mode 100755 (executable)
index 777ecc3..8c05282
@@ -259,7 +259,7 @@ static Standard_Integer OCC1651 (Draw_Interpretor& di, Standard_Integer argc, co
 }
 
 void QABugs::Commands_8(Draw_Interpretor& theCommands) {
-  char *group = "QABugs";
+  const char *group = "QABugs";
 
   theCommands.Add("BUC60753", "BUC60753 mode ratio", __FILE__, BUC60753, group);
   theCommands.Add("OCC162", "OCC162 name", __FILE__, OCC162, group);
old mode 100644 (file)
new mode 100755 (executable)
index 27a754e..b1f6646
@@ -150,7 +150,7 @@ static Standard_Integer OCC137_z (Draw_Interpretor& di, Standard_Integer argc, c
 }
 
 void QABugs::Commands_9(Draw_Interpretor& theCommands) {
-  char *group = "QABugs";
+  const char *group = "QABugs";
 
   theCommands.Add ("BUC60857", "BUC60857", __FILE__, BUC60857, group);
   theCommands.Add("OCC137","OCC137 mode [shape]",__FILE__,OCC137,group);
old mode 100644 (file)
new mode 100755 (executable)
index 423049f..07a0fb3
@@ -23,7 +23,7 @@
 
 @uses "CSF.edl";
 @ifdefined( %CSF_TCL_INCLUDE ) then
-@string %CMPLRS_CXX_Options = " -I"%CSF_TCL_INCLUDE %CMPLRS_CXX_Options ;
+@string %CMPLRS_CXX_Options = " -I"%CSF_TCL_INCLUDE" -I"%CSF_TBB_INCLUDES %CMPLRS_CXX_Options ;
 @endif;
 
 @endif;
index d3a296d6eb4a0a65edd66371a4d0cc9d936e3bbe..7398473d3e88f5faa2e676fe8ac9ece5d8a2d06a 100755 (executable)
@@ -141,7 +141,7 @@ static Standard_Integer QANColCheckSequence(Draw_Interpretor& di, Standard_Integ
 }
 
 void QANCollection::Commands1(Draw_Interpretor& theCommands) {
-  char *group = "QANCollection";
+  const char *group = "QANCollection";
 
   // from agvCollTest/src/AgvColEXE/TestEXE.cxx
   theCommands.Add("QANColCheckArray1",   "QANColCheckArray1 [-n]",               __FILE__, QANColCheckArray1,   group);  
index 6ff8f50522248d38d948e106c5726c137e589194..b2ae67c17f32268ec99f202006f9189407f2c0aa 100755 (executable)
@@ -288,7 +288,7 @@ static Standard_Integer QANColTestSequence(Draw_Interpretor& di, Standard_Intege
 }
 
 void QANCollection::Commands2(Draw_Interpretor& theCommands) {
-  char *group = "QANCollection";
+  const char *group = "QANCollection";
 
   // from agvCollTest/src/CollectionEXE/FuncTestEXE.cxx
   theCommands.Add("QANColTestArray1",         "QANColTestArray1",         __FILE__, QANColTestArray1,         group);  
index 04a4a596925ce55cc346868740a88ad63c56f608..04b281b6d598420bffe0bda450c287f60cc9f24c 100755 (executable)
@@ -256,7 +256,7 @@ static Standard_Integer QANColCheckSparseArray(Draw_Interpretor& di, Standard_In
 }
 
 void QANCollection::Commands3(Draw_Interpretor& theCommands) {
-  char *group = "QANCollection";
+  const char *group = "QANCollection";
 
   // from agvCollTest/src/CollectionEXE/PerfTestEXE.cxx
   theCommands.Add("QANColPerfArray1",         "QANColPerfArray1 Repeat Size",         __FILE__, QANColPerfArray1,         group);  
index 45264c68ea6d4929567a85d9331170d566d410a3..6f6525e65c70f1e119aee01ed345df75bdf2a575 100755 (executable)
 // purpose or non-infringement. Please see the License for the specific terms
 // and conditions governing the rights and limitations under the License.
 
-
-//! @file 
-//! Implementation of some atomic operations (elementary operations 
+//! @file
+//! Implementation of some atomic operations (elementary operations
 //! with data that cannot be interrupted by parallel threads in the
 //! multithread process) on various platforms
 //!
-//! By the moment, only operations necessary for reference counter 
+//! By the moment, only operations necessary for reference counter
 //! in Standard_Transient objects are implemented.
-//! 
+//!
 //! This is preffered to use fixed size types "int32_t" / "int64_t" for
 //! correct function declarations however we leave "int" assuming it is 32bits for now.
 
 #ifndef _Standard_Atomic_HeaderFile
 #define _Standard_Atomic_HeaderFile
 
-#include <Standard_Macro.hxx>
+//! Increments atomically integer variable pointed by theValue
+//! and returns resulting incremented value.
+inline int Standard_Atomic_Increment (volatile int* theValue);
+
+//! Decrements atomically integer variable pointed by theValue
+//! and returns resulting decremented value.
+inline int Standard_Atomic_Decrement (volatile int* theValue);
+
+// Platform-dependent implementation
+#if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
+// gcc explicitly defines the macros __GCC_HAVE_SYNC_COMPARE_AND_SWAP_*
+// starting with version 4.4+, although built-in functions
+// are available since 4.1.x. However unless __GCC_HAVE_SYNC_COMPARE_AND_SWAP_*
+// are defined, linking may fail without specifying -march option when
+// building for 32bit architecture on 64bit (using -m32 option). To avoid
+// making -march mandatory, check for __GCC_HAVE_SYNC_COMPARE_AND_SWAP_* is
+// enforced.
+
+int Standard_Atomic_Increment (volatile int* theValue)
+{
+  return __sync_add_and_fetch (theValue, 1);
+}
+
+int Standard_Atomic_Decrement (volatile int* theValue)
+{
+  return __sync_sub_and_fetch (theValue, 1);
+}
 
-#if (defined(_WIN32) || defined(__WIN32__))
+#elif defined(_WIN32) || defined(__WIN32__)
 extern "C" {
-  long _InterlockedIncrement(long volatile* lpAddend);
-  long _InterlockedDecrement(long volatile* lpAddend);
+  long _InterlockedIncrement (volatile long* lpAddend);
+  long _InterlockedDecrement (volatile long* lpAddend);
 }
-#endif
 
 #if defined(_MSC_VER)
   // force intrinsic instead of WinAPI calls
@@ -47,74 +71,79 @@ extern "C" {
   #pragma intrinsic (_InterlockedDecrement)
 #endif
 
-//! Increments atomically integer variable pointed by theValue
-//! and returns resulting incremented value.
-static int Standard_Atomic_Increment (volatile int* theValue)
+// WinAPI function or MSVC intrinsic
+// Note that we safely cast int* to long*, as they have same size and endian-ness
+
+int Standard_Atomic_Increment (volatile int* theValue)
 {
-#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
-  // mordern g++ compiler (gcc4.4+)
-  // built-in functions available for appropriate CPUs (at least -march=i486 should be specified on x86 platform)
-  return __sync_add_and_fetch (theValue, 1);
-#elif (defined(_WIN32) || defined(__WIN32__))
-  // WinAPI function or MSVC intrinsic
-  return _InterlockedIncrement(reinterpret_cast<long volatile*>(theValue));
-#elif defined(LIN)
-  // use x86 / x86_64 inline assembly (compatibility with alien compilers / old GCC)
-  int anIncResult;
-  __asm__ __volatile__ (
-  #if defined(_OCC64)
-    "lock xaddl %%ebx, (%%rax) \n\t"
-    "incl %%ebx                \n\t"
-    : "=b" (anIncResult)
-    : "a" (theValue), "b" (1)
-    : "cc", "memory");
-  #else
-    "lock xaddl %%eax, (%%ecx) \n\t"
-    "incl %%eax                \n\t"
-    : "=a" (anIncResult)
-    : "c" (theValue), "a" (1)
-    : "memory");
-  #endif
-  return anIncResult;
+  return _InterlockedIncrement (reinterpret_cast<volatile long*>(theValue));
+}
+
+int Standard_Atomic_Decrement (volatile int* theValue)
+{
+  return _InterlockedDecrement (reinterpret_cast<volatile long*>(theValue));
+}
+
+#elif defined(__APPLE__)
+// use atomic operations provided by MacOS
+
+#include <libkern/OSAtomic.h>
+
+int Standard_Atomic_Increment (volatile int* theValue)
+{
+  return OSAtomicIncrement32Barrier (theValue);
+}
+
+int Standard_Atomic_Decrement (volatile int* theValue)
+{
+  return OSAtomicDecrement32Barrier (theValue);
+}
+
+#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64))
+// use x86 / x86_64 inline assembly (compatibility with alien compilers / old GCC)
+
+inline int Standard_Atomic_Add (volatile int* theValue, int theVal)
+{
+  // C equivalent:
+  // *theValue += theVal;
+  // return *theValue;
+
+  int previous;
+  __asm__ __volatile__
+  (
+    "lock xadd %0,%1"
+  : "=q"(previous), "=m"(*theValue) //output
+  : "0"(theVal), "m"(*theValue) //input
+  : "memory" //clobbers
+  );
+  return previous + theVal;
+}
+
+int Standard_Atomic_Increment (volatile int* theValue)
+{
+  return Standard_Atomic_Add (theValue, 1);
+}
+
+int Standard_Atomic_Decrement (volatile int* theValue)
+{
+  return Standard_Atomic_Add (theValue, -1);
+}
+
 #else
-  //#error "Atomic operation doesn't implemented for current platform!"
-  return ++(*theValue);
+
+#ifndef IGNORE_NO_ATOMICS
+  #error "Atomic operation isn't implemented for current platform!"
 #endif
+int Standard_Atomic_Increment (volatile int* theValue)
+{
+  return ++(*theValue);
 }
 
-//! Decrements atomically integer variable pointed by theValue
-//! and returns resulting decremented value.
-static int Standard_Atomic_Decrement (volatile int* theValue)
+int Standard_Atomic_Decrement (volatile int* theValue)
 {
-#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
-  // mordern g++ compiler (gcc4.4+)
-  // built-in functions available for appropriate CPUs (at least -march=i486 should be specified on x86 platform)
-  return __sync_sub_and_fetch (theValue, 1);
-#elif (defined(_WIN32) || defined(__WIN32__))
-  // WinAPI function or MSVC intrinsic
-  return _InterlockedDecrement(reinterpret_cast<long volatile*>(theValue));
-#elif defined(LIN)
-  // use x86 / x86_64 inline assembly (compatibility with alien compilers / old GCC)
-  int aDecResult;
-  __asm__ __volatile__ (
-  #if defined(_OCC64)
-    "lock xaddl %%ebx, (%%rax) \n\t"
-    "decl %%ebx                \n\t"
-    : "=b" (aDecResult)
-    : "a" (theValue), "b" (-1)
-    : "cc", "memory");
-  #else
-    "lock xaddl %%eax, (%%ecx) \n\t"
-    "decl %%eax                \n\t"
-    : "=a" (aDecResult)
-    : "c" (theValue), "a" (-1)
-    : "memory");
-  #endif
-  return aDecResult;
-#else
-  //#error "Atomic operation doesn't implemented for current platform!"
   return --(*theValue);
-#endif
 }
 
+#endif
+
 #endif //_Standard_Atomic_HeaderFile
index 8104939ba653bb1f16c046156deb91c6d3025e1f..c29f682b94caf4e3d7e693edcd39e4a9e17b3a26 100755 (executable)
@@ -21,7 +21,7 @@
 @set %Standard_CMPLRS_EDL="";
 
 @if ( %Station != "sun" ) then
-  @string %CMPLRS_CXX_INCLUDE = %CMPLRS_CXX_INCLUDE " " %CSF_TBB_INCLUDES ;
+  @string %CMPLRS_CXX_INCLUDE = " -I"%CMPLRS_CXX_INCLUDE" -I"%CSF_TBB_INCLUDES ;
 @endif;
 
 @endif;
index 37112bcd9e79046c0ec08b98d41f0ff5de70bce6..37eaf811b137a90a88199aaeb3e608e8b15fadcd 100755 (executable)
@@ -14,3 +14,4 @@ CSF_TclTkLibs
 CSF_gdi32
 CSF_advapi32
 CSF_user32
+CSF_TBB
index f477086e3f44360b1541232087bcf2ac9004f377..c5691ef16d2bc410cbace0571bcc03a60441127f 100755 (executable)
@@ -39,3 +39,4 @@ CSF_TclTkLibs
 CSF_gdi32
 CSF_advapi32
 CSF_user32
+CSF_TBB
diff --git a/tests/bugs/fclasses/bug22980 b/tests/bugs/fclasses/bug22980
new file mode 100755 (executable)
index 0000000..d8c69ce
--- /dev/null
@@ -0,0 +1,11 @@
+puts "============"
+puts "OCC22980"
+puts "============"
+puts ""
+#######################################################################
+# Fixed Standard_Atomic.hxx
+#######################################################################
+
+pload QAcommands
+
+OCC22980