Take advantage of clang-format-14 features
This commit is contained in:
parent
20f34d38fd
commit
f443a9529b
@ -163,6 +163,10 @@ SpacesInSquareBrackets: false
|
||||
# Line endings
|
||||
UseCRLF: false
|
||||
|
||||
# Qualifiers (const, volatile, static, etc)
|
||||
QualifierAlignment: Custom
|
||||
QualifierOrder: ['static', 'inline', 'constexpr', 'const', 'volatile', 'type']
|
||||
|
||||
---
|
||||
Language: ObjC
|
||||
IndentWidth: 4
|
||||
|
8
.github/workflows/ci.yml
vendored
8
.github/workflows/ci.yml
vendored
@ -190,23 +190,21 @@ jobs:
|
||||
cmake --build $GITHUB_WORKSPACE/test/install/build --config ${{ matrix.type.name == 'Debug' && 'Debug' || 'Release' }} ${{matrix.platform.suffix}}
|
||||
|
||||
format:
|
||||
name: Formatting with clang-format-${{ matrix.version }}
|
||||
name: Formatting
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
version: [12, 13, 14]
|
||||
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install Dependencies
|
||||
run: sudo apt-get install clang-format-${{ matrix.version }}
|
||||
run: sudo apt-get install clang-format-14
|
||||
|
||||
- name: Format Code
|
||||
run: cmake -DCLANG_FORMAT_EXECUTABLE=clang-format-${{ matrix.version }} -P $GITHUB_WORKSPACE/cmake/Format.cmake
|
||||
run: cmake -DCLANG_FORMAT_EXECUTABLE=clang-format-14 -P $GITHUB_WORKSPACE/cmake/Format.cmake
|
||||
|
||||
- name: Check Formatting
|
||||
run: git diff --exit-code
|
||||
|
@ -13,12 +13,8 @@ endif()
|
||||
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})
|
||||
unset(CLANG_FORMAT_VERSION)
|
||||
if(CMAKE_MATCH_1 LESS 12)
|
||||
message(FATAL_ERROR "clang-format version ${CMAKE_MATCH_1} is too low")
|
||||
elseif(CMAKE_MATCH_1 GREATER 14)
|
||||
message(FATAL_ERROR "clang-format version ${CMAKE_MATCH_1} is too high")
|
||||
else()
|
||||
message(STATUS "Using clang-format version ${CMAKE_MATCH_1}")
|
||||
if(NOT CMAKE_MATCH_1 EQUAL 14)
|
||||
message(FATAL_ERROR "clang-format version ${CMAKE_MATCH_1} not supported. Must use version 14")
|
||||
endif()
|
||||
|
||||
# Run
|
||||
|
@ -137,7 +137,7 @@ void SensorImpl::setEnabled(bool enabled)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
ASensor const* SensorImpl::getDefaultSensor(Sensor::Type sensor)
|
||||
const ASensor* SensorImpl::getDefaultSensor(Sensor::Type sensor)
|
||||
{
|
||||
// Find the Android sensor type
|
||||
static int types[] = {ASENSOR_TYPE_ACCELEROMETER,
|
||||
|
@ -104,7 +104,7 @@ private:
|
||||
/// \return The default Android sensor, a null pointer otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static ASensor const* getDefaultSensor(Sensor::Type sensor);
|
||||
static const ASensor* getDefaultSensor(Sensor::Type sensor);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Process the pending sensor data available and add them to our lists
|
||||
|
@ -42,7 +42,7 @@ String ClipboardImpl::getString()
|
||||
NSPasteboard* const pboard = [NSPasteboard generalPasteboard];
|
||||
NSString* const data = [pboard stringForType:NSPasteboardTypeString];
|
||||
|
||||
char const* utf8 = [data cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
const char* utf8 = [data cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
const NSUInteger length = [data lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
|
||||
|
||||
return String::fromUtf8(utf8, utf8 + length);
|
||||
|
@ -864,7 +864,7 @@ void HIDInputManager::buildMappings()
|
||||
if (translateToString)
|
||||
{
|
||||
// Unicode string length is usually less or equal to 4
|
||||
UniCharCount const maxLength = 4;
|
||||
const UniCharCount maxLength = 4;
|
||||
UniChar string[maxLength];
|
||||
UniCharCount length = 0;
|
||||
std::uint32_t deadKeyState = 0; // unused value
|
||||
|
@ -42,7 +42,7 @@ String ClipboardImpl::getString()
|
||||
{
|
||||
NSString* data = pboard.string;
|
||||
|
||||
char const* utf8 = [data cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
const char* utf8 = [data cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
NSUInteger length = [data lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
|
||||
|
||||
return String::fromUtf8(utf8, utf8 + length);
|
||||
|
Loading…
Reference in New Issue
Block a user