all: Remove spaces inside and around parenthesis.

Using new options enabled in the uncrustify configuration.
pull/5804/head
Damien George 2020-03-27 00:35:04 +11:00
rodzic b56caaf104
commit 1a3e386c67
24 zmienionych plików z 49 dodań i 49 usunięć

Wyświetl plik

@ -630,7 +630,7 @@ STATIC mp_uint_t lwip_raw_udp_receive(lwip_socket_obj_t *socket, byte *buf, mp_u
MICROPY_PY_LWIP_EXIT
return (mp_uint_t) result;
return (mp_uint_t)result;
}
// For use in stream virtual methods
@ -1240,7 +1240,7 @@ STATIC mp_obj_t lwip_socket_recvfrom(mp_obj_t self_in, mp_obj_t len_in) {
switch (socket->type) {
case MOD_NETWORK_SOCK_STREAM: {
memcpy(ip, &socket->peer, sizeof(socket->peer));
port = (mp_uint_t) socket->peer_port;
port = (mp_uint_t)socket->peer_port;
ret = lwip_tcp_receive(socket, (byte *)vstr.buf, len, &_errno);
break;
}

Wyświetl plik

@ -46,7 +46,7 @@ STATIC uint32_t yasmarang(void) {
yasmarang_pad = (yasmarang_pad << 3) + (yasmarang_pad >> 29);
yasmarang_n = yasmarang_pad | 2;
yasmarang_d ^= (yasmarang_pad << 31) + (yasmarang_pad >> 1);
yasmarang_dat ^= (char) yasmarang_pad ^ (yasmarang_d >> 8) ^ 1;
yasmarang_dat ^= (char)yasmarang_pad ^ (yasmarang_d >> 8) ^ 1;
return yasmarang_pad ^ (yasmarang_d << 5) ^ (yasmarang_pad >> 18) ^ (yasmarang_dat << 1);
} /* yasmarang */

Wyświetl plik

@ -93,11 +93,11 @@
#ifdef __LP64__
typedef long mp_int_t; // must be pointer size
typedef unsigned long mp_uint_t; // must be pointer size
#elif defined ( __MINGW32__ ) && defined( _WIN64 )
#elif defined(__MINGW32__) && defined(_WIN64)
#include <stdint.h>
typedef __int64 mp_int_t;
typedef unsigned __int64 mp_uint_t;
#elif defined ( _MSC_VER ) && defined( _WIN64 )
#elif defined(_MSC_VER) && defined(_WIN64)
typedef __int64 mp_int_t;
typedef unsigned __int64 mp_uint_t;
#else
@ -119,7 +119,7 @@ typedef long mp_off_t;
// We need to provide a declaration/definition of alloca()
#ifdef __FreeBSD__
#include <stdlib.h>
#elif defined( _WIN32 )
#elif defined(_WIN32)
#include <malloc.h>
#else
#include <alloca.h>

Wyświetl plik

@ -91,7 +91,7 @@ STATIC mp_obj_t esp32_rmt_make_new(const mp_obj_type_t *type, size_t n_args, siz
rmt_config_t config;
config.rmt_mode = RMT_MODE_TX;
config.channel = (rmt_channel_t) self->channel_id;
config.channel = (rmt_channel_t)self->channel_id;
config.gpio_num = self->pin;
config.mem_block_num = 1;
config.tx_config.loop_en = 0;

Wyświetl plik

@ -230,7 +230,7 @@ STATIC void machine_hw_spi_init_internal(
}
STATIC void machine_hw_spi_deinit(mp_obj_base_t *self_in) {
machine_hw_spi_obj_t *self = (machine_hw_spi_obj_t *) self_in;
machine_hw_spi_obj_t *self = (machine_hw_spi_obj_t *)self_in;
if (self->state == MACHINE_HW_SPI_STATE_INIT) {
self->state = MACHINE_HW_SPI_STATE_DEINIT;
machine_hw_spi_deinit_internal(self);
@ -301,7 +301,7 @@ STATIC void machine_hw_spi_print(const mp_print_t *print, mp_obj_t self_in, mp_p
}
STATIC void machine_hw_spi_init(mp_obj_base_t *self_in, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
machine_hw_spi_obj_t *self = (machine_hw_spi_obj_t *) self_in;
machine_hw_spi_obj_t *self = (machine_hw_spi_obj_t *)self_in;
enum { ARG_id, ARG_baudrate, ARG_polarity, ARG_phase, ARG_bits, ARG_firstbit, ARG_sck, ARG_mosi, ARG_miso };
static const mp_arg_t allowed_args[] = {
@ -401,5 +401,5 @@ const mp_obj_type_t machine_hw_spi_type = {
.print = machine_hw_spi_print,
.make_new = machine_hw_spi_make_new,
.protocol = &machine_hw_spi_p,
.locals_dict = (mp_obj_dict_t *) &mp_machine_spi_locals_dict,
.locals_dict = (mp_obj_dict_t *)&mp_machine_spi_locals_dict,
};

Wyświetl plik

@ -156,7 +156,7 @@ STATIC mp_obj_t machine_rtc_memory(mp_uint_t n_args, const mp_obj_t *args) {
if (bufinfo.len > MICROPY_HW_RTC_USER_MEM_MAX) {
mp_raise_ValueError("buffer too long");
}
memcpy((char *) rtc_user_mem_data, (char *) bufinfo.buf, bufinfo.len);
memcpy((char *)rtc_user_mem_data, (char *)bufinfo.buf, bufinfo.len);
rtc_user_mem_len = bufinfo.len;
return mp_const_none;
}

Wyświetl plik

@ -285,7 +285,7 @@ STATIC mp_obj_t sd_info(mp_obj_t self_in) {
// so. For the most part people only care about the card size and
// block size.
check_esp_err(sdcard_ensure_card_init((sdcard_card_obj_t *) self, false));
check_esp_err(sdcard_ensure_card_init((sdcard_card_obj_t *)self, false));
uint32_t log_block_nbr = self->card.csd.capacity;
uint32_t log_block_size = _SECTOR_SIZE(self);
@ -303,7 +303,7 @@ STATIC mp_obj_t machine_sdcard_readblocks(mp_obj_t self_in, mp_obj_t block_num,
mp_buffer_info_t bufinfo;
esp_err_t err;
err = sdcard_ensure_card_init((sdcard_card_obj_t *) self, false);
err = sdcard_ensure_card_init((sdcard_card_obj_t *)self, false);
if (err != ESP_OK) {
return false;
}
@ -320,7 +320,7 @@ STATIC mp_obj_t machine_sdcard_writeblocks(mp_obj_t self_in, mp_obj_t block_num,
mp_buffer_info_t bufinfo;
esp_err_t err;
err = sdcard_ensure_card_init((sdcard_card_obj_t *) self, false);
err = sdcard_ensure_card_init((sdcard_card_obj_t *)self, false);
if (err != ESP_OK) {
return false;
}

Wyświetl plik

@ -66,10 +66,10 @@ void spi_tx8fast(uint8_t spi_no, uint8_t dout_data);
// Expansion Macros
#define spi_busy(spi_no) READ_PERI_REG(SPI_CMD(spi_no)) & SPI_USR
#define spi_txd(spi_no, bits, data) spi_transaction(spi_no, 0, 0, 0, 0, bits, (uint32_t) data, 0, 0)
#define spi_tx8(spi_no, data) spi_transaction(spi_no, 0, 0, 0, 0, 8, (uint32_t) data, 0, 0)
#define spi_tx16(spi_no, data) spi_transaction(spi_no, 0, 0, 0, 0, 16, (uint32_t) data, 0, 0)
#define spi_tx32(spi_no, data) spi_transaction(spi_no, 0, 0, 0, 0, 32, (uint32_t) data, 0, 0)
#define spi_txd(spi_no, bits, data) spi_transaction(spi_no, 0, 0, 0, 0, bits, (uint32_t)data, 0, 0)
#define spi_tx8(spi_no, data) spi_transaction(spi_no, 0, 0, 0, 0, 8, (uint32_t)data, 0, 0)
#define spi_tx16(spi_no, data) spi_transaction(spi_no, 0, 0, 0, 0, 16, (uint32_t)data, 0, 0)
#define spi_tx32(spi_no, data) spi_transaction(spi_no, 0, 0, 0, 0, 32, (uint32_t)data, 0, 0)
#define spi_rxd(spi_no, bits) spi_transaction(spi_no, 0, 0, 0, 0, 0, 0, bits, 0)
#define spi_rx8(spi_no) spi_transaction(spi_no, 0, 0, 0, 0, 0, 0, 8, 0)

Wyświetl plik

@ -108,7 +108,7 @@ const uint16_t *tud_descriptor_string_cb(uint8_t index) {
}
// first byte is length (including header), second byte is string type
desc_str[0] = (TUSB_DESC_STRING << 8 ) | (2 * len + 2);
desc_str[0] = (TUSB_DESC_STRING << 8) | (2 * len + 2);
return desc_str;
}

Wyświetl plik

@ -209,10 +209,10 @@ typedef struct {
volatile uint32_t CR1;
} periph_uart_t;
#define USART1 ((periph_uart_t *) 0x40011000)
#define GPIOA ((periph_gpio_t *) 0x40020000)
#define GPIOB ((periph_gpio_t *) 0x40020400)
#define RCC ((periph_rcc_t *) 0x40023800)
#define USART1 ((periph_uart_t *)0x40011000)
#define GPIOA ((periph_gpio_t *)0x40020000)
#define GPIOB ((periph_gpio_t *)0x40020400)
#define RCC ((periph_rcc_t *)0x40023800)
// simple GPIO interface
#define GPIO_MODE_IN (0)

Wyświetl plik

@ -109,7 +109,7 @@ const uint16_t *tud_descriptor_string_cb(uint8_t index) {
}
// first byte is length (including header), second byte is string type
desc_str[0] = (TUSB_DESC_STRING << 8 ) | (2 * len + 2);
desc_str[0] = (TUSB_DESC_STRING << 8) | (2 * len + 2);
return desc_str;
}

Wyświetl plik

@ -217,7 +217,7 @@ STATIC void adc_wait_for_eoc_or_timeout(int32_t timeout) {
#else
#error Unsupported processor
#endif
if (((HAL_GetTick() - tickstart ) > timeout)) {
if (((HAL_GetTick() - tickstart) > timeout)) {
break; // timeout
}
}
@ -313,7 +313,7 @@ STATIC void adc_init_single(pyb_obj_adc_t *adc_obj) {
STATIC void adc_config_channel(ADC_HandleTypeDef *adc_handle, uint32_t channel) {
ADC_ChannelConfTypeDef sConfig;
#if defined (STM32H7)
#if defined(STM32H7)
sConfig.Rank = ADC_REGULAR_RANK_1;
if (__HAL_ADC_IS_CHANNEL_INTERNAL(channel) == 0) {
channel = __HAL_ADC_DECIMAL_NB_TO_CHANNEL(channel);

Wyświetl plik

@ -312,7 +312,7 @@ STATIC mp_obj_t machine_freq(size_t n_args, const mp_obj_t *args) {
#else
mp_int_t sysclk = mp_obj_get_int(args[0]);
mp_int_t ahb = sysclk;
#if defined (STM32H7)
#if defined(STM32H7)
if (ahb > 200000000) {
ahb /= 2;
}

Wyświetl plik

@ -717,7 +717,7 @@ STATIC mp_obj_t pyb_can_setfilter(size_t n_args, const mp_obj_t *pos_args, mp_ma
}
filter.FilterIdHigh = (mp_obj_get_int(params[0]) & 0x1FFFE000) >> 13;
filter.FilterIdLow = (((mp_obj_get_int(params[0]) & 0x00001FFF) << 3) | 4) | rtr_masks[0];
filter.FilterMaskIdHigh = (mp_obj_get_int(params[1]) & 0x1FFFE000 ) >> 13;
filter.FilterMaskIdHigh = (mp_obj_get_int(params[1]) & 0x1FFFE000) >> 13;
filter.FilterMaskIdLow = (((mp_obj_get_int(params[1]) & 0x00001FFF) << 3) | 4) | rtr_masks[1];
if (args[ARG_mode].u_int == MASK32) {
filter.FilterMode = CAN_FILTERMODE_IDMASK;

Wyświetl plik

@ -383,7 +383,7 @@ STATIC HAL_StatusTypeDef PYB_RTC_MspInit_Finalise(RTC_HandleTypeDef *hrtc) {
#endif
uint32_t tickstart = rtc_startup_tick;
while (__HAL_RCC_GET_FLAG(RCC_FLAG_LSERDY) == RESET) {
if ((HAL_GetTick() - tickstart ) > timeout) {
if ((HAL_GetTick() - tickstart) > timeout) {
return HAL_TIMEOUT;
}
}
@ -391,7 +391,7 @@ STATIC HAL_StatusTypeDef PYB_RTC_MspInit_Finalise(RTC_HandleTypeDef *hrtc) {
// we now have to wait for LSI ready or timeout
uint32_t tickstart = rtc_startup_tick;
while (__HAL_RCC_GET_FLAG(RCC_FLAG_LSIRDY) == RESET) {
if ((HAL_GetTick() - tickstart ) > MICROPY_HW_RTC_LSI_TIMEOUT_MS) {
if ((HAL_GetTick() - tickstart) > MICROPY_HW_RTC_LSI_TIMEOUT_MS) {
return HAL_TIMEOUT;
}
}

Wyświetl plik

@ -242,7 +242,7 @@ void HAL_PCD_SOFCallback(PCD_HandleTypeDef *hpcd) {
bool usbd_cdc_rx_buffer_full(usbd_cdc_itf_t *cdc) {
int get = cdc->rx_buf_get, put = cdc->rx_buf_put;
int remaining = (get - put) + (-((int) (get <= put)) & USBD_CDC_RX_DATA_SIZE);
int remaining = (get - put) + (-((int)(get <= put)) & USBD_CDC_RX_DATA_SIZE);
return remaining < CDC_DATA_MAX_PACKET_SIZE + 1;
}

Wyświetl plik

@ -82,7 +82,7 @@ typedef struct {
((INSTANCE) == FTM1) || \
((INSTANCE) == FTM2))
#define IS_FTM_PRESCALERSHIFT(PRESCALERSHIFT) (((PRESCALERSHIFT) &~7) == 0)
#define IS_FTM_PRESCALERSHIFT(PRESCALERSHIFT) (((PRESCALERSHIFT)&~7) == 0)
#define FTM_COUNTERMODE_UP (0)
#define FTM_COUNTERMODE_CENTER (FTM_SC_CPWMS)
@ -110,7 +110,7 @@ typedef struct {
#define IS_FTM_OC_MODE(mode) ((mode) == FTM_OCMODE_TIMING || \
(mode) == FTM_OCMODE_ACTIVE || \
(mode) == FTM_OCMODE_INACTIVE || \
(mode) == FTM_OCMODE_TOGGLE )
(mode) == FTM_OCMODE_TOGGLE)
#define IS_FTM_PWM_MODE(mode) ((mode) == FTM_OCMODE_PWM1 || \
(mode) == FTM_OCMODE_PWM2)

Wyświetl plik

@ -76,21 +76,21 @@ typedef long mp_off_t;
#define __disable_irq() __asm__ volatile ("CPSID i");
#endif
__attribute__(( always_inline )) static inline uint32_t __get_PRIMASK(void) {
__attribute__((always_inline)) static inline uint32_t __get_PRIMASK(void) {
uint32_t result;
__asm volatile ("MRS %0, primask" : "=r" (result));
return result;
}
__attribute__(( always_inline )) static inline void __set_PRIMASK(uint32_t priMask) {
__attribute__((always_inline)) static inline void __set_PRIMASK(uint32_t priMask) {
__asm volatile ("MSR primask, %0" : : "r" (priMask) : "memory");
}
__attribute__(( always_inline )) static inline void enable_irq(mp_uint_t state) {
__attribute__((always_inline)) static inline void enable_irq(mp_uint_t state) {
__set_PRIMASK(state);
}
__attribute__(( always_inline )) static inline mp_uint_t disable_irq(void) {
__attribute__((always_inline)) static inline mp_uint_t disable_irq(void) {
mp_uint_t state = __get_PRIMASK();
__disable_irq();
return state;

Wyświetl plik

@ -110,7 +110,7 @@ typedef struct {
#define GPIO_AF6_I2C1 6
#define GPIO_AF7_FTM1 7
__attribute__(( always_inline )) static inline void __WFI(void) {
__attribute__((always_inline)) static inline void __WFI(void) {
__asm volatile ("wfi");
}

Wyświetl plik

@ -75,7 +75,7 @@ bool uart_init2(pyb_uart_obj_t *uart_obj) {
UARTx = USART1;
GPIO_AF_UARTx = GPIO_AF7_USART1;
#if defined (PYBV4) || defined(PYBV10)
#if defined(PYBV4) || defined(PYBV10)
GPIO_Port = GPIOB;
GPIO_Pin = GPIO_PIN_6 | GPIO_PIN_7;
#else

Wyświetl plik

@ -85,7 +85,7 @@ STATIC void mp_thread_gc(int signo, siginfo_t *info, void *context) {
void **ptrs = (void **)(void *)MP_STATE_THREAD(pystack_start);
gc_collect_root(ptrs, (MP_STATE_THREAD(pystack_cur) - MP_STATE_THREAD(pystack_start)) / sizeof(void *));
#endif
#if defined (__APPLE__)
#if defined(__APPLE__)
sem_post(thread_signal_done_p);
#else
sem_post(&thread_signal_done);

Wyświetl plik

@ -142,15 +142,15 @@ extern const struct _mp_print_t mp_stderr_print;
// type definitions for the specific machine
#if defined( __MINGW32__ ) && defined( __LP64__ )
#if defined(__MINGW32__) && defined(__LP64__)
typedef long mp_int_t; // must be pointer size
typedef unsigned long mp_uint_t; // must be pointer size
#elif defined ( __MINGW32__ ) && defined( _WIN64 )
#elif defined(__MINGW32__) && defined(_WIN64)
#include <stdint.h>
typedef __int64 mp_int_t;
typedef unsigned __int64 mp_uint_t;
#define MP_SSIZE_MAX __INT64_MAX__
#elif defined ( _MSC_VER ) && defined( _WIN64 )
#elif defined(_MSC_VER) && defined(_WIN64)
typedef __int64 mp_int_t;
typedef unsigned __int64 mp_uint_t;
#else
@ -206,7 +206,7 @@ extern const struct _mp_obj_module_t mp_module_time;
// Sanity check
#if ( _MSC_VER < 1800 )
#if (_MSC_VER < 1800)
#error Can only build with Visual Studio 2013 toolset
#endif

Wyświetl plik

@ -348,7 +348,7 @@ mp_obj_t mp_obj_int_pow3(mp_obj_t base, mp_obj_t exponent, mp_obj_t modulus) {
mp_raise_TypeError("pow() with 3 arguments requires integers");
} else {
mp_obj_t result = mp_obj_new_int_from_ull(0); // Use the _from_ull version as this forces an mpz int
mp_obj_int_t *res_p = (mp_obj_int_t *) MP_OBJ_TO_PTR(result);
mp_obj_int_t *res_p = (mp_obj_int_t *)MP_OBJ_TO_PTR(result);
mpz_t l_temp, r_temp, m_temp;
mpz_t *lhs = mp_mpz_for_int(base, &l_temp);

Wyświetl plik

@ -161,7 +161,7 @@ sp_bool = force # ignore/add/remove/force
sp_compare = force # ignore/add/remove/force
# Add or remove space inside '(' and ')'.
sp_inside_paren = ignore # ignore/add/remove/force
sp_inside_paren = remove # ignore/add/remove/force
# Add or remove space between nested parentheses, i.e. '((' vs. ') )'.
sp_paren_paren = remove # ignore/add/remove/force
@ -441,10 +441,10 @@ sp_after_operator_sym_empty = ignore # ignore/add/remove/force
# Add or remove space after C/D cast, i.e. 'cast(int)a' vs. 'cast(int) a' or
# '(int)a' vs. '(int) a'.
sp_after_cast = ignore # ignore/add/remove/force
sp_after_cast = remove # ignore/add/remove/force
# Add or remove spaces inside cast parentheses.
sp_inside_paren_cast = ignore # ignore/add/remove/force
sp_inside_paren_cast = remove # ignore/add/remove/force
# Add or remove space between the type and open parenthesis in a C++ cast,
# i.e. 'int(exp)' vs. 'int (exp)'.
@ -587,7 +587,7 @@ sp_return_brace = ignore # ignore/add/remove/force
sp_attribute_paren = ignore # ignore/add/remove/force
# Add or remove space between 'defined' and '(' in '#if defined (FOO)'.
sp_defined_paren = ignore # ignore/add/remove/force
sp_defined_paren = remove # ignore/add/remove/force
# Add or remove space between 'throw' and '(' in 'throw (something)'.
sp_throw_paren = ignore # ignore/add/remove/force