mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-16 05:13:58 -07:00
Replace FALLTHROUGH by the standard attribute
This commit is contained in:
parent
473f8ca72e
commit
b41ca5ad78
7 changed files with 17 additions and 30 deletions
|
|
@ -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
|
||||
|
|
@ -328,7 +328,7 @@ void CInput::ManuallyMutableHandleKeyDownEvent(const SDL_Keycode keyCode)
|
|||
}
|
||||
|
||||
cooked = '\n'; // Change to '\n' and do default:
|
||||
FALLTHROUGH;
|
||||
[[fallthrough]];
|
||||
}
|
||||
default: // Insert a character
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -345,7 +345,7 @@ void CGUIString::SetValue(const CStrW& str)
|
|||
LOGERROR("Parameter without value at pos %d '%s'", p, utf8_from_wstring(str));
|
||||
break;
|
||||
}
|
||||
FALLTHROUGH;
|
||||
[[fallthrough]];
|
||||
case L'=':
|
||||
// parse a quoted parameter
|
||||
if (closing) // We still parse them to make error handling cleaner
|
||||
|
|
@ -372,7 +372,7 @@ void CGUIString::SetValue(const CStrW& str)
|
|||
break;
|
||||
}
|
||||
// NOTE: We do not support \n in tag parameters
|
||||
FALLTHROUGH;
|
||||
[[fallthrough]];
|
||||
default:
|
||||
param.push_back(str[p]);
|
||||
}
|
||||
|
|
@ -437,7 +437,7 @@ void CGUIString::SetValue(const CStrW& str)
|
|||
m_RawString.push_back(L'\n');
|
||||
break;
|
||||
}
|
||||
FALLTHROUGH;
|
||||
[[fallthrough]];
|
||||
default:
|
||||
++rawpos;
|
||||
m_RawString.push_back(str[p]);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2021 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
|
||||
|
|
@ -403,16 +403,4 @@ template<typename T, size_t n> char (*ArraySizeDeducer(T (&)[n]))[n];
|
|||
#define WIDEN2(x) L ## x
|
||||
#define WIDEN(x) WIDEN2(x)
|
||||
|
||||
// TODO: Replace this with [[fallthrough]] once we support C++17
|
||||
#if __has_cpp_attribute(fallthrough) || defined(__cplusplus) && __cplusplus >= 201703L
|
||||
# define FALLTHROUGH [[fallthrough]]
|
||||
#elif __has_cpp_attribute(gnu::fallthrough)
|
||||
# define FALLTHROUGH [[gnu::fallthrough]]
|
||||
#elif __has_cpp_attribute(clang::fallthrough)
|
||||
# define FALLTHROUGH [[clang::fallthrough]]
|
||||
#else
|
||||
# define FALLTHROUGH
|
||||
// TODO: Maybe use __fallthrough for the MSVC code analyzer (also figure out if we need to add some switch when switching to a newer version of VS that supports [[fallthrough]]
|
||||
#endif
|
||||
|
||||
#endif // #ifndef INCLUDED_CODE_ANNOTATION
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2021 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
|
||||
|
|
@ -173,7 +173,7 @@ static ErrorReactionInternal try_gui_display_error(const wchar_t* text, bool man
|
|||
{
|
||||
case 103: // Debugger
|
||||
udbg_launch_debugger();
|
||||
FALLTHROUGH;
|
||||
[[fallthrough]];
|
||||
|
||||
case 102: // Break
|
||||
if(manual_break)
|
||||
|
|
@ -245,7 +245,7 @@ ErrorReactionInternal sys_display_error(const wchar_t* text, size_t flags)
|
|||
case EOF:
|
||||
case 'd': case 'D':
|
||||
udbg_launch_debugger();
|
||||
FALLTHROUGH;
|
||||
[[fallthrough]];
|
||||
|
||||
case 'b': case 'B':
|
||||
if(manual_break)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -385,7 +385,7 @@ void CTexturedLineRData::CreateLineCap(const SOverlayTexturedLine& line, const C
|
|||
radius *= 1.5f; // make it a bit sharper (note that we don't use the radius for the butt-end corner points so it should be ok)
|
||||
centerVertex.m_UV.X = 0.480f; // slight visual correction to make the texture match up better at the corner points
|
||||
}
|
||||
FALLTHROUGH;
|
||||
[[fallthrough]];
|
||||
case SOverlayTexturedLine::LINECAP_ROUND:
|
||||
{
|
||||
// Draw a rounded line cap in the 3D plane of the line specified by the two corner points and the normal vector of the
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2023 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
|
||||
|
|
@ -411,7 +411,7 @@ public:
|
|||
const CMessageValueModification& msgData = static_cast<const CMessageValueModification&> (msg);
|
||||
if (msgData.component != L"UnitMotion")
|
||||
break;
|
||||
FALLTHROUGH;
|
||||
[[fallthrough]];
|
||||
}
|
||||
case MT_OwnershipChanged:
|
||||
{
|
||||
|
|
|
|||
|
|
@ -767,7 +767,7 @@ namespace Ogre
|
|||
{
|
||||
case Token::TK_EOS:
|
||||
ErrorHandler(Line, "Unfinished list of arguments", nullptr);
|
||||
FALLTHROUGH;
|
||||
[[fallthrough]];
|
||||
case Token::TK_ERROR:
|
||||
return Token (Token::TK_ERROR);
|
||||
case Token::TK_PUNCTUATION:
|
||||
|
|
@ -874,7 +874,7 @@ namespace Ogre
|
|||
{
|
||||
case Token::TK_EOS:
|
||||
ErrorHandler(Line, "Unfinished list of arguments", nullptr);
|
||||
FALLTHROUGH;
|
||||
[[fallthrough]];
|
||||
case Token::TK_ERROR:
|
||||
return Token (Token::TK_ERROR);
|
||||
|
||||
|
|
@ -1345,9 +1345,8 @@ namespace Ogre
|
|||
output.AppendNL (empty_lines);
|
||||
empty_lines = 0;
|
||||
}
|
||||
FALLTHROUGH; // to default
|
||||
[[fallthrough]];
|
||||
case Token::TK_WHITESPACE:
|
||||
// Fallthrough to default
|
||||
default:
|
||||
// Passthrough all other tokens
|
||||
if (output_enabled)
|
||||
|
|
|
|||
Loading…
Reference in a new issue