Explicitly add signed/unsigned comparison to warnings

This commit is contained in:
Seth Hillbrand 2020-07-02 10:54:34 -07:00
parent 441dfa30f0
commit d663be853f
3 changed files with 6 additions and 3 deletions

View File

@ -684,7 +684,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
std::vector<std::pair<const ZONE_CONTAINER*, PCB_LAYER_ID>> zones;
for( size_t i = 0; i < m_board->GetAreaCount(); i++ )
for( int i = 0; i < m_board->GetAreaCount(); i++ )
{
const ZONE_CONTAINER* zone = m_board->GetArea( i );

View File

@ -272,6 +272,9 @@ endif(USE_DISTCC)
if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
# Add additional warning flags to avoid signed/unsigned comparison
set( CMAKE_CXX_FLAGS "-Wsign-compare" )
# Set 32-bit flag for GCC to prevent excess precision
if( CMAKE_SIZEOF_VOID_P EQUAL 4 )
set( CMAKE_CXX_FLAGS "-ffloat-store ${CMAKE_CXX_FLAGS}" )

View File

@ -892,11 +892,11 @@ public:
/**
* Function GetAreaCount
* @return int - The number of Areas or ZONE_CONTAINER.
* @return The number of Areas or ZONE_CONTAINER.
*/
int GetAreaCount() const
{
return (int) m_ZoneDescriptorList.size();
return static_cast<int>( m_ZoneDescriptorList.size() );
}
/* Functions used in test, merge and cut outlines */