Skip to content

Commit eda96ff

Browse files
FintasticManJF002
authored andcommitted
Update clang-{format,tidy} to 14
Also add configuration options only available in 13 and 14. Fixes warning about -fstack-usage in clang-tidy check.
1 parent 318a243 commit eda96ff

17 files changed

+32
-5
lines changed

.clang-format

+6-1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ Cpp11BracedListStyle: true
5959
DeriveLineEnding: false
6060
DerivePointerAlignment: false
6161
DisableFormat: false
62+
EmptyLineAfterAccessModifier: Never
6263
ExperimentalAutoDetectBinPacking: true
6364
FixNamespaceComments: false
6465
ForEachMacros:
@@ -78,6 +79,7 @@ IncludeCategories:
7879
SortPriority: 0
7980
IncludeIsMainRegex: '(Test)?$'
8081
IncludeIsMainSourceRegex: ''
82+
IndentAccessModifiers: false
8183
IndentCaseLabels: true
8284
IndentGotoLabels: true
8385
IndentPPDirectives: BeforeHash
@@ -92,6 +94,7 @@ MacroBlockBegin: ''
9294
MacroBlockEnd: ''
9395
MaxEmptyLinesToKeep: 1
9496
NamespaceIndentation: All
97+
PackConstructorInitializers: NextLine
9598
PenaltyBreakAssignment: 2
9699
PenaltyBreakBeforeFirstCallParameter: 19
97100
PenaltyBreakComment: 300
@@ -101,7 +104,9 @@ PenaltyBreakTemplateDeclaration: 10
101104
PenaltyExcessCharacter: 1000000
102105
PenaltyReturnTypeOnItsOwnLine: 60
103106
PointerAlignment: Left
107+
ReferenceAlignment: Pointer
104108
ReflowComments: true
109+
SeparateDefinitionBlocks: Always
105110
SortIncludes: false
106111
SortUsingDeclarations: true
107112
SpaceAfterCStyleCast: true
@@ -123,7 +128,7 @@ SpacesInCStyleCastParentheses: false
123128
SpacesInParentheses: false
124129
SpacesInSquareBrackets: false
125130
SpaceBeforeSquareBrackets: false
126-
# Needs new Clang: SpaceAroundPointerQualifiers: After
131+
SpaceAroundPointerQualifiers: Default
127132
Standard: Latest
128133
StatementMacros:
129134
- Q_UNUSED

.github/workflows/format.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: Install clang-format
2424
run: |
2525
sudo apt-get update
26-
sudo apt-get -y install clang-format-12
26+
sudo apt-get -y install clang-format-14
2727
2828
- name: Check formatting
2929
run: tests/test-format.sh
@@ -55,7 +55,7 @@ jobs:
5555
- name: Install clang-tidy
5656
run: |
5757
apt-get update
58-
apt-get -y install clang-tidy-12
58+
apt-get -y install clang-tidy-14
5959
- name: Prepare environment
6060
shell: bash
6161
env:

src/components/ble/BatteryInformationService.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ int BatteryInformationService::OnBatteryServiceRequested(uint16_t connectionHand
4949
}
5050
return 0;
5151
}
52+
5253
void BatteryInformationService::NotifyBatteryLevel(uint16_t connectionHandle, uint8_t level) {
5354
auto* om = ble_hs_mbuf_from_flat(&level, 1);
5455
ble_gattc_notify_custom(connectionHandle, batteryLevelHandle, om);

src/components/ble/MotionService.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ void MotionService::OnNewStepCountValue(uint32_t stepCount) {
9090

9191
ble_gattc_notify_custom(connectionHandle, stepCountHandle, om);
9292
}
93+
9394
void MotionService::OnNewMotionValues(int16_t x, int16_t y, int16_t z) {
9495
if (!motionValuesNoficationEnabled)
9596
return;

src/components/datetime/DateTimeController.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ void DateTime::Register(Pinetime::System::SystemTask* systemTask) {
142142
}
143143

144144
using ClockType = Pinetime::Controllers::Settings::ClockType;
145+
145146
std::string DateTime::FormattedTime() {
146147
// Return time as a string in 12- or 24-hour format
147148
char buff[9];

src/components/fs/FS.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -89,18 +89,23 @@ int FS::DirClose(lfs_dir_t* lfs_dir) {
8989
int FS::DirRead(lfs_dir_t* dir, lfs_info* info) {
9090
return lfs_dir_read(&lfs, dir, info);
9191
}
92+
9293
int FS::DirRewind(lfs_dir_t* dir) {
9394
return lfs_dir_rewind(&lfs, dir);
9495
}
96+
9597
int FS::DirCreate(const char* path) {
9698
return lfs_mkdir(&lfs, path);
9799
}
100+
98101
int FS::Rename(const char* oldPath, const char* newPath) {
99102
return lfs_rename(&lfs, oldPath, newPath);
100103
}
104+
101105
int FS::Stat(const char* path, lfs_info* info) {
102106
return lfs_stat(&lfs, path, info);
103107
}
108+
104109
lfs_ssize_t FS::GetFSSize() {
105110
return lfs_fs_size(&lfs);
106111
}

src/components/motion/MotionController.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,15 @@ bool MotionController::Should_ShakeWake(uint16_t thresh) {
6161
lastZForShake = z;
6262
return wake;
6363
}
64+
6465
int32_t MotionController::currentShakeSpeed() {
6566
return accumulatedspeed;
6667
}
6768

6869
void MotionController::IsSensorOk(bool isOk) {
6970
isSensorOk = isOk;
7071
}
72+
7173
void MotionController::Init(Pinetime::Drivers::Bma421::DeviceTypes types) {
7274
switch (types) {
7375
case Drivers::Bma421::DeviceTypes::BMA421:
@@ -81,6 +83,7 @@ void MotionController::Init(Pinetime::Drivers::Bma421::DeviceTypes types) {
8183
break;
8284
}
8385
}
86+
8487
void MotionController::SetService(Pinetime::Controllers::MotionService* service) {
8588
this->service = service;
8689
}

src/displayapp/DisplayApp.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,7 @@ void DisplayApp::PushMessageToSystemTask(Pinetime::System::Messages message) {
529529
void DisplayApp::Register(Pinetime::System::SystemTask* systemTask) {
530530
this->systemTask = systemTask;
531531
}
532+
532533
void DisplayApp::ApplyBrightness() {
533534
auto brightness = settingsController.GetBrightness();
534535
if (brightness != Controllers::BrightnessController::Levels::Low && brightness != Controllers::BrightnessController::Levels::Medium &&

src/displayapp/screens/WatchFaceCasioStyleG7710.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ void WatchFaceCasioStyleG7710::Refresh() {
333333
lv_obj_realign(stepIcon);
334334
}
335335
}
336+
336337
bool WatchFaceCasioStyleG7710::IsAvailable(Pinetime::Controllers::FS& filesystem) {
337338
lfs_file file = {};
338339

src/displayapp/screens/settings/SettingSetTime.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ namespace {
1818
screen->SetTime();
1919
}
2020
}
21+
2122
void ValueChangedHandler(void* userData) {
2223
auto* screen = static_cast<SettingSetTime*>(userData);
2324
screen->UpdateScreen();

src/displayapp/widgets/Counter.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ namespace {
1818
widget->DownBtnPressed();
1919
}
2020
}
21+
2122
constexpr int digitCount(int number) {
2223
int digitCount = 0;
2324
while (number > 0) {
@@ -67,6 +68,7 @@ void Counter::HideControls() {
6768
lv_obj_set_hidden(lowerLine, true);
6869
lv_obj_set_style_local_bg_opa(counterContainer, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP);
6970
}
71+
7072
void Counter::ShowControls() {
7173
lv_obj_set_hidden(upBtn, false);
7274
lv_obj_set_hidden(downBtn, false);

src/drivers/Bma421.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ Bma421::Values Bma421::Process() {
118118
// X and Y axis are swapped because of the way the sensor is mounted in the PineTime
119119
return {steps, data.y, data.x, data.z};
120120
}
121+
121122
bool Bma421::IsOk() const {
122123
return isOk;
123124
}
@@ -133,6 +134,7 @@ void Bma421::SoftReset() {
133134
nrf_delay_ms(1);
134135
}
135136
}
137+
136138
Bma421::DeviceTypes Bma421::DeviceType() const {
137139
return deviceType;
138140
}

src/drivers/DebugPins.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ void debugpins_init() {
1818
nrf_gpio_cfg_output(DebugPin4);
1919
nrf_gpio_pin_clear(DebugPin4);
2020
}
21+
2122
void debugpins_set(debugpins_pins pin) {
2223
nrf_gpio_pin_set(static_cast<uint32_t>(pin));
2324
}
@@ -33,6 +34,7 @@ void debugpins_pulse(debugpins_pins pin) {
3334
#else
3435
void debugpins_init() {
3536
}
37+
3638
void debugpins_set(debugpins_pins pin) {
3739
}
3840

src/drivers/Hrs3300.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <nrf_log.h>
1414

1515
using namespace Pinetime::Drivers;
16+
1617
/** Driver for the HRS3300 heart rate sensor.
1718
* Original implementation from wasp-os : https://github.com/daniel-thompson/wasp-os/blob/master/wasp/drivers/hrs3300.py
1819
*/

src/recoveryLoader.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ void RefreshWatchdog() {
8181
}
8282

8383
uint8_t displayBuffer[displayWidth * bytesPerPixel];
84+
8485
void Process(void* instance) {
8586
RefreshWatchdog();
8687
APP_GPIOTE_INIT(2);

tests/test-format.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ do
2020
*.cpp|*.h)
2121
echo Checking "$file"
2222
PATCH="$(basename "$file").patch"
23-
git clang-format-12 -q --style file --diff "$GITHUB_BASE_REF" "$file" > "$PATCH"
23+
git clang-format-14 -q --style file --diff "$GITHUB_BASE_REF" "$file" > "$PATCH"
2424
if [ -s "$PATCH" ]
2525
then
2626
printf "\033[31mError:\033[0m Formatting error in %s\n" "$file"

tests/test-tidy.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ do
1717
src/libs/*|src/FreeRTOS/*) continue ;;
1818
*.cpp|*.h)
1919
echo "::group::$file"
20-
clang-tidy-12 -p build "$file" || true
20+
clang-tidy-14 -p build "$file" || true
2121
echo "::endgroup::"
2222
esac
2323
done

0 commit comments

Comments
 (0)