Skip to content

Commit

Permalink
use OGRE_STATIC_ASSERT for single argument checks
Browse files Browse the repository at this point in the history
  • Loading branch information
eugenegff committed Sep 20, 2024
1 parent f72b0ca commit 0aceb99
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions OgreMain/include/OgreAssert.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,10 @@ namespace Ogre
# define OGRE_VERIFY_MSG( cond, msg, ... ) ( (void)0 )
#endif

#if __cplusplus >= 201103L
#if __cplusplus >= 201703L || defined( _MSVC_LANG ) && _MSVC_LANG >= 201703L
# define OGRE_STATIC_ASSERT( x ) static_assert( x )
#else // C++11
# define OGRE_STATIC_ASSERT( x ) static_assert( x, # x )
#else
# define OGRE_STATIC_ASSERT( x ) \
typedef char OgreStaticAssert[( x ) ? 1 : -1]; \
OGRE_UNUSED( OgreStaticAssert );
#endif

#endif
4 changes: 2 additions & 2 deletions RenderSystems/Vulkan/src/OgreVulkanRenderSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ namespace Ogre
//-------------------------------------------------------------------------
void VulkanRenderSystem::savePipelineCache( DataStreamPtr stream ) const
{
static_assert( sizeof( PipelineCachePrefixHeader ) == 48 );
OGRE_STATIC_ASSERT( sizeof( PipelineCachePrefixHeader ) == 48 );
if( mActiveDevice->mPipelineCache )
{
size_t size{};
Expand Down Expand Up @@ -559,7 +559,7 @@ namespace Ogre
hdr.driverVersion = mActiveDevice->mDeviceProperties.driverVersion;
hdr.driverABI = sizeof( void * );
memcpy( hdr.uuid, mActiveDevice->mDeviceProperties.pipelineCacheUUID, VK_UUID_SIZE );
static_assert( VK_UUID_SIZE == 16 );
OGRE_STATIC_ASSERT( VK_UUID_SIZE == 16 );

uint64 hashResult[2] = {};
OGRE_HASH128_FUNC( buf.data(), (int)buf.size(), IdString::Seed, hashResult );
Expand Down

0 comments on commit 0aceb99

Please sign in to comment.