Bladeren bron

test/unit/utProfiler.cpp: fix `gcc-16` build failure (#6267)

* test/unit/utProfiler.cpp: fix `gcc-16` build failure

Upcoming `gcc-16` improved detection of unused variables as:

    test/unit/utProfiler.cpp: In member function 'virtual void utProfiler_addRegion_success_Test::TestBody()':
    test/unit/utProfiler.cpp:71:22: error: variable 'j' set but not used [-Werror=unused-but-set-variable=]
       71 |         volatile int j=0;
          |                      ^

The change is intentional accoring to Andrew Pinsi and is not a faalse positive.

* Update utProfiler.cpp: Remove dead code

---------

Co-authored-by: Kim Kulling <[email protected]>
Sergei Trofimovich 3 weken geleden
bovenliggende
commit
a38ec50fd3
1 gewijzigde bestanden met toevoegingen van 2 en 16 verwijderingen
  1. 2 16
      test/unit/utProfiler.cpp

+ 2 - 16
test/unit/utProfiler.cpp

@@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
 
 Copyright (c) 2006-2025, assimp team
 
-
-
 All rights reserved.
 
 Redistribution and use of this software in source and binary forms,
@@ -50,18 +48,7 @@ using namespace ::Assimp::Profiling;
 
 class utProfiler : public ::testing::Test {
 public:
-    LogStream *m_stream;
-
-    /*virtual void SetUp() {
-        m_stream = new UTLogStream;
-        DefaultLogger::create();
-        DefaultLogger::get()->attachStream( m_stream );
-    }
-
-    virtual void TearDown() {
-        DefaultLogger::get()->detatchStream( m_stream );
-        m_stream = nullptr;
-    }*/
+    LogStream *mStream = nullptr;
 };
 
 TEST_F( utProfiler, addRegion_success ) {
@@ -70,8 +57,7 @@ TEST_F( utProfiler, addRegion_success ) {
     for ( int i=0; i<10; i++ ) {
         volatile int j=0;
         j++;
+        (void)j; /* avoid gcc-16 warnings about unused variable */
     }
     myProfiler.EndRegion( "t1" );
-    //UTLogStream *stream( (UTLogStream*) m_stream );
-    //EXPECT_FALSE( stream->m_messages.empty() );
 }