Remove FALLTHROUGH on empty cases

`#include "lib/code_annotation.h"` can be removed in some places.
This commit is contained in:
phosit 2025-01-29 12:47:21 +01:00 committed by phosit
parent 2fe7555002
commit 473f8ca72e
8 changed files with 47 additions and 50 deletions

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2024 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -91,7 +91,6 @@ void CSlider::HandleMessage(SGUIMessage& Message)
break;
}
case GUIM_MOUSE_PRESS_LEFT:
FALLTHROUGH;
case GUIM_MOUSE_MOTION:
{
if (m_Pressed)

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2023 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -127,7 +127,7 @@ std::unique_ptr<icu::DateFormat> CreateDateTimeInstance(const L10n::DateTimeType
return std::unique_ptr<icu::DateFormat>{
icu::SimpleDateFormat::createTimeInstance(style, locale)};
case L10n::DateTime: FALLTHROUGH;
case L10n::DateTime:
default:
return std::unique_ptr<icu::DateFormat>{
icu::SimpleDateFormat::createDateTimeInstance(style, style, locale)};

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2024 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -37,19 +37,19 @@ uint32_t GetAttributeSize(const Renderer::Backend::Format format)
{
switch (format)
{
case Renderer::Backend::Format::R8G8B8A8_UNORM: FALLTHROUGH;
case Renderer::Backend::Format::R8G8B8A8_UNORM:
case Renderer::Backend::Format::R8G8B8A8_UINT:
return sizeof(u8) * 4;
case Renderer::Backend::Format::A8_UNORM:
return sizeof(u8);
case Renderer::Backend::Format::R16_UNORM: FALLTHROUGH;
case Renderer::Backend::Format::R16_UINT: FALLTHROUGH;
case Renderer::Backend::Format::R16_SINT: FALLTHROUGH;
case Renderer::Backend::Format::R16_UNORM:
case Renderer::Backend::Format::R16_UINT:
case Renderer::Backend::Format::R16_SINT:
case Renderer::Backend::Format::R16_SFLOAT:
return sizeof(u16);
case Renderer::Backend::Format::R16G16_UNORM: FALLTHROUGH;
case Renderer::Backend::Format::R16G16_UINT: FALLTHROUGH;
case Renderer::Backend::Format::R16G16_SINT: FALLTHROUGH;
case Renderer::Backend::Format::R16G16_UNORM:
case Renderer::Backend::Format::R16G16_UINT:
case Renderer::Backend::Format::R16G16_SINT:
case Renderer::Backend::Format::R16G16_SFLOAT:
return sizeof(u16) * 2;
case Renderer::Backend::Format::R16G16B16_SFLOAT:

View file

@ -1016,21 +1016,21 @@ bool CDevice::IsTextureFormatSupported(const Format format) const
case Format::UNDEFINED:
break;
case Format::R8G8B8_UNORM: FALLTHROUGH;
case Format::R8G8B8A8_UNORM: FALLTHROUGH;
case Format::A8_UNORM: FALLTHROUGH;
case Format::R8G8B8_UNORM:
case Format::R8G8B8A8_UNORM:
case Format::A8_UNORM:
case Format::L8_UNORM:
supported = true;
break;
case Format::R32_SFLOAT: FALLTHROUGH;
case Format::R32G32_SFLOAT: FALLTHROUGH;
case Format::R32G32B32_SFLOAT: FALLTHROUGH;
case Format::R32_SFLOAT:
case Format::R32G32_SFLOAT:
case Format::R32G32B32_SFLOAT:
case Format::R32G32B32A32_SFLOAT:
break;
case Format::D16_UNORM: FALLTHROUGH;
case Format::D24_UNORM: FALLTHROUGH;
case Format::D16_UNORM:
case Format::D24_UNORM:
case Format::D32_SFLOAT:
supported = true;
break;
@ -1043,9 +1043,9 @@ bool CDevice::IsTextureFormatSupported(const Format format) const
case Format::D32_SFLOAT_S8_UINT:
break;
case Format::BC1_RGB_UNORM: FALLTHROUGH;
case Format::BC1_RGBA_UNORM: FALLTHROUGH;
case Format::BC2_UNORM: FALLTHROUGH;
case Format::BC1_RGB_UNORM:
case Format::BC1_RGBA_UNORM:
case Format::BC2_UNORM:
case Format::BC3_UNORM:
supported = m_Capabilities.S3TC;
break;

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2022 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -19,7 +19,6 @@
#include "Mapping.h"
#include "lib/code_annotation.h"
#include "lib/config2.h"
namespace Renderer
@ -95,9 +94,9 @@ GLenum FromBlendFactor(const BlendFactor blendFactor)
CASE(SRC_ALPHA_SATURATE);
#undef CASE
// Dual source blending presents only in GL_VERSION >= 3.3.
case BlendFactor::SRC1_COLOR: FALLTHROUGH;
case BlendFactor::ONE_MINUS_SRC1_COLOR: FALLTHROUGH;
case BlendFactor::SRC1_ALPHA: FALLTHROUGH;
case BlendFactor::SRC1_COLOR:
case BlendFactor::ONE_MINUS_SRC1_COLOR:
case BlendFactor::SRC1_ALPHA:
case BlendFactor::ONE_MINUS_SRC1_ALPHA:
debug_warn("Unsupported blend factor.");
break;
@ -117,7 +116,7 @@ GLenum FromBlendOp(const BlendOp blendOp)
case BlendOp::MIN: mode = GL_MIN; break;
case BlendOp::MAX: mode = GL_MAX; break;
#else
case BlendOp::MIN: FALLTHROUGH;
case BlendOp::MIN:
case BlendOp::MAX:
debug_warn("Unsupported blend op.");
break;

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2024 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -140,10 +140,10 @@ GLboolean NormalizedFromFormat(const Format format)
{
switch (format)
{
case Format::R8G8_UNORM: FALLTHROUGH;
case Format::R8G8B8_UNORM: FALLTHROUGH;
case Format::R8G8B8A8_UNORM: FALLTHROUGH;
case Format::R16_UNORM: FALLTHROUGH;
case Format::R8G8_UNORM:
case Format::R8G8B8_UNORM:
case Format::R8G8B8A8_UNORM:
case Format::R16_UNORM:
case Format::R16G16_UNORM:
return GL_TRUE;
default:
@ -1660,13 +1660,13 @@ void CShaderProgram::VertexAttribPointer(
case VertexAttributeStream::COLOR:
ColorPointer(format, stride, static_cast<const u8*>(data) + offset);
break;
case VertexAttributeStream::UV0: FALLTHROUGH;
case VertexAttributeStream::UV1: FALLTHROUGH;
case VertexAttributeStream::UV2: FALLTHROUGH;
case VertexAttributeStream::UV3: FALLTHROUGH;
case VertexAttributeStream::UV4: FALLTHROUGH;
case VertexAttributeStream::UV5: FALLTHROUGH;
case VertexAttributeStream::UV6: FALLTHROUGH;
case VertexAttributeStream::UV0:
case VertexAttributeStream::UV1:
case VertexAttributeStream::UV2:
case VertexAttributeStream::UV3:
case VertexAttributeStream::UV4:
case VertexAttributeStream::UV5:
case VertexAttributeStream::UV6:
case VertexAttributeStream::UV7:
{
const int indexOffset = static_cast<int>(stream) - static_cast<int>(VertexAttributeStream::UV0);

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2022 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -19,7 +19,6 @@
#include "Texture.h"
#include "lib/code_annotation.h"
#include "lib/config2.h"
#include "renderer/backend/gl/Device.h"
#include "renderer/backend/gl/DeviceCommandContext.h"
@ -243,9 +242,9 @@ std::unique_ptr<CTexture> CTexture::Create(
pixelType = GL_UNSIGNED_INT_24_8_EXT;
break;
#endif
case Format::BC1_RGB_UNORM: FALLTHROUGH;
case Format::BC1_RGBA_UNORM: FALLTHROUGH;
case Format::BC2_UNORM: FALLTHROUGH;
case Format::BC1_RGB_UNORM:
case Format::BC1_RGBA_UNORM:
case Format::BC2_UNORM:
case Format::BC3_UNORM:
compressedFormat = true;
break;

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2024 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -839,9 +839,9 @@ bool CDevice::IsTextureFormatSupported(const Format format) const
case Format::R8G8B8_UNORM:
return false;
case Format::BC1_RGB_UNORM: FALLTHROUGH;
case Format::BC1_RGBA_UNORM: FALLTHROUGH;
case Format::BC2_UNORM: FALLTHROUGH;
case Format::BC1_RGB_UNORM:
case Format::BC1_RGBA_UNORM:
case Format::BC2_UNORM:
case Format::BC3_UNORM:
if (m_Capabilities.S3TC)
return true;