Fix build in C++20 mode.
authorPeter Kasting <pkasting@chromium.org>
Thu, 8 Sep 2022 19:00:54 +0000 (19:00 +0000)
committerMatthew Netsch <quic_mnetsch@quicinc.com>
Wed, 14 Sep 2022 18:25:08 +0000 (18:25 +0000)
* Compound assignments to volatiles are deprecated.  Use non-compound
  forms.
* Math between disparate enums is deprecated.  Use constexprs.
* The full definition of a type T must be visible for code that
  instantiates std::vector<T>.  Reorder code to guarantee this.

Components: Framework

Bug: chromium:1284275
Change-Id: I75a99b5c09cc911f2312aabe85f49aadff84dc51

framework/common/tcuThreadUtil.cpp
framework/delibs/decpp/deSpinBarrier.cpp
framework/randomshaders/rsgExecutionContext.hpp
framework/referencerenderer/rrFragmentPacket.hpp
modules/glshared/glsBuiltinPrecisionTests.cpp

index 964c213..cb1b476 100644 (file)
@@ -61,7 +61,7 @@ Event::Result Event::waitReady (void)
        m_lock.lock();
 
        if (m_result == RESULT_NOT_READY)
-               m_waiterCount++;
+               m_waiterCount = m_waiterCount + 1;
        else
        {
                m_lock.unlock();
index e328abc..8111a35 100644 (file)
@@ -102,12 +102,12 @@ void SpinBarrier::sync (WaitMode requestedMode)
        {
                // Release all waiting threads. Since this thread has not been removed, m_numLeaving will
                // be >= 1 until m_numLeaving is decremented at the end of this function.
-               m_numThreads -= m_numRemoved;
-               m_numLeaving  = m_numThreads;
-               m_numRemoved  = 0;
+               m_numThreads = m_numThreads - m_numRemoved;
+               m_numLeaving = m_numThreads;
+               m_numRemoved = 0;
 
                deMemoryReadWriteFence();
-               m_numEntered  = 0;
+               m_numEntered = 0;
        }
        else
        {
@@ -148,12 +148,12 @@ void SpinBarrier::removeThread (WaitMode requestedMode)
        if (deAtomicIncrement32(&m_numEntered) == cachedNumThreads)
        {
                // Release all waiting threads.
-               m_numThreads -= m_numRemoved;
-               m_numLeaving  = m_numThreads;
-               m_numRemoved  = 0;
+               m_numThreads = m_numThreads - m_numRemoved;
+               m_numLeaving = m_numThreads;
+               m_numRemoved = 0;
 
                deMemoryReadWriteFence();
-               m_numEntered  = 0;
+               m_numEntered = 0;
        }
 }
 
index b83c5d6..1df940d 100644 (file)
 namespace rsg
 {
 
-enum
-{
-       EXEC_VEC_WIDTH  = 64
-};
+constexpr int EXEC_VEC_WIDTH = 64;
 
 typedef ConstStridedValueAccess<EXEC_VEC_WIDTH>                        ExecConstValueAccess;
 typedef StridedValueAccess<EXEC_VEC_WIDTH>                             ExecValueAccess;
index 688af75..13df23f 100644 (file)
 namespace rr
 {
 
-enum
-{
-       NUM_FRAGMENTS_PER_PACKET        = 4
-};
+constexpr int NUM_FRAGMENTS_PER_PACKET = 4;
 
 /*--------------------------------------------------------------------*//*!
  * \brief Fragment packet
index 80c5520..a4d7842 100644 (file)
@@ -653,33 +653,6 @@ private:
        int             m_count;
 };
 
-class ExpandContext
-{
-public:
-                                               ExpandContext   (Counter& symCounter) : m_symCounter(symCounter) {}
-                                               ExpandContext   (const ExpandContext& parent)
-                                                       : m_symCounter(parent.m_symCounter) {}
-
-       template<typename T>
-       VariableP<T>            genSym                  (const string& baseName)
-       {
-               return variable<T>(baseName + de::toString(m_symCounter()));
-       }
-
-       void                            addStatement    (const StatementP& stmt)
-       {
-               m_statements.push_back(stmt);
-       }
-
-       vector<StatementP>      getStatements   (void) const
-       {
-               return m_statements;
-       }
-private:
-       Counter&                        m_symCounter;
-       vector<StatementP>      m_statements;
-};
-
 /*--------------------------------------------------------------------*//*!
  * \brief A statement or declaration.
  *
@@ -728,6 +701,33 @@ public:
                                StatementP                      (const Super& ptr)              : Super(ptr) {}
 };
 
+class ExpandContext
+{
+public:
+                                               ExpandContext   (Counter& symCounter) : m_symCounter(symCounter) {}
+                                               ExpandContext   (const ExpandContext& parent)
+                                                       : m_symCounter(parent.m_symCounter) {}
+
+       template<typename T>
+       VariableP<T>            genSym                  (const string& baseName)
+       {
+               return variable<T>(baseName + de::toString(m_symCounter()));
+       }
+
+       void                            addStatement    (const StatementP& stmt)
+       {
+               m_statements.push_back(stmt);
+       }
+
+       vector<StatementP>      getStatements   (void) const
+       {
+               return m_statements;
+       }
+private:
+       Counter&                        m_symCounter;
+       vector<StatementP>      m_statements;
+};
+
 /*--------------------------------------------------------------------*//*!
  * \brief
  *