1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-30 16:24:09 +03:00

CI - clang-format-18 (#9225)

* Fix shell variable comparison without $CI present

+ '[' = true ']'
./tests/restyle.sh: line 16: [: =: unary operator expected

vs.

+ '[' '' = true ']'

* Update to clang-format-18

new opt to skip overly eager macro formatting
https://clang.llvm.org/docs/ClangFormatStyleOptions.html#skipmacrodefinitionbody

minor changes between 15 and 18 for ide examples

reference arduino-ide format is still stuck with 15, though
https://github.com/arduino/clang-static-binaries/releases

* Pin clang-format in CI recipe not the script itself

* style
This commit is contained in:
Max Prokhorov
2025-01-24 09:40:22 +03:00
committed by GitHub
parent bb79e9076e
commit be3035c853
14 changed files with 40 additions and 63 deletions

View File

@ -27,3 +27,4 @@ BreakBeforeBraces: Allman
IndentWidth: 4
IndentCaseLabels: false
ReflowComments: false
SkipMacroDefinitionBody: true

View File

@ -27,8 +27,7 @@ class TestCase
public:
TestCase(TestCase* prev, test_case_func_t func, const char* file, size_t line, const char* name,
const char* desc) :
m_func(func),
m_file(file), m_line(line), m_name(name), m_desc(desc)
m_func(func), m_file(file), m_line(line), m_name(name), m_desc(desc)
{
if (prev)
{

View File

@ -184,7 +184,7 @@
struct name \
{ \
struct type* stqh_first; /* first element */ \
struct type** stqh_last; /* addr of last next element */ \
struct type** stqh_last; /* addr of last next element */ \
}
#define STAILQ_HEAD_INITIALIZER(head) \
@ -371,7 +371,7 @@
struct name \
{ \
struct type* tqh_first; /* first element */ \
struct type** tqh_last; /* addr of last next element */ \
struct type** tqh_last; /* addr of last next element */ \
}
#define TAILQ_HEAD_INITIALIZER(head) \

View File

@ -8,16 +8,13 @@ test -d ${root}/cores/esp8266
test -d ${root}/libraries
# allow `env CLANG_FORMAT=clang-format-N`, or some other version
# default to v15, latest stable version from ubuntu-latest Github Actions image
CLANG_FORMAT=${CLANG_FORMAT:-clang-format-15}
CLANG_FORMAT=${CLANG_FORMAT:-clang-format}
cd $root
python $root/tests/restyle.py format --clang-format=$CLANG_FORMAT preset --include core --include arduino
if [ $CI = "true" ] ; then
echo foo
if [ "$CI" = "true" ] ; then
python $root/tests/restyle.py assert --with-summary --with-errors
else
echo bar
python $root/tests/restyle.py assert --with-diff
fi