diff --git a/.clang-format b/.clang-format index a835519e4..53755354b 100644 --- a/.clang-format +++ b/.clang-format @@ -1,3 +1,4 @@ +# 2024-07-30 Language: Cpp BasedOnStyle: LLVM AlignAfterOpenBracket: BlockIndent @@ -6,6 +7,7 @@ AlignConsecutiveAssignments: true AlignConsecutiveMacros: AcrossComments AlignTrailingComments: true AllowAllArgumentsOnNextLine: false +AllowAllParametersOfDeclarationOnNextLine: false AllowShortBlocksOnASingleLine: Empty AllowShortFunctionsOnASingleLine: Empty AlwaysBreakTemplateDeclarations: Yes @@ -21,6 +23,7 @@ IndentCaseLabels: true IndentWidth: 4 LambdaBodyIndentation: Signature MaxEmptyLinesToKeep: 1 +PenaltyReturnTypeOnItsOwnLine: 1000 # PointerAlignment: Left # TODO enable this and reformat project QualifierAlignment: Left ReflowComments: true diff --git a/cores/beken-72xx/arduino/libraries/WiFi/WiFiSTA.cpp b/cores/beken-72xx/arduino/libraries/WiFi/WiFiSTA.cpp index ee24e1707..93a025f48 100644 --- a/cores/beken-72xx/arduino/libraries/WiFi/WiFiSTA.cpp +++ b/cores/beken-72xx/arduino/libraries/WiFi/WiFiSTA.cpp @@ -2,8 +2,13 @@ #include "WiFiPrivate.h" -WiFiStatus -WiFiClass::begin(const char *ssid, const char *passphrase, int32_t channel, const uint8_t *bssid, bool connect) { +WiFiStatus WiFiClass::begin( + const char *ssid, + const char *passphrase, + int32_t channel, + const uint8_t *bssid, + bool connect +) { if (!enableSTA(true)) return WL_CONNECT_FAILED; if (!validate(ssid, passphrase)) diff --git a/cores/beken-72xx/base/wraps/BkDriverFlash.c b/cores/beken-72xx/base/wraps/BkDriverFlash.c index 8b7bf4ac4..a5361dd3c 100644 --- a/cores/beken-72xx/base/wraps/BkDriverFlash.c +++ b/cores/beken-72xx/base/wraps/BkDriverFlash.c @@ -70,8 +70,12 @@ OSStatus __wrap_bk_flash_erase(bk_partition_t partition, uint32_t off_set, uint3 return kNoErr; } -OSStatus -__wrap_bk_flash_write(bk_partition_t partition, volatile uint32_t off_set, uint8_t *inBuffer, uint32_t inBufferLength) { +OSStatus __wrap_bk_flash_write( + bk_partition_t partition, + volatile uint32_t off_set, + uint8_t *inBuffer, + uint32_t inBufferLength +) { UINT32 status; DD_HANDLE flash_hdl; uint32_t start_addr; @@ -98,8 +102,12 @@ __wrap_bk_flash_write(bk_partition_t partition, volatile uint32_t off_set, uint8 return kNoErr; } -OSStatus -__wrap_bk_flash_read(bk_partition_t partition, volatile uint32_t off_set, uint8_t *outBuffer, uint32_t inBufferLength) { +OSStatus __wrap_bk_flash_read( + bk_partition_t partition, + volatile uint32_t off_set, + uint8_t *outBuffer, + uint32_t inBufferLength +) { UINT32 status; uint32_t start_addr; DD_HANDLE flash_hdl; diff --git a/cores/common/arduino/libraries/api/WiFi/WiFi.h b/cores/common/arduino/libraries/api/WiFi/WiFi.h index f77797324..ed9500e42 100644 --- a/cores/common/arduino/libraries/api/WiFi/WiFi.h +++ b/cores/common/arduino/libraries/api/WiFi/WiFi.h @@ -97,8 +97,13 @@ class WiFiClass { const uint8_t *bssid = NULL, bool connect = true ); - WiFiStatus - begin(char *ssid, char *passphrase = NULL, int32_t channel = 0, const uint8_t *bssid = NULL, bool connect = true); + WiFiStatus begin( + char *ssid, + char *passphrase = NULL, + int32_t channel = 0, + const uint8_t *bssid = NULL, + bool connect = true + ); bool config( IPAddress localIP, @@ -178,7 +183,11 @@ class WiFiClass { public: /* WiFiAP.cpp */ bool softAP( - const char *ssid, const char *passphrase = NULL, int channel = 1, bool ssidHidden = false, int maxClients = 4 + const char *ssid, + const char *passphrase = NULL, + int channel = 1, + bool ssidHidden = false, + int maxClients = 4 ); bool softAPConfig(IPAddress localIP, IPAddress gateway, IPAddress subnet); bool softAPdisconnect(bool wifiOff = false); diff --git a/cores/common/arduino/libraries/api/WiFi/WiFiScan.cpp b/cores/common/arduino/libraries/api/WiFi/WiFiScan.cpp index 20bb83c7c..036a894fb 100644 --- a/cores/common/arduino/libraries/api/WiFi/WiFiScan.cpp +++ b/cores/common/arduino/libraries/api/WiFi/WiFiScan.cpp @@ -3,7 +3,12 @@ #include "WiFi.h" bool WiFiClass::getNetworkInfo( - uint8_t networkItem, String &ssid, WiFiAuthMode &encType, int32_t &rssi, uint8_t *&bssid, int32_t &channel + uint8_t networkItem, + String &ssid, + WiFiAuthMode &encType, + int32_t &rssi, + uint8_t *&bssid, + int32_t &channel ) { ssid = SSID(networkItem); encType = encryptionType(networkItem); diff --git a/cores/common/arduino/libraries/common/WiFiClient/MbedTLSClient.cpp b/cores/common/arduino/libraries/common/WiFiClient/MbedTLSClient.cpp index 65a8c1d30..aa162cf01 100644 --- a/cores/common/arduino/libraries/common/WiFiClient/MbedTLSClient.cpp +++ b/cores/common/arduino/libraries/common/WiFiClient/MbedTLSClient.cpp @@ -86,13 +86,21 @@ int MbedTLSClient::connect(const char *host, uint16_t port, int32_t timeout) { } int MbedTLSClient::connect( - IPAddress ip, uint16_t port, const char *rootCABuf, const char *clientCert, const char *clientKey + IPAddress ip, + uint16_t port, + const char *rootCABuf, + const char *clientCert, + const char *clientKey ) { return connect(ipToString(ip).c_str(), port, 0, rootCABuf, clientCert, clientKey, NULL, NULL) == 0; } int MbedTLSClient::connect( - const char *host, uint16_t port, const char *rootCABuf, const char *clientCert, const char *clientKey + const char *host, + uint16_t port, + const char *rootCABuf, + const char *clientCert, + const char *clientKey ) { return connect(host, port, 0, rootCABuf, clientCert, clientKey, NULL, NULL) == 0; } diff --git a/cores/common/arduino/libraries/common/WiFiClient/WiFiClientSecure.h b/cores/common/arduino/libraries/common/WiFiClient/WiFiClientSecure.h index 296a41614..cce42672f 100644 --- a/cores/common/arduino/libraries/common/WiFiClient/WiFiClientSecure.h +++ b/cores/common/arduino/libraries/common/WiFiClient/WiFiClientSecure.h @@ -26,12 +26,22 @@ class IWiFiClientSecure { public: - virtual int - connect(IPAddress ip, uint16_t port, const char *rootCABuf, const char *clientCert, const char *clientKey) = 0; - virtual int - connect(const char *host, uint16_t port, const char *rootCABuf, const char *clientCert, const char *clientKey) = 0; - virtual int connect(IPAddress ip, uint16_t port, const char *pskIdent, const char *psk) = 0; - virtual int connect(const char *host, uint16_t port, const char *pskIdent, const char *psk) = 0; + virtual int connect( + IPAddress ip, + uint16_t port, + const char *rootCABuf, + const char *clientCert, + const char *clientKey + ) = 0; + virtual int connect( + const char *host, + uint16_t port, + const char *rootCABuf, + const char *clientCert, + const char *clientKey + ) = 0; + virtual int connect(IPAddress ip, uint16_t port, const char *pskIdent, const char *psk) = 0; + virtual int connect(const char *host, uint16_t port, const char *pskIdent, const char *psk) = 0; virtual int lastError(char *buf, const size_t size) = 0; virtual void setInsecure() = 0; // Don't validate the chain, just accept whatever is given. VERY INSECURE! diff --git a/cores/common/arduino/libraries/common/mDNS/LwIPmDNS.cpp b/cores/common/arduino/libraries/common/mDNS/LwIPmDNS.cpp index 21e25e8a5..688b5f2ec 100644 --- a/cores/common/arduino/libraries/common/mDNS/LwIPmDNS.cpp +++ b/cores/common/arduino/libraries/common/mDNS/LwIPmDNS.cpp @@ -166,8 +166,11 @@ static bool enableMDNS(struct netif *netif) { } #ifdef LWIP_NETIF_EXT_STATUS_CALLBACK -static void -mdns_netif_ext_status_callback(struct netif *netif, netif_nsc_reason_t reason, const netif_ext_callback_args_t *args) { +static void mdns_netif_ext_status_callback( + struct netif *netif, + netif_nsc_reason_t reason, + const netif_ext_callback_args_t *args +) { if (reason & LWIP_NSC_NETIF_REMOVED) { LT_DM(MDNS, "Netif removed, stopping mDNS on netif %u", netif->num); mdns_resp_remove_netif(netif); diff --git a/cores/common/arduino/libraries/ext/HTTPClient/HTTPClient.cpp b/cores/common/arduino/libraries/ext/HTTPClient/HTTPClient.cpp index c99ea3c24..6cacdfa23 100644 --- a/cores/common/arduino/libraries/ext/HTTPClient/HTTPClient.cpp +++ b/cores/common/arduino/libraries/ext/HTTPClient/HTTPClient.cpp @@ -321,7 +321,12 @@ bool HTTPClient::begin(String host, uint16_t port, String uri, const char *CAcer } bool HTTPClient::begin( - String host, uint16_t port, String uri, const char *CAcert, const char *cli_cert, const char *cli_key + String host, + uint16_t port, + String uri, + const char *CAcert, + const char *cli_cert, + const char *cli_key ) { if (_client && !_tcpDeprecated) { log_d("mix up of new and deprecated api"); diff --git a/cores/common/arduino/libraries/ext/WebServer/WebServer.h b/cores/common/arduino/libraries/ext/WebServer/WebServer.h index f89502a23..2d25bca2d 100644 --- a/cores/common/arduino/libraries/ext/WebServer/WebServer.h +++ b/cores/common/arduino/libraries/ext/WebServer/WebServer.h @@ -81,7 +81,9 @@ class WebServer { bool authenticate(const char *username, const char *password); void requestAuthentication( - HTTPAuthMethod mode = BASIC_AUTH, const char *realm = NULL, const String &authFailMsg = String("") + HTTPAuthMethod mode = BASIC_AUTH, + const char *realm = NULL, + const String &authFailMsg = String("") ); typedef std::function THandlerFunction; diff --git a/cores/common/arduino/libraries/ext/WebServer/detail/RequestHandlersImpl.h b/cores/common/arduino/libraries/ext/WebServer/detail/RequestHandlersImpl.h index 8d0cd9ddc..f338fdc89 100644 --- a/cores/common/arduino/libraries/ext/WebServer/detail/RequestHandlersImpl.h +++ b/cores/common/arduino/libraries/ext/WebServer/detail/RequestHandlersImpl.h @@ -10,7 +10,10 @@ using namespace mime; class FunctionRequestHandler : public RequestHandler { public: FunctionRequestHandler( - WebServer::THandlerFunction fn, WebServer::THandlerFunction ufn, const Uri &uri, HTTPMethod method + WebServer::THandlerFunction fn, + WebServer::THandlerFunction ufn, + const Uri &uri, + HTTPMethod method ) : _fn(fn), _ufn(ufn), _uri(uri.clone()), _method(method) { _uri->initPathArgs(pathArgs); diff --git a/cores/realtek-amb/arduino/libraries/WiFi/WiFiSTA.cpp b/cores/realtek-amb/arduino/libraries/WiFi/WiFiSTA.cpp index f5164cec7..3eab4b258 100644 --- a/cores/realtek-amb/arduino/libraries/WiFi/WiFiSTA.cpp +++ b/cores/realtek-amb/arduino/libraries/WiFi/WiFiSTA.cpp @@ -2,8 +2,13 @@ #include "WiFiPrivate.h" -WiFiStatus -WiFiClass::begin(const char *ssid, const char *passphrase, int32_t channel, const uint8_t *bssid, bool connect) { +WiFiStatus WiFiClass::begin( + const char *ssid, + const char *passphrase, + int32_t channel, + const uint8_t *bssid, + bool connect +) { if (!enableSTA(true)) return WL_CONNECT_FAILED; if (!validate(ssid, passphrase))