OpenTTD Source 20250312-master-gcdcc6b491d
enum_over_optimisation.cpp File Reference

Test whether we do not trigger an over optimisation of enums. More...

#include "../stdafx.h"
#include "../core/enum_type.hpp"
#include "../3rdparty/catch2/catch.hpp"

Go to the source code of this file.

Enumerations

enum  TestEnum : int8_t { ZERO , ONE , TWO }
 
enum class  TestEnumFlags : uint8_t { Zero = 0 , One = 1 << 0 , Two = 1 << 1 }
 

Functions

 TEST_CASE ("EnumOverOptimisation_BoundsCheck")
 
 TEST_CASE ("EnumOverOptimisation_Bitmask")
 

Detailed Description

Test whether we do not trigger an over optimisation of enums.

For more details, see http://gcc.gnu.org/PR43680 and PR#5246.

Definition in file enum_over_optimisation.cpp.

Enumeration Type Documentation

◆ TestEnum

enum TestEnum : int8_t

Definition at line 20 of file enum_over_optimisation.cpp.

◆ TestEnumFlags

enum class TestEnumFlags : uint8_t
strong

Definition at line 35 of file enum_over_optimisation.cpp.

Function Documentation

◆ TEST_CASE() [1/2]

TEST_CASE ( "EnumOverOptimisation_Bitmask"  )

Definition at line 42 of file enum_over_optimisation.cpp.

◆ TEST_CASE() [2/2]

TEST_CASE ( "EnumOverOptimisation_BoundsCheck"  )

Definition at line 26 of file enum_over_optimisation.cpp.