Skip to content

CI - clang-format-18 #9225

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/style-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
run: |
sudo apt update
python ./tests/test_restyle.py --quiet
bash ./tests/ci/style_check.sh
env CLANG_FORMAT="clang-format-18" bash ./tests/ci/style_check.sh

# Validate orthography

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public:
// Close the file
if (_fsUploadFile) { _fsUploadFile.close(); }
} // if
} // upload()
} // upload()

protected:
File _fsUploadFile;
Expand Down
3 changes: 1 addition & 2 deletions libraries/ESP8266mDNS/src/LEAmDNS.h
Original file line number Diff line number Diff line change
Expand Up @@ -492,8 +492,7 @@ namespace MDNSImplementation
{
MDNSServiceInfo(MDNSResponder& p_pM, MDNSResponder::hMDNSServiceQuery p_hS,
uint32_t p_u32A) :
p_pMDNSResponder(p_pM),
p_hServiceQuery(p_hS), p_u32AnswerIndex(p_u32A) {};
p_pMDNSResponder(p_pM), p_hServiceQuery(p_hS), p_u32AnswerIndex(p_u32A) {};
struct CompareKey
{
bool operator()(char const* a, char const* b) const
Expand Down
18 changes: 9 additions & 9 deletions libraries/ESP8266mDNS/src/LEAmDNS_Control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -631,8 +631,8 @@ namespace MDNSImplementation
}
}
} // service tiebreak possibility
} // for services
} // ANY answers
} // for services
} // ANY answers
}
else
{
Expand Down Expand Up @@ -955,7 +955,7 @@ namespace MDNSImplementation
}

pRRAnswer = pRRAnswer->m_pNext; // Next collected answer
} // while (answers)
} // while (answers)
} while ((bFoundNewKeyAnswer) && (bResult));
} // else: No answers provided
DEBUG_EX_ERR(if (!bResult) {
Expand Down Expand Up @@ -1110,7 +1110,7 @@ namespace MDNSImplementation
}
pServiceQuery = pServiceQuery->m_pNext;
} // while(service query)
} // else: No p_pSRVAnswer
} // else: No p_pSRVAnswer
DEBUG_EX_ERR(if (!bResult) {
DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] _processSRVAnswer: FAILED!\n"));
});
Expand Down Expand Up @@ -1173,7 +1173,7 @@ namespace MDNSImplementation
}
pServiceQuery = pServiceQuery->m_pNext;
} // while(service query)
} // else: No p_pTXTAnswer
} // else: No p_pTXTAnswer
DEBUG_EX_ERR(if (!bResult) {
DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] _processTXTAnswer: FAILED!\n"));
});
Expand Down Expand Up @@ -1261,7 +1261,7 @@ namespace MDNSImplementation
}
pServiceQuery = pServiceQuery->m_pNext;
} // while(service query)
} // else: No p_pAAnswer
} // else: No p_pAAnswer
DEBUG_EX_ERR(if (!bResult) {
DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] _processAAnswer: FAILED!\n"));
});
Expand Down Expand Up @@ -1349,7 +1349,7 @@ namespace MDNSImplementation
}
pServiceQuery = pServiceQuery->m_pNext;
} // while(service query)
} // else: No p_pAAAAAnswer
} // else: No p_pAAAAAnswer

return bResult;
}
Expand Down Expand Up @@ -2121,7 +2121,7 @@ namespace MDNSImplementation
} // IP4 flagged

pIP4Address = pNextIP4Address; // Next
} // while
} // while
#endif
#ifdef MDNS_IP6_SUPPORT
// IP6Address (from AAAA)
Expand Down Expand Up @@ -2185,7 +2185,7 @@ namespace MDNSImplementation
} // IP6 flagged

pIP6Address = pNextIP6Address; // Next
} // while
} // while
#endif
pSQAnswer = pNextSQAnswer;
}
Expand Down
39 changes: 14 additions & 25 deletions libraries/ESP8266mDNS/src/LEAmDNS_Structs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ namespace MDNSImplementation
MDNSResponder::stcMDNSServiceTxt::stcMDNSServiceTxt(const char* p_pcKey /*= 0*/,
const char* p_pcValue /*= 0*/,
bool p_bTemp /*= false*/) :
m_pNext(0),
m_pcKey(0), m_pcValue(0), m_bTemp(p_bTemp)
m_pNext(0), m_pcKey(0), m_pcValue(0), m_bTemp(p_bTemp)
{
setKey(p_pcKey);
setValue(p_pcValue);
Expand All @@ -67,8 +66,7 @@ namespace MDNSImplementation
*/
MDNSResponder::stcMDNSServiceTxt::stcMDNSServiceTxt(
const MDNSResponder::stcMDNSServiceTxt& p_Other) :
m_pNext(0),
m_pcKey(0), m_pcValue(0), m_bTemp(false)
m_pNext(0), m_pcKey(0), m_pcValue(0), m_bTemp(false)
{
operator=(p_Other);
}
Expand Down Expand Up @@ -614,9 +612,8 @@ namespace MDNSImplementation
bool p_bRA /*= false*/, unsigned char p_ucRCode /*= 0*/, uint16_t p_u16QDCount /*= 0*/,
uint16_t p_u16ANCount /*= 0*/, uint16_t p_u16NSCount /*= 0*/,
uint16_t p_u16ARCount /*= 0*/) :
m_u16ID(p_u16ID),
m_1bQR(p_bQR), m_4bOpcode(p_ucOpcode), m_1bAA(p_bAA), m_1bTC(p_bTC), m_1bRD(p_bRD),
m_1bRA(p_bRA), m_3bZ(0), m_4bRCode(p_ucRCode), m_u16QDCount(p_u16QDCount),
m_u16ID(p_u16ID), m_1bQR(p_bQR), m_4bOpcode(p_ucOpcode), m_1bAA(p_bAA), m_1bTC(p_bTC),
m_1bRD(p_bRD), m_1bRA(p_bRA), m_3bZ(0), m_4bRCode(p_ucRCode), m_u16QDCount(p_u16QDCount),
m_u16ANCount(p_u16ANCount), m_u16NSCount(p_u16NSCount), m_u16ARCount(p_u16ARCount)
{
}
Expand Down Expand Up @@ -813,8 +810,7 @@ namespace MDNSImplementation
*/
MDNSResponder::stcMDNS_RRAttributes::stcMDNS_RRAttributes(
uint16_t p_u16Type /*= 0*/, uint16_t p_u16Class /*= 1 DNS_RRCLASS_IN Internet*/) :
m_u16Type(p_u16Type),
m_u16Class(p_u16Class)
m_u16Type(p_u16Type), m_u16Class(p_u16Class)
{
}

Expand Down Expand Up @@ -910,8 +906,7 @@ namespace MDNSImplementation
MDNSResponder::stcMDNS_RRAnswer::stcMDNS_RRAnswer(
enuAnswerType p_AnswerType, const MDNSResponder::stcMDNS_RRHeader& p_Header,
uint32_t p_u32TTL) :
m_pNext(0),
m_AnswerType(p_AnswerType), m_Header(p_Header), m_u32TTL(p_u32TTL)
m_pNext(0), m_AnswerType(p_AnswerType), m_Header(p_Header), m_u32TTL(p_u32TTL)
{
// Extract 'cache flush'-bit
m_bCacheFlush = (m_Header.m_Attributes.m_u16Class & 0x8000);
Expand Down Expand Up @@ -955,8 +950,7 @@ namespace MDNSImplementation
*/
MDNSResponder::stcMDNS_RRAnswerA::stcMDNS_RRAnswerA(
const MDNSResponder::stcMDNS_RRHeader& p_Header, uint32_t p_u32TTL) :
stcMDNS_RRAnswer(AnswerType_A, p_Header, p_u32TTL),
m_IPAddress(0, 0, 0, 0)
stcMDNS_RRAnswer(AnswerType_A, p_Header, p_u32TTL), m_IPAddress(0, 0, 0, 0)
{
}

Expand Down Expand Up @@ -1094,8 +1088,8 @@ namespace MDNSImplementation
*/
MDNSResponder::stcMDNS_RRAnswerSRV::stcMDNS_RRAnswerSRV(
const MDNSResponder::stcMDNS_RRHeader& p_Header, uint32_t p_u32TTL) :
stcMDNS_RRAnswer(AnswerType_SRV, p_Header, p_u32TTL),
m_u16Priority(0), m_u16Weight(0), m_u16Port(0)
stcMDNS_RRAnswer(AnswerType_SRV, p_Header, p_u32TTL), m_u16Priority(0), m_u16Weight(0),
m_u16Port(0)
{
}

Expand Down Expand Up @@ -1132,8 +1126,7 @@ namespace MDNSImplementation
*/
MDNSResponder::stcMDNS_RRAnswerGeneric::stcMDNS_RRAnswerGeneric(
const stcMDNS_RRHeader& p_Header, uint32_t p_u32TTL) :
stcMDNS_RRAnswer(AnswerType_Generic, p_Header, p_u32TTL),
m_u16RDLength(0), m_pu8RDData(0)
stcMDNS_RRAnswer(AnswerType_Generic, p_Header, p_u32TTL), m_u16RDLength(0), m_pu8RDData(0)
{
}

Expand Down Expand Up @@ -1212,8 +1205,7 @@ namespace MDNSImplementation
MDNSResponder::stcMDNSService::stcMDNSService(const char* p_pcName /*= 0*/,
const char* p_pcService /*= 0*/,
const char* p_pcProtocol /*= 0*/) :
m_pNext(0),
m_pcName(0), m_bAutoName(false), m_pcService(0), m_pcProtocol(0), m_u16Port(0),
m_pNext(0), m_pcName(0), m_bAutoName(false), m_pcService(0), m_pcProtocol(0), m_u16Port(0),
m_u8ReplyMask(0), m_fnTxtCallback(0)
{
setName(p_pcName);
Expand Down Expand Up @@ -1538,9 +1530,7 @@ namespace MDNSImplementation
MDNSResponder::stcMDNSServiceQuery::stcAnswer::stcIP4Address::stcIP4Address constructor
*/
MDNSResponder::stcMDNSServiceQuery::stcAnswer::stcIP4Address::stcIP4Address(
IPAddress p_IPAddress, uint32_t p_u32TTL /*= 0*/) :
m_pNext(0),
m_IPAddress(p_IPAddress)
IPAddress p_IPAddress, uint32_t p_u32TTL /*= 0*/) : m_pNext(0), m_IPAddress(p_IPAddress)
{
m_TTL.set(p_u32TTL);
}
Expand Down Expand Up @@ -2172,9 +2162,8 @@ namespace MDNSImplementation
*/
MDNSResponder::stcMDNSSendParameter::stcDomainCacheItem::stcDomainCacheItem(
const void* p_pHostnameOrService, bool p_bAdditionalData, uint32_t p_u16Offset) :
m_pNext(0),
m_pHostnameOrService(p_pHostnameOrService), m_bAdditionalData(p_bAdditionalData),
m_u16Offset(p_u16Offset)
m_pNext(0), m_pHostnameOrService(p_pHostnameOrService),
m_bAdditionalData(p_bAdditionalData), m_u16Offset(p_u16Offset)
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ void setup() {
// start I2S at 8 kHz with 24-bits per sample
if (!I2S.begin(I2S_PHILIPS_MODE, 8000, 24)) {
Serial.println("Failed to initialize I2S!");
while (1)
; // do nothing
while (1); // do nothing
}
}

Expand Down
3 changes: 1 addition & 2 deletions libraries/I2S/examples/SimpleTone/SimpleTone.ino
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ void setup() {
// start I2S at the sample rate with 16-bits per sample
if (!I2S.begin(I2S_PHILIPS_MODE, sampleRate, 16)) {
Serial.println("Failed to initialize I2S!");
while (1)
; // do nothing
while (1); // do nothing
}
}

Expand Down
6 changes: 2 additions & 4 deletions libraries/TFT_Touch_Shield_V2/examples/tftbmp/tftbmp.ino
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ void setup() {

if (!SD.begin(PIN_SD_CS)) {
Serial.println("failed!");
while (1)
; // init fail, die here
while (1); // init fail, die here
}

Serial.println("SD OK!");
Expand All @@ -69,8 +68,7 @@ void loop() {
bmpFile = SD.open(__Gsbmp_files[i]);
if (!bmpFile) {
Serial.println("didn't find image");
while (1)
;
while (1);
}

if (!bmpReadHeader(bmpFile)) {
Expand Down
9 changes: 3 additions & 6 deletions libraries/TFT_Touch_Shield_V2/examples/tftbmp2/tftbmp2.ino
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ void setup() {

if (!SD.begin(PIN_SD_CS)) {
Serial.println("failed!");
while (1)
; // init fail, die here
while (1); // init fail, die here
}

Serial.println("SD OK!");
Expand Down Expand Up @@ -141,8 +140,7 @@ void loop() {

if (!bmpFile) {
Serial.println("didn't find image");
while (1)
;
while (1);
}

if (!bmpReadHeader(bmpFile)) {
Expand All @@ -153,8 +151,7 @@ void loop() {
bmpdraw(bmpFile, 0, 0, 1);
bmpFile.close();

while (1)
;
while (1);
}

/*********************************************/
Expand Down
3 changes: 1 addition & 2 deletions libraries/esp8266/examples/SerialStress/SerialStress.ino
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ void setup() {
// bind RX and TX
USC0(0) |= (1 << UCLBE);

while (Serial.read() == -1)
;
while (Serial.read() == -1);
if (Serial.hasOverrun()) { logger->print("overrun?\n"); }

timeout = (start_ms = last_ms = millis()) + TIMEOUT;
Expand Down
1 change: 1 addition & 0 deletions tests/clang-format-core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ BreakBeforeBraces: Allman
IndentWidth: 4
IndentCaseLabels: false
ReflowComments: false
SkipMacroDefinitionBody: true
3 changes: 1 addition & 2 deletions tests/device/libraries/BSTest/src/BSTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
4 changes: 2 additions & 2 deletions tests/host/common/queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down Expand Up @@ -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) \
Expand Down
7 changes: 2 additions & 5 deletions tests/restyle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading