[style] apply clang-format-6.0 changes (#3222)

This commit is contained in:
Jonathan Hui
2018-10-29 12:38:06 -07:00
parent 5e4be05907
commit 7c5b15c877
32 changed files with 144 additions and 90 deletions
+1 -1
View File
@@ -151,7 +151,7 @@ void IntDefaultHandler(void)
;
}
// clang-format off
// clang-format off
#define FLASH_CCA_BOOTLDR_CFG_DISABLE 0xEFFFFFFF ///< Disable backdoor function
#define FLASH_CCA_BOOTLDR_CFG_ENABLE 0xF0FFFFFF ///< Enable backdoor function
+4 -2
View File
@@ -70,7 +70,8 @@
ZLL_RX_FRAME_FILTER_BEACON_FT_MASK)
// clang-format on
typedef enum xcvr_state_tag {
typedef enum xcvr_state_tag
{
XCVR_Idle_c,
XCVR_RX_c,
XCVR_TX_c,
@@ -79,7 +80,8 @@ typedef enum xcvr_state_tag {
XCVR_CCCA_c,
} xcvr_state_t;
typedef enum xcvr_cca_type_tag {
typedef enum xcvr_cca_type_tag
{
XCVR_ED_c, /* energy detect - CCA bit not active, not to be used for T and CCCA sequences */
XCVR_CCA_MODE1_c, /* energy detect - CCA bit ACTIVE */
SCVR_CCA_MODE2_c, /* 802.15.4 compliant signal detect - CCA bit ACTIVE */
+8 -1
View File
@@ -76,7 +76,14 @@
#define XTAL_ACCURACY 40 // The crystal used on nRF52840PDK has ±20ppm accuracy.
// clang-format on
typedef enum { kMsTimer, kUsTimer, k802154Timer, k802154Sync, kNumTimers } AlarmIndex;
typedef enum
{
kMsTimer,
kUsTimer,
k802154Timer,
k802154Sync,
kNumTimers
} AlarmIndex;
typedef struct
{
+6 -1
View File
@@ -49,7 +49,12 @@
#include <drivers/radio/nrf_802154.h>
#include <utils/code_utils.h>
typedef enum { kDiagTransmitModeIdle, kDiagTransmitModePackets, kDiagTransmitModeCarrier } DiagTrasmitMode;
typedef enum
{
kDiagTransmitModeIdle,
kDiagTransmitModePackets,
kDiagTransmitModeCarrier
} DiagTrasmitMode;
struct PlatformDiagCommand
{
+2 -1
View File
@@ -93,7 +93,8 @@ static uint32_t sEnergyDetectionTime;
static uint8_t sEnergyDetectionChannel;
static int8_t sEnergyDetected;
typedef enum {
typedef enum
{
kPendingEventSleep, // Requested to enter Sleep state.
kPendingEventFrameTransmitted, // Transmitted frame and received ACK (if requested).
kPendingEventChannelAccessFailure, // Failed to transmit frame (channel busy).
+1 -1
View File
@@ -48,7 +48,7 @@ static otPlatMcuPowerState gPlatMcuPowerState = OT_PLAT_MCU_POWER_STATE_ON;
void otPlatReset(otInstance *aInstance)
{
#if _WIN32
// This function does nothing on the Windows platform.
// This function does nothing on the Windows platform.
#elif OPENTHREAD_PLATFORM_USE_PSEUDO_RESET // if _WIN32
gPlatformPseudoResetWasRequested = true;
+2 -1
View File
@@ -55,7 +55,8 @@ extern "C" {
* This enumeration defines the Border Agent state.
*
*/
typedef enum otBorderAgentState {
typedef enum otBorderAgentState
{
OT_BORDER_AGENT_STATE_STOPPED = 0, ///< Border agent role is disabled.
OT_BORDER_AGENT_STATE_STARTED = 1, ///< Border agent is started.
OT_BORDER_AGENT_STATE_ACTIVE = 2, ///< Border agent is connected with external commissioner.
+8 -4
View File
@@ -65,7 +65,8 @@ extern "C" {
* CoAP Type values.
*
*/
typedef enum otCoapType {
typedef enum otCoapType
{
OT_COAP_TYPE_CONFIRMABLE = 0x00, ///< Confirmable
OT_COAP_TYPE_NON_CONFIRMABLE = 0x10, ///< Non-confirmable
OT_COAP_TYPE_ACKNOWLEDGMENT = 0x20, ///< Acknowledgment
@@ -82,7 +83,8 @@ typedef enum otCoapType {
* CoAP Code values.
*
*/
typedef enum otCoapCode {
typedef enum otCoapCode
{
OT_COAP_CODE_EMPTY = OT_COAP_CODE(0, 0), ///< Empty message code
OT_COAP_CODE_GET = OT_COAP_CODE(0, 1), ///< Get
OT_COAP_CODE_POST = OT_COAP_CODE(0, 2), ///< Post
@@ -118,7 +120,8 @@ typedef enum otCoapCode {
/**
* CoAP Option Numbers
*/
typedef enum otCoapOptionType {
typedef enum otCoapOptionType
{
OT_COAP_OPTION_IF_MATCH = 1, ///< If-Match
OT_COAP_OPTION_URI_HOST = 3, ///< Uri-Host
OT_COAP_OPTION_E_TAG = 4, ///< ETag
@@ -153,7 +156,8 @@ typedef struct otCoapOption
* https://tools.ietf.org/html/rfc7252#page-92
*
*/
typedef enum otCoapOptionContentFormat {
typedef enum otCoapOptionContentFormat
{
OT_COAP_OPTION_CONTENT_FORMAT_TEXT_PLAIN = 0, ///< text/plain
OT_COAP_OPTION_CONTENT_FORMAT_LINK_FORMAT = 40, ///< application/link-format
OT_COAP_OPTION_CONTENT_FORMAT_XML = 41, ///< application/xml
+2 -1
View File
@@ -58,7 +58,8 @@ extern "C" {
* This enumeration defines the Commissioner State.
*
*/
typedef enum otCommissionerState {
typedef enum otCommissionerState
{
OT_COMMISSIONER_STATE_DISABLED = 0, ///< Commissioner role is disabled.
OT_COMMISSIONER_STATE_PETITION = 1, ///< Currently petitioning to become a Commissioner.
OT_COMMISSIONER_STATE_ACTIVE = 2, ///< Commissioner role is active.
+2 -1
View File
@@ -222,7 +222,8 @@ typedef struct otOperationalDataset
* This enumeration represents meshcop TLV types.
*
*/
typedef enum otMeshcopTlvType {
typedef enum otMeshcopTlvType
{
OT_MESHCOP_TLV_CHANNEL = 0, ///< meshcop Channel TLV
OT_MESHCOP_TLV_PANID = 1, ///< meshcop Pan Id TLV
OT_MESHCOP_TLV_EXTPANID = 2, ///< meshcop Extended Pan Id TLV
+2 -1
View File
@@ -173,7 +173,8 @@ extern "C" {
* This enumeration represents error codes used throughout OpenThread.
*
*/
typedef enum otError {
typedef enum otError
{
/**
* No error.
*/
+6 -3
View File
@@ -56,7 +56,8 @@ extern "C" {
* ICMPv6 Message Types
*
*/
typedef enum otIcmp6Type {
typedef enum otIcmp6Type
{
OT_ICMP6_TYPE_DST_UNREACH = 1, ///< Destination Unreachable
OT_ICMP6_TYPE_ECHO_REQUEST = 128, ///< Echo Request
OT_ICMP6_TYPE_ECHO_REPLY = 129, ///< Echo Reply
@@ -66,7 +67,8 @@ typedef enum otIcmp6Type {
* ICMPv6 Message Codes
*
*/
typedef enum otIcmp6Code {
typedef enum otIcmp6Code
{
OT_ICMP6_CODE_DST_UNREACH_NO_ROUTE = 0, ///< Destination Unreachable No Route
} otIcmp6Code;
@@ -127,7 +129,8 @@ typedef struct otIcmp6Handler
* ICMPv6 Echo Reply Modes
*
*/
typedef enum otIcmp6EchoMode {
typedef enum otIcmp6EchoMode
{
OT_ICMP6_ECHO_HANDLER_DISABLED = 0, ///< ICMPv6 Echo processing disabled
OT_ICMP6_ECHO_HANDLER_UNICAST_ONLY = 1, ///< ICMPv6 Echo processing enabled only for unicast requests only
OT_ICMP6_ECHO_HANDLER_MULTICAST_ONLY = 2, ///< ICMPv6 Echo processing enabled only for multicast requests only
+2 -1
View File
@@ -126,7 +126,8 @@ typedef struct otNetifMulticastAddress
* This enumeration represents the list of allowable values for an InterfaceId.
*
*/
typedef enum otNetifInterfaceId {
typedef enum otNetifInterfaceId
{
OT_NETIF_INTERFACE_ID_HOST = -1, ///< The interface ID telling packets received by host side interfaces.
OT_NETIF_INTERFACE_ID_THREAD = 1, ///< The Thread Network interface ID.
} otNetifInterfaceId;
+2 -1
View File
@@ -56,7 +56,8 @@ extern "C" {
* This enumeration defines the Joiner State.
*
*/
typedef enum otJoinerState {
typedef enum otJoinerState
{
OT_JOINER_STATE_IDLE = 0,
OT_JOINER_STATE_DISCOVER = 1,
OT_JOINER_STATE_CONNECT = 2,
+2 -1
View File
@@ -84,7 +84,8 @@ typedef uint8_t otMacFilterIterator; ///< Used to iterate through mac filter ent
* Defines address mode of the mac filter.
*
*/
typedef enum otMacFilterAddressMode {
typedef enum otMacFilterAddressMode
{
OT_MAC_FILTER_ADDRESS_MODE_DISABLED, ///< Address filter is disabled.
OT_MAC_FILTER_ADDRESS_MODE_WHITELIST, ///< Whitelist address filter mode is enabled.
OT_MAC_FILTER_ADDRESS_MODE_BLACKLIST, ///< Blacklist address filter mode is enabled.
+2 -1
View File
@@ -150,7 +150,8 @@ typedef struct otExternalRouteConfig
* Defines valid values for member mPreference in otExternalRouteConfig and otBorderRouterConfig.
*
*/
typedef enum otRoutePreference {
typedef enum otRoutePreference
{
OT_ROUTE_PREFERENCE_LOW = -1, ///< Low route preference.
OT_ROUTE_PREFERENCE_MED = 0, ///< Medium route preference.
OT_ROUTE_PREFERENCE_HIGH = 1, ///< High route preference.
+2 -1
View File
@@ -56,7 +56,8 @@ extern "C" {
* This enum represents OpenThread time synchronization status.
*
*/
typedef enum otNetworkTimeStatus {
typedef enum otNetworkTimeStatus
{
OT_NETWORK_TIME_UNSYNCHRONIZED = -1, ///< The device hasn't attached to a network.
OT_NETWORK_TIME_RESYNC_NEEDED = 0, ///< The device hasnt received time sync for more than two periods time.
OT_NETWORK_TIME_SYNCHRONIZED = 1, ///< The device network time is synchronized.
+8 -4
View File
@@ -203,7 +203,8 @@ enum
* This enum represents BLE Device Address types.
*
*/
typedef enum otPlatBleAddressType {
typedef enum otPlatBleAddressType
{
OT_BLE_ADDRESS_TYPE_PUBLIC = 0, ///< Bluetooth public device address.
OT_BLE_ADDRESS_TYPE_RANDOM_STATIC = 1, ///< Bluetooth random static address.
OT_BLE_ADDRESS_TYPE_RANDOM_PRIVATE_RESOLVABLE = 2, ///< Bluetooth random private resolvable address.
@@ -216,7 +217,8 @@ typedef enum otPlatBleAddressType {
*
* See v4.2 [Vol 3, Part G] 3.3.1.1 Characteristic Properties - Table 3.5
*/
typedef enum otPlatBleCccdFlags {
typedef enum otPlatBleCccdFlags
{
/**
* If set, permits broadcasts of the Characteristic Value using Characteristic Configuration Descriptor.
*/
@@ -273,7 +275,8 @@ typedef struct otPlatBleDeviceAddr
* This enumeration defines flags for BLE advertisement mode.
*
*/
typedef enum otPlatBleAdvMode {
typedef enum otPlatBleAdvMode
{
/**
* If set, advertising device will allow connections to be initiated.
*/
@@ -321,7 +324,8 @@ typedef struct otPlatBleGapConnParams
* This enumeration represents BLE UUID value.
*
*/
typedef enum otPlatBleUuidType {
typedef enum otPlatBleUuidType
{
OT_BLE_UUID_TYPE_16 = 0, ///< UUID represented by 16-bit value.
OT_BLE_UUID_TYPE_32 = 1, ///< UUID represented by 32-bit value.
OT_BLE_UUID_TYPE_128 = 2, ///< UUID represented by 128-bit value.
+2 -1
View File
@@ -116,7 +116,8 @@ typedef uint8_t otLogLevel;
* This enumeration represents log regions.
*
*/
typedef enum otLogRegion {
typedef enum otLogRegion
{
OT_LOG_REGION_API = 1, ///< OpenThread API
OT_LOG_REGION_MLE = 2, ///< MLE
OT_LOG_REGION_ARP = 3, ///< EID-to-RLOC mapping.
+4 -2
View File
@@ -67,7 +67,8 @@ void otPlatReset(otInstance *aInstance);
* These are in the same order as the Spinel reset reason codes.
*
*/
typedef enum {
typedef enum
{
OT_PLAT_RESET_REASON_POWER_ON = 0,
OT_PLAT_RESET_REASON_EXTERNAL = 1,
OT_PLAT_RESET_REASON_SOFTWARE = 2,
@@ -120,7 +121,8 @@ void otPlatWakeHost(void);
* After a reset, the MCU power state MUST be `OT_PLAT_POWER_STATE_ON`.
*
*/
typedef enum {
typedef enum
{
/**
* NCP's MCU stays on and active all the time.
*
+2 -1
View File
@@ -204,7 +204,8 @@ typedef struct otRadioFrame
* This structure represents the state of a radio.
* Initially, a radio is in the Disabled state.
*/
typedef enum otRadioState {
typedef enum otRadioState
{
OT_RADIO_STATE_DISABLED = 0,
OT_RADIO_STATE_SLEEP = 1,
OT_RADIO_STATE_RECEIVE = 2,
+2 -1
View File
@@ -59,7 +59,8 @@ extern "C" {
* Represents a Thread device role.
*
*/
typedef enum {
typedef enum
{
OT_DEVICE_ROLE_DISABLED = 0, ///< The Thread stack is disabled.
OT_DEVICE_ROLE_DETACHED = 1, ///< Not currently participating in a Thread network/partition.
OT_DEVICE_ROLE_CHILD = 2, ///< The Thread Child role.
+2 -1
View File
@@ -546,7 +546,8 @@ OTAPI otError OTCALL otThreadSetParentPriority(otInstance *aInstance, int8_t aPa
* removed.
*
*/
typedef enum otThreadChildTableEvent {
typedef enum otThreadChildTableEvent
{
OT_THREAD_CHILD_TABLE_EVENT_CHILD_ADDED, ///< A child is being added.
OT_THREAD_CHILD_TABLE_EVENT_CHILD_REMOVED, ///< A child is being removed.
} otThreadChildTableEvent;
+1 -1
View File
@@ -41,7 +41,7 @@ elif which clang-format > /dev/null; then
"$CLANG_FORMAT_VERSION"*)
;;
*)
die "clang-format 6.0 required"
die "$(clang-format --version); clang-format 6.0 required"
;;
esac
else
+22 -22
View File
@@ -176,29 +176,29 @@ otError Uart::ProcessCommand(void)
}
#if OPENTHREAD_CONFIG_LOG_OUTPUT != OPENTHREAD_CONFIG_LOG_OUTPUT_NONE
/*
* Note this is here for this reason:
*
* TEXT (command) input ... in a test automation script occurs
* rapidly and often without gaps between the command and the
* terminal CR
*
* In contrast as a human is typing there is a delay between the
* last character of a command and the terminal CR which executes
* a command.
*
* During that human induced delay a tasklet may be scheduled and
* the LOG becomes confusing and it is hard to determine when
* something happened. Which happened first? the command-CR or
* the tasklet.
*
* Yes, while rare it is a race condition that is hard to debug.
*
* Thus this is here to affirmatively LOG exactly when the CLI
* command is being executed.
*/
/*
* Note this is here for this reason:
*
* TEXT (command) input ... in a test automation script occurs
* rapidly and often without gaps between the command and the
* terminal CR
*
* In contrast as a human is typing there is a delay between the
* last character of a command and the terminal CR which executes
* a command.
*
* During that human induced delay a tasklet may be scheduled and
* the LOG becomes confusing and it is hard to determine when
* something happened. Which happened first? the command-CR or
* the tasklet.
*
* Yes, while rare it is a race condition that is hard to debug.
*
* Thus this is here to affirmatively LOG exactly when the CLI
* command is being executed.
*/
#if OPENTHREAD_ENABLE_MULTIPLE_INSTANCES
/* TODO: how exactly do we get the instance here? */
/* TODO: how exactly do we get the instance here? */
#else
otLogInfoCli("execute command: %s", mRxBuffer);
#endif
+15 -15
View File
@@ -119,21 +119,21 @@ otError otInstanceErasePersistentInfo(otInstance *aInstance)
const char *otGetVersionString(void)
{
/**
* PLATFORM_VERSION_ATTR_PREFIX and PLATFORM_VERSION_ATTR_SUFFIX are
* intended to be used to specify compiler directives to indicate
* what linker section the platform version string should be stored.
*
* This is useful for specifying an exact location of where the version
* string will be located so that it can be easily retrieved from the
* raw firmware image.
*
* If PLATFORM_VERSION_ATTR_PREFIX is unspecified, the keyword `static`
* is used instead.
*
* If both are unspecified, the location of the string in the firmware
* image will be undefined and may change.
*/
/**
* PLATFORM_VERSION_ATTR_PREFIX and PLATFORM_VERSION_ATTR_SUFFIX are
* intended to be used to specify compiler directives to indicate
* what linker section the platform version string should be stored.
*
* This is useful for specifying an exact location of where the version
* string will be located so that it can be easily retrieved from the
* raw firmware image.
*
* If PLATFORM_VERSION_ATTR_PREFIX is unspecified, the keyword `static`
* is used instead.
*
* If both are unspecified, the location of the string in the firmware
* image will be undefined and may change.
*/
#ifdef PLATFORM_VERSION_ATTR_PREFIX
PLATFORM_VERSION_ATTR_PREFIX
+1 -1
View File
@@ -49,9 +49,9 @@
#include "meshcop/timestamp.hpp"
#include "net/ip6_address.hpp"
using ot::Encoding::Reverse32;
using ot::Encoding::BigEndian::HostSwap16;
using ot::Encoding::BigEndian::HostSwap32;
using ot::Encoding::Reverse32;
namespace ot {
namespace MeshCoP {
+8 -4
View File
@@ -72,7 +72,8 @@ enum
* DHCPv6 Message Types
*
*/
typedef enum Type {
typedef enum Type
{
kTypeSolicit = 1,
kTypeAdvertise = 2,
kTypeRequest = 3,
@@ -149,7 +150,8 @@ private:
* DHCPv6 Option Codes
*
*/
typedef enum Code {
typedef enum Code
{
kOptionClientIdentifier = 1,
kOptionServerIdentifier = 2,
kOptionIaNa = 3,
@@ -233,7 +235,8 @@ private:
* Duid Type
*
*/
typedef enum DuidType {
typedef enum DuidType
{
kDuidLLT = 1,
kDuidEN = 2,
kDuidLL = 3,
@@ -555,7 +558,8 @@ private:
* Status Code
*
*/
typedef enum Status {
typedef enum Status
{
kStatusSuccess = 0,
kStatusUnspecFail = 1,
kStatusNoAddrsAvail = 2,
+2 -1
View File
@@ -83,7 +83,8 @@ public:
* Status of IdentityAssociation
*
*/
typedef enum Status {
typedef enum Status
{
kStatusInvalid,
kStatusSolicit,
kStatusSoliciting,
+3 -3
View File
@@ -1322,9 +1322,9 @@ exit:
#endif // OPENTHREAD_CONFIG_NCP_ENABLE_PEEK_POKE
// ----------------------------------------------------------------------------
// MARK: Individual Property Getters and Setters
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// MARK: Individual Property Getters and Setters
// ----------------------------------------------------------------------------
#if OPENTHREAD_ENABLE_DIAG
+2 -2
View File
@@ -2494,9 +2494,9 @@ const char *spinel_capability_to_cstr(unsigned int capability)
return ret;
}
// **** LCOV_EXCL_STOP ****
// **** LCOV_EXCL_STOP ****
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
#if SPINEL_SELF_TEST
+16 -8
View File
@@ -99,7 +99,8 @@
extern "C" {
#endif
typedef enum {
typedef enum
{
SPINEL_STATUS_OK = 0, ///< Operation has completed successfully.
SPINEL_STATUS_FAILURE = 1, ///< Operation has failed for some undefined reason.
@@ -196,28 +197,32 @@ typedef enum {
SPINEL_STATUS_EXPERIMENTAL__END = 2097152,
} spinel_status_t;
typedef enum {
typedef enum
{
SPINEL_NET_ROLE_DETACHED = 0,
SPINEL_NET_ROLE_CHILD = 1,
SPINEL_NET_ROLE_ROUTER = 2,
SPINEL_NET_ROLE_LEADER = 3,
} spinel_net_role_t;
typedef enum {
typedef enum
{
SPINEL_IPV6_ICMP_PING_OFFLOAD_DISABLED = 0,
SPINEL_IPV6_ICMP_PING_OFFLOAD_UNICAST_ONLY = 1,
SPINEL_IPV6_ICMP_PING_OFFLOAD_MULTICAST_ONLY = 2,
SPINEL_IPV6_ICMP_PING_OFFLOAD_ALL = 3,
} spinel_ipv6_icmp_ping_offload_mode_t;
typedef enum {
typedef enum
{
SPINEL_SCAN_STATE_IDLE = 0,
SPINEL_SCAN_STATE_BEACON = 1,
SPINEL_SCAN_STATE_ENERGY = 2,
SPINEL_SCAN_STATE_DISCOVER = 3,
} spinel_scan_state_t;
typedef enum {
typedef enum
{
SPINEL_MCU_POWER_STATE_ON = 0,
SPINEL_MCU_POWER_STATE_LOW_POWER = 1,
SPINEL_MCU_POWER_STATE_OFF = 2,
@@ -226,7 +231,8 @@ typedef enum {
// The `spinel_power_state_t` enumeration and `POWER_STATE`
// property are deprecated. Please use `MCU_POWER_STATE`
// instead.
typedef enum {
typedef enum
{
SPINEL_POWER_STATE_OFFLINE = 0,
SPINEL_POWER_STATE_DEEP_SLEEP = 1,
SPINEL_POWER_STATE_STANDBY = 2,
@@ -234,7 +240,8 @@ typedef enum {
SPINEL_POWER_STATE_ONLINE = 4,
} spinel_power_state_t;
typedef enum {
typedef enum
{
SPINEL_HOST_POWER_STATE_OFFLINE = 0,
SPINEL_HOST_POWER_STATE_DEEP_SLEEP = 1,
SPINEL_HOST_POWER_STATE_RESERVED = 2,
@@ -518,7 +525,8 @@ enum
* Experimental | 2,000,000 - 2,097,151 | Experimental use only
*
*/
typedef enum {
typedef enum
{
SPINEL_PROP_LAST_STATUS = 0, ///< status [i]
SPINEL_PROP_PROTOCOL_VERSION = 1, ///< major, minor [i,i]
SPINEL_PROP_NCP_VERSION = 2, ///< version string [U]