From 761e4c7ff62896c7d8f8c3dfc3cc98a4cc4f2f6f Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 19 Jul 2017 13:12:10 +1000 Subject: [PATCH] all: Remove trailing spaces, per coding conventions. --- .gitignore | 2 +- CODECONVENTIONS.md | 2 +- bare-arm/stm32f405.ld | 10 +++++----- esp8266/hspi_register.h | 2 +- examples/embedding/Makefile.upylib | 2 +- extmod/modubinascii.c | 2 +- minimal/stm32f405.ld | 4 ++-- mpy-cross/Makefile | 2 +- py/asmarm.c | 2 +- py/formatfloat.c | 16 ++++++++-------- py/mkrules.mk | 2 +- py/objtype.c | 2 +- py/runtime.c | 2 +- stmhal/boards/common.ld | 10 +++++----- stmhal/boards/stm32f401xd.ld | 2 +- stmhal/boards/stm32f401xe.ld | 2 +- stmhal/boards/stm32f405.ld | 2 +- stmhal/boards/stm32f411.ld | 4 ++-- stmhal/boards/stm32f429.ld | 6 +++--- stmhal/boards/stm32l476xe.ld | 4 ++-- stmhal/boards/stm32l476xg.ld | 4 ++-- stmhal/i2c.c | 2 +- stmhal/sdcard.c | 2 +- stmhal/timer.c | 2 +- stmhal/uart.c | 2 +- tests/README | 2 +- tools/codestats.sh | 6 +++--- windows/msvc/gettimeofday.c | 2 +- windows/sleep.c | 2 +- 29 files changed, 52 insertions(+), 52 deletions(-) diff --git a/.gitignore b/.gitignore index 280db388f5..5e841a89c0 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,7 @@ *.dis *.exe -# Packages +# Packages ############ # Logs and Databases diff --git a/CODECONVENTIONS.md b/CODECONVENTIONS.md index f9dce71ddd..982b958313 100644 --- a/CODECONVENTIONS.md +++ b/CODECONVENTIONS.md @@ -73,7 +73,7 @@ White space: keyword and the opening parenthesis. - Put 1 space after a comma, and 1 space around operators. -Braces: +Braces: - Use braces for all blocks, even no-line and single-line pieces of code. - Put opening braces on the end of the line it belongs to, not on diff --git a/bare-arm/stm32f405.ld b/bare-arm/stm32f405.ld index 345a92d3c1..dd688a0246 100644 --- a/bare-arm/stm32f405.ld +++ b/bare-arm/stm32f405.ld @@ -11,7 +11,7 @@ MEMORY CCMRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 0x010000 /* 64 KiB */ RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 0x020000 /* 128 KiB */ } - + /* top end of the stack */ _estack = ORIGIN(RAM) + LENGTH(RAM); @@ -30,7 +30,7 @@ SECTIONS . = ALIGN(4); } >FLASH_ISR - + /* The program code and other data goes into FLASH */ .text : { @@ -46,7 +46,7 @@ SECTIONS _etext = .; /* define a global symbol at end of code */ _sidata = _etext; /* This is used by the startup in order to initialize the .data secion */ } >FLASH_TEXT - + /* .ARM.extab : { @@ -60,7 +60,7 @@ SECTIONS __exidx_end = .; } >FLASH */ - + /* This is the initialized data section The program executes knowing that the data is in the RAM but the loader puts the initial values in the FLASH (inidata). @@ -76,7 +76,7 @@ SECTIONS . = ALIGN(4); _edata = .; /* define a global symbol at data end; used by startup code in order to initialise the .data section in RAM */ } >RAM - + /* Uninitialized data section */ .bss : { diff --git a/esp8266/hspi_register.h b/esp8266/hspi_register.h index 30a5ff5884..4dd335b400 100644 --- a/esp8266/hspi_register.h +++ b/esp8266/hspi_register.h @@ -3,7 +3,7 @@ * Modified by David Ogilvy (MetalPhreak) * Based on original file included in SDK 1.0.0 * - * Missing defines from previous SDK versions have + * Missing defines from previous SDK versions have * been added and are noted with comments. The * names of these defines are likely to change. */ diff --git a/examples/embedding/Makefile.upylib b/examples/embedding/Makefile.upylib index 4663ad30ab..bb48fd5075 100644 --- a/examples/embedding/Makefile.upylib +++ b/examples/embedding/Makefile.upylib @@ -56,7 +56,7 @@ endif # On OSX, 'gcc' is a symlink to clang unless a real gcc is installed. # The unix port of micropython on OSX must be compiled with clang, -# while cross-compile ports require gcc, so we test here for OSX and +# while cross-compile ports require gcc, so we test here for OSX and # if necessary override the value of 'CC' set in py/mkenv.mk ifeq ($(UNAME_S),Darwin) CC = clang diff --git a/extmod/modubinascii.c b/extmod/modubinascii.c index cf250d27f1..4dda3c4426 100644 --- a/extmod/modubinascii.c +++ b/extmod/modubinascii.c @@ -118,7 +118,7 @@ mp_obj_t mod_binascii_a2b_base64(mp_obj_t data) { vstr_init_len(&vstr, 0); } else { - vstr_init_len(&vstr, ((bufinfo.len / 4) * 3) - ((in[bufinfo.len-1] == '=') ? ((in[bufinfo.len-2] == '=') ? 2 : 1 ) : 0)); + vstr_init_len(&vstr, ((bufinfo.len / 4) * 3) - ((in[bufinfo.len-1] == '=') ? ((in[bufinfo.len-2] == '=') ? 2 : 1 ) : 0)); } byte *out = (byte*)vstr.buf; for (mp_uint_t i = bufinfo.len; i; i -= 4) { diff --git a/minimal/stm32f405.ld b/minimal/stm32f405.ld index b4aeda744e..a202294a54 100644 --- a/minimal/stm32f405.ld +++ b/minimal/stm32f405.ld @@ -9,7 +9,7 @@ MEMORY CCMRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 0x010000 /* 64 KiB */ RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 0x020000 /* 128 KiB */ } - + /* top end of the stack */ _estack = ORIGIN(RAM) + LENGTH(RAM); @@ -45,7 +45,7 @@ SECTIONS . = ALIGN(4); _edata = .; /* define a global symbol at data end; used by startup code in order to initialise the .data section in RAM */ } >RAM - + /* Uninitialized data section */ .bss : { diff --git a/mpy-cross/Makefile b/mpy-cross/Makefile index f5b643c6cc..c04adaf6ad 100644 --- a/mpy-cross/Makefile +++ b/mpy-cross/Makefile @@ -45,7 +45,7 @@ endif # On OSX, 'gcc' is a symlink to clang unless a real gcc is installed. # The unix port of micropython on OSX must be compiled with clang, -# while cross-compile ports require gcc, so we test here for OSX and +# while cross-compile ports require gcc, so we test here for OSX and # if necessary override the value of 'CC' set in py/mkenv.mk ifeq ($(UNAME_S),Darwin) CC = clang diff --git a/py/asmarm.c b/py/asmarm.c index da07680e31..ff22aba90a 100644 --- a/py/asmarm.c +++ b/py/asmarm.c @@ -135,7 +135,7 @@ STATIC uint asm_arm_op_orr_reg(uint rd, uint rn, uint rm) { void asm_arm_bkpt(asm_arm_t *as) { // bkpt #0 - emit_al(as, 0x1200070); + emit_al(as, 0x1200070); } // locals: diff --git a/py/formatfloat.c b/py/formatfloat.c index ea5a07977b..2f10d425a8 100644 --- a/py/formatfloat.c +++ b/py/formatfloat.c @@ -161,7 +161,7 @@ int mp_format_float(FPTYPE f, char *buf, size_t buf_size, char fmt, int prec, ch if (fmt == 'g' && prec == 0) { prec = 1; } - int e, e1; + int e, e1; int dec = 0; char e_sign = '\0'; int num_digits = 0; @@ -209,7 +209,7 @@ int mp_format_float(FPTYPE f, char *buf, size_t buf_size, char fmt, int prec, ch e_sign_char = '+'; } } else if (fp_isless1(f)) { - e++; + e++; f *= FPCONST(10.0); } @@ -232,7 +232,7 @@ int mp_format_float(FPTYPE f, char *buf, size_t buf_size, char fmt, int prec, ch num_digits = prec; if (num_digits) { - *s++ = '.'; + *s++ = '.'; while (--e && num_digits) { *s++ = '0'; num_digits--; @@ -266,7 +266,7 @@ int mp_format_float(FPTYPE f, char *buf, size_t buf_size, char fmt, int prec, ch f *= FPCONST(0.1); } - // If the user specified fixed format (fmt == 'f') and e makes the + // If the user specified fixed format (fmt == 'f') and e makes the // number too big to fit into the available buffer, then we'll // switch to the 'e' format. @@ -327,7 +327,7 @@ int mp_format_float(FPTYPE f, char *buf, size_t buf_size, char fmt, int prec, ch if (prec == 0) { prec = 1; } - num_digits = prec; + num_digits = prec; } // Print the digits of the mantissa @@ -365,7 +365,7 @@ int mp_format_float(FPTYPE f, char *buf, size_t buf_size, char fmt, int prec, ch if (rs == buf) { break; } - rs--; + rs--; } if (*rs == '0') { // We need to insert a 1 @@ -380,13 +380,13 @@ int mp_format_float(FPTYPE f, char *buf, size_t buf_size, char fmt, int prec, ch e_sign = '+'; } } else { - e++; + e++; } } else { // Need at extra digit at the end to make room for the leading '1' s++; } - char *ss = s; + char *ss = s; while (ss > rs) { *ss = ss[-1]; ss--; diff --git a/py/mkrules.mk b/py/mkrules.mk index 00ed279176..e660820016 100644 --- a/py/mkrules.mk +++ b/py/mkrules.mk @@ -6,7 +6,7 @@ endif # This file expects that OBJ contains a list of all of the object files. # The directory portion of each object file is used to locate the source -# and should not contain any ..'s but rather be relative to the top of the +# and should not contain any ..'s but rather be relative to the top of the # tree. # # So for example, py/map.c would have an object file name py/map.o diff --git a/py/objtype.c b/py/objtype.c index 2a119e40fb..0c0826cf93 100644 --- a/py/objtype.c +++ b/py/objtype.c @@ -375,7 +375,7 @@ STATIC mp_obj_t instance_unary_op(mp_uint_t op, mp_obj_t self_in) { if (member[0] == MP_OBJ_NULL) { // https://docs.python.org/3/reference/datamodel.html#object.__hash__ // "User-defined classes have __eq__() and __hash__() methods by default; - // with them, all objects compare unequal (except with themselves) and + // with them, all objects compare unequal (except with themselves) and // x.__hash__() returns an appropriate value such that x == y implies // both that x is y and hash(x) == hash(y)." return MP_OBJ_NEW_SMALL_INT((mp_uint_t)self_in); diff --git a/py/runtime.c b/py/runtime.c index a8a1f73fa4..ecc3ae2f51 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -127,7 +127,7 @@ void mp_deinit(void) { //mp_obj_dict_free(&dict_main); //mp_map_deinit(&MP_STATE_VM(mp_loaded_modules_map)); - // call port specific deinitialization if any + // call port specific deinitialization if any #ifdef MICROPY_PORT_INIT_FUNC MICROPY_PORT_DEINIT_FUNC; #endif diff --git a/stmhal/boards/common.ld b/stmhal/boards/common.ld index fcae1b4c6e..e5dea49d08 100644 --- a/stmhal/boards/common.ld +++ b/stmhal/boards/common.ld @@ -27,7 +27,7 @@ SECTIONS . = ALIGN(4); } >FLASH_ISR - + /* The program code and other data goes into FLASH */ .text : { @@ -40,10 +40,10 @@ SECTIONS . = ALIGN(4); _etext = .; /* define a global symbol at end of code */ } >FLASH_TEXT - + /* used by the startup to initialize data */ _sidata = LOADADDR(.data); - + /* This is the initialized data section The program executes knowing that the data is in the RAM but the loader puts the initial values in the FLASH (inidata). @@ -51,13 +51,13 @@ SECTIONS .data : { . = ALIGN(4); - _sdata = .; /* create a global symbol at data start; used by startup code in order to initialise the .data section in RAM */ + _sdata = .; /* create a global symbol at data start; used by startup code in order to initialise the .data section in RAM */ *(.data*) /* .data* sections */ . = ALIGN(4); _edata = .; /* define a global symbol at data end; used by startup code in order to initialise the .data section in RAM */ } >RAM AT> FLASH_TEXT - + /* Uninitialized data section */ .bss : { diff --git a/stmhal/boards/stm32f401xd.ld b/stmhal/boards/stm32f401xd.ld index 53aa83d53b..415c258496 100644 --- a/stmhal/boards/stm32f401xd.ld +++ b/stmhal/boards/stm32f401xd.ld @@ -15,7 +15,7 @@ MEMORY /* produce a link error if there is not this amount of RAM for these sections */ _minimum_stack_size = 2K; _minimum_heap_size = 16K; - + /* Define tho top end of the stack. The stack is full descending so begins just above last byte of RAM. Note that EABI requires the stack to be 8-byte aligned for a call. */ diff --git a/stmhal/boards/stm32f401xe.ld b/stmhal/boards/stm32f401xe.ld index a91eee0798..a2e693b491 100644 --- a/stmhal/boards/stm32f401xe.ld +++ b/stmhal/boards/stm32f401xe.ld @@ -15,7 +15,7 @@ MEMORY /* produce a link error if there is not this amount of RAM for these sections */ _minimum_stack_size = 2K; _minimum_heap_size = 16K; - + /* Define tho top end of the stack. The stack is full descending so begins just above last byte of RAM. Note that EABI requires the stack to be 8-byte aligned for a call. */ diff --git a/stmhal/boards/stm32f405.ld b/stmhal/boards/stm32f405.ld index 1a256c1317..c6107913f2 100644 --- a/stmhal/boards/stm32f405.ld +++ b/stmhal/boards/stm32f405.ld @@ -16,7 +16,7 @@ MEMORY /* produce a link error if there is not this amount of RAM for these sections */ _minimum_stack_size = 2K; _minimum_heap_size = 16K; - + /* Define tho top end of the stack. The stack is full descending so begins just above last byte of RAM. Note that EABI requires the stack to be 8-byte aligned for a call. */ diff --git a/stmhal/boards/stm32f411.ld b/stmhal/boards/stm32f411.ld index 0b7bcb553c..d156e852a0 100644 --- a/stmhal/boards/stm32f411.ld +++ b/stmhal/boards/stm32f411.ld @@ -11,11 +11,11 @@ MEMORY FLASH_TEXT (rx) : ORIGIN = 0x08020000, LENGTH = 0x060000 /* sectors 5,6,7 3*128KiB = 384 KiB */ RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 0x020000 /* 128 KiB */ } - + /* produce a link error if there is not this amount of RAM for these sections */ _minimum_stack_size = 2K; _minimum_heap_size = 16K; - + /* Define tho top end of the stack. The stack is full descending so begins just above last byte of RAM. Note that EABI requires the stack to be 8-byte aligned for a call. */ diff --git a/stmhal/boards/stm32f429.ld b/stmhal/boards/stm32f429.ld index 0feb5bd621..f358233a60 100644 --- a/stmhal/boards/stm32f429.ld +++ b/stmhal/boards/stm32f429.ld @@ -4,18 +4,18 @@ /* Specify the memory areas */ MEMORY -{ +{ FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 0x0200000 /* entire flash, 2048 KiB */ FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 0x0004000 /* sector 0, 16 KiB */ FLASH_TEXT (rx) : ORIGIN = 0x08020000, LENGTH = 0x0088000 /* sectors 5,6,7,8, 4*128KiB = 512 KiB (could increase it more) */ RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 0x0030000 /* 192 KiB */ SDRAM(xrw) : ORIGIN = 0xC0000000, LENGTH = 0x0800000 /* 8 MByte */ } - + /* produce a link error if there is not this amount of RAM for these sections */ _minimum_stack_size = 2K; _minimum_heap_size = 16K; - + /* Define tho top end of the stack. The stack is full descending so begins just above last byte of RAM. Note that EABI requires the stack to be 8-byte aligned for a call. */ diff --git a/stmhal/boards/stm32l476xe.ld b/stmhal/boards/stm32l476xe.ld index 114158d8c8..bb9895d2a7 100644 --- a/stmhal/boards/stm32l476xe.ld +++ b/stmhal/boards/stm32l476xe.ld @@ -4,7 +4,7 @@ /* Specify the memory areas */ MEMORY -{ +{ FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 512K FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 0x0004000 /* sectors 0-7, 16 KiB */ FLASH_TEXT (rx) : ORIGIN = 0x08004000, LENGTH = 0x005C000 /* sectors 8-191, 368 KiB */ @@ -16,7 +16,7 @@ MEMORY /* produce a link error if there is not this amount of RAM for these sections */ _minimum_stack_size = 2K; _minimum_heap_size = 16K; - + /* Define the top end of the stack. The stack is full descending so begins just above last byte of RAM. Note that EABI requires the stack to be 8-byte aligned for a call. */ diff --git a/stmhal/boards/stm32l476xg.ld b/stmhal/boards/stm32l476xg.ld index b9c29d624d..684078c430 100644 --- a/stmhal/boards/stm32l476xg.ld +++ b/stmhal/boards/stm32l476xg.ld @@ -4,7 +4,7 @@ /* Specify the memory areas */ MEMORY -{ +{ FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 0x0004000 /* sectors 0-7, 16 KiB */ FLASH_TEXT (rx) : ORIGIN = 0x08004000, LENGTH = 0x007C000 /* sectors 8-255, 496 KiB */ @@ -18,7 +18,7 @@ ENTRY(Reset_Handler) /* produce a link error if there is not this amount of RAM for these sections */ _minimum_stack_size = 2K; _minimum_heap_size = 16K; - + /* Define the top end of the stack. The stack is full descending so begins just above last byte of RAM. Note that EABI requires the stack to be 8-byte aligned for a call. */ diff --git a/stmhal/i2c.c b/stmhal/i2c.c index d0d877818a..f77222715a 100644 --- a/stmhal/i2c.c +++ b/stmhal/i2c.c @@ -283,7 +283,7 @@ void i2c_init(I2C_HandleTypeDef *i2c) { const pyb_i2c_obj_t *self = &pyb_i2c_obj[i2c_unit - 1]; dma_invalidate_channel(self->tx_dma_descr); dma_invalidate_channel(self->rx_dma_descr); - + if (0) { #if defined(MICROPY_HW_I2C1_SCL) } else if (i2c->Instance == I2C1) { diff --git a/stmhal/sdcard.c b/stmhal/sdcard.c index c7ddbbde3a..5260e0a500 100644 --- a/stmhal/sdcard.c +++ b/stmhal/sdcard.c @@ -216,7 +216,7 @@ void sdcard_power_off(void) { if (!sd_handle.Instance) { return; } - HAL_SD_DeInit(&sd_handle); + HAL_SD_DeInit(&sd_handle); sd_handle.Instance = NULL; } diff --git a/stmhal/timer.c b/stmhal/timer.c index 39f168fc89..6513f95d37 100644 --- a/stmhal/timer.c +++ b/stmhal/timer.c @@ -1149,7 +1149,7 @@ STATIC mp_obj_t pyb_timer_period(mp_uint_t n_args, const mp_obj_t *args) { // Reset the counter to zero. Otherwise, if counter >= period it will // continue counting until it wraps (at either 16 or 32 bits depending // on the timer). - __HAL_TIM_SetCounter(&self->tim, 0); + __HAL_TIM_SetCounter(&self->tim, 0); return mp_const_none; } } diff --git a/stmhal/uart.c b/stmhal/uart.c index 735c6f168b..b4ff40e797 100644 --- a/stmhal/uart.c +++ b/stmhal/uart.c @@ -656,7 +656,7 @@ STATIC mp_obj_t pyb_uart_init_helper(pyb_uart_obj_t *self, mp_uint_t n_args, con self->read_buf_len = args.read_buf_len.u_int + 1; // +1 to adjust for usable length of buffer self->read_buf = m_new(byte, self->read_buf_len << self->char_width); __HAL_UART_ENABLE_IT(&self->uart, UART_IT_RXNE); - HAL_NVIC_SetPriority(self->irqn, IRQ_PRI_UART, IRQ_SUBPRI_UART); + HAL_NVIC_SetPriority(self->irqn, IRQ_PRI_UART, IRQ_SUBPRI_UART); HAL_NVIC_EnableIRQ(self->irqn); } diff --git a/tests/README b/tests/README index b028cd062a..3458f36a80 100644 --- a/tests/README +++ b/tests/README @@ -13,6 +13,6 @@ condition a test. The run-tests script uses small scripts in the feature_check directory to check whether each such feature is present, and skips the relevant tests if not. -When creating new tests, anything that relies on float support should go in the +When creating new tests, anything that relies on float support should go in the float/ subdirectory. Anything that relies on import x, where x is not a built-in module, should go in the import/ subdirectory. diff --git a/tools/codestats.sh b/tools/codestats.sh index c868199e1c..5272f3e9c1 100755 --- a/tools/codestats.sh +++ b/tools/codestats.sh @@ -28,9 +28,9 @@ bin_stmhal=stmhal/build-PYBV10/firmware.elf bin_barearm_1=bare-arm/build/flash.elf bin_barearm_2=bare-arm/build/firmware.elf bin_minimal=minimal/build/firmware.elf -bin_cc3200_1=cc3200/build/LAUNCHXL/application.axf -bin_cc3200_2=cc3200/build/LAUNCHXL/release/application.axf -bin_cc3200_3=cc3200/build/WIPY/release/application.axf +bin_cc3200_1=cc3200/build/LAUNCHXL/application.axf +bin_cc3200_2=cc3200/build/LAUNCHXL/release/application.axf +bin_cc3200_3=cc3200/build/WIPY/release/application.axf # start at zero size; if build fails reuse previous valid size size_unix="0" diff --git a/windows/msvc/gettimeofday.c b/windows/msvc/gettimeofday.c index 363d59d7bc..6d7264ae7e 100644 --- a/windows/msvc/gettimeofday.c +++ b/windows/msvc/gettimeofday.c @@ -43,7 +43,7 @@ int gettimeofday(struct timeval *tp, struct timezone *tz) { // to microseconds ft.tm /= 10; - + // convert to unix format // number of microseconds intervals between the 1st january 1601 and the 1st january 1970 (369 years + 89 leap days) const unsigned __int64 deltaEpoch = 11644473600000000ull; diff --git a/windows/sleep.c b/windows/sleep.c index 214d6d622a..b8f0a2e9b0 100644 --- a/windows/sleep.c +++ b/windows/sleep.c @@ -31,7 +31,7 @@ HANDLE waitTimer = NULL; void init_sleep(void) { - waitTimer = CreateWaitableTimer(NULL, TRUE, NULL); + waitTimer = CreateWaitableTimer(NULL, TRUE, NULL); } void deinit_sleep(void) {