Upgrade to clang-format-17

This commit is contained in:
Chris Thrasher 2024-10-13 16:59:21 -06:00
parent 7a8d75b7ac
commit c38b98c653
32 changed files with 80 additions and 80 deletions

View File

@ -269,17 +269,17 @@ jobs:
format: format:
name: Formatting name: Formatting
runs-on: ubuntu-22.04 runs-on: ubuntu-24.04
strategy:
fail-fast: false
steps: steps:
- name: Install Clang Format
run: sudo apt-get install clang-format-17
- name: Checkout Code - name: Checkout Code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Format Code - name: Format Code
run: cmake -DCLANG_FORMAT_EXECUTABLE=clang-format-14 -P cmake/Format.cmake run: cmake -DCLANG_FORMAT_EXECUTABLE=clang-format-17 -P cmake/Format.cmake
- name: Check Formatting - name: Check Formatting
run: git diff --exit-code run: git diff --exit-code

View File

@ -529,7 +529,7 @@ if(SFML_BUILD_TEST_SUITE)
endif() endif()
endif() endif()
sfml_set_option(CLANG_FORMAT_EXECUTABLE clang-format STRING "Override clang-format executable, requires version 14") sfml_set_option(CLANG_FORMAT_EXECUTABLE clang-format STRING "Override clang-format executable, requires version 17")
add_custom_target(format add_custom_target(format
COMMAND ${CMAKE_COMMAND} -DCLANG_FORMAT_EXECUTABLE=${CLANG_FORMAT_EXECUTABLE} -P ./cmake/Format.cmake COMMAND ${CMAKE_COMMAND} -DCLANG_FORMAT_EXECUTABLE=${CLANG_FORMAT_EXECUTABLE} -P ./cmake/Format.cmake
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} VERBATIM) WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} VERBATIM)

View File

@ -13,8 +13,8 @@ endif()
execute_process(COMMAND ${CLANG_FORMAT_EXECUTABLE} --version OUTPUT_VARIABLE CLANG_FORMAT_VERSION) execute_process(COMMAND ${CLANG_FORMAT_EXECUTABLE} --version OUTPUT_VARIABLE CLANG_FORMAT_VERSION)
string(REGEX MATCH "clang-format version ([0-9]+)" CLANG_FORMAT_VERSION ${CLANG_FORMAT_VERSION}) string(REGEX MATCH "clang-format version ([0-9]+)" CLANG_FORMAT_VERSION ${CLANG_FORMAT_VERSION})
unset(CLANG_FORMAT_VERSION) unset(CLANG_FORMAT_VERSION)
if(NOT CMAKE_MATCH_1 EQUAL 14) if(NOT CMAKE_MATCH_1 EQUAL 17)
message(FATAL_ERROR "clang-format version ${CMAKE_MATCH_1} not supported. Must use version 14") message(FATAL_ERROR "clang-format version ${CMAKE_MATCH_1} not supported. Must use version 17")
endif() endif()
# Run # Run

View File

@ -441,7 +441,7 @@ Packet& Packet::operator<<(std::int64_t data)
static_cast<std::uint8_t>((data >> 24) & 0xFF), static_cast<std::uint8_t>((data >> 24) & 0xFF),
static_cast<std::uint8_t>((data >> 16) & 0xFF), static_cast<std::uint8_t>((data >> 16) & 0xFF),
static_cast<std::uint8_t>((data >> 8) & 0xFF), static_cast<std::uint8_t>((data >> 8) & 0xFF),
static_cast<std::uint8_t>((data)&0xFF)}; static_cast<std::uint8_t>((data) & 0xFF)};
append(&toWrite, sizeof(toWrite)); append(&toWrite, sizeof(toWrite));
return *this; return *this;
@ -461,7 +461,7 @@ Packet& Packet::operator<<(std::uint64_t data)
static_cast<std::uint8_t>((data >> 24) & 0xFF), static_cast<std::uint8_t>((data >> 24) & 0xFF),
static_cast<std::uint8_t>((data >> 16) & 0xFF), static_cast<std::uint8_t>((data >> 16) & 0xFF),
static_cast<std::uint8_t>((data >> 8) & 0xFF), static_cast<std::uint8_t>((data >> 8) & 0xFF),
static_cast<std::uint8_t>((data)&0xFF)}; static_cast<std::uint8_t>((data) & 0xFF)};
append(&toWrite, sizeof(toWrite)); append(&toWrite, sizeof(toWrite));
return *this; return *this;

View File

@ -86,7 +86,7 @@ void ensureInit()
sf::priv::EaglContext::getFunction("glRenderbufferStorageOES")); sf::priv::EaglContext::getFunction("glRenderbufferStorageOES"));
} }
} }
} } // namespace
namespace sf::priv namespace sf::priv

View File

@ -138,4 +138,4 @@ Vector2i getTouchPosition(unsigned int finger, const WindowBase& /* relativeTo *
return getTouchPosition(finger); return getTouchPosition(finger);
} }
} // namespace sf::priv } // namespace sf::priv::InputImpl

View File

@ -38,7 +38,7 @@ SFAppDelegate* delegateInstance = nullptr;
// Current touches positions // Current touches positions
std::vector<sf::Vector2i> touchPositions; std::vector<sf::Vector2i> touchPositions;
} } // namespace
@interface SFAppDelegate () @interface SFAppDelegate ()

View File

@ -45,7 +45,7 @@ NSCursor* loadFromSelector(SEL selector)
return nil; return nil;
} }
} } // namespace
namespace sf::priv namespace sf::priv
{ {

View File

@ -37,7 +37,7 @@ namespace
{ {
const std::uint8_t unknownVirtualCode = 0xff; const std::uint8_t unknownVirtualCode = 0xff;
const bool isIsoKeyboard = (KBGetLayoutType(LMGetKbdType()) == kKeyboardISO); const bool isIsoKeyboard = (KBGetLayoutType(LMGetKbdType()) == kKeyboardISO);
} } // namespace
namespace sf::priv namespace sf::priv
{ {

View File

@ -115,7 +115,7 @@ SFOpenGLView* getSFOpenGLViewFromSFMLWindow(const sf::WindowBase& window)
return view; return view;
} }
} } // namespace
namespace sf::priv::InputImpl namespace sf::priv::InputImpl
{ {
@ -263,4 +263,4 @@ Vector2i getTouchPosition(unsigned int /*finger*/, const WindowBase& /*relativeT
return {}; return {};
} }
} // namespace sf::priv } // namespace sf::priv::InputImpl

View File

@ -131,7 +131,7 @@ void processLeftRightModifiers(
processOneModifier(modifiers, leftMask, leftWasDown, leftKey, leftCode, requester); processOneModifier(modifiers, leftMask, leftWasDown, leftKey, leftCode, requester);
processOneModifier(modifiers, rightMask, rightWasDown, rightKey, rightCode, requester); processOneModifier(modifiers, rightMask, rightWasDown, rightKey, rightCode, requester);
} }
} } // namespace
//////////////////////////////////////////////////////// ////////////////////////////////////////////////////////

View File

@ -93,7 +93,7 @@ void showMouseCursor()
isCursorHidden = false; isCursorHidden = false;
} }
} }
} } // namespace
#pragma mark #pragma mark
#pragma mark WindowImplCocoa's ctor/dtor #pragma mark WindowImplCocoa's ctor/dtor