all: Reformat C and Python source code with tools/codeformat.py.

This is run with uncrustify 0.70.1, and black 19.10b0.
This commit is contained in:
Damien George
2020-02-27 15:36:53 +11:00
parent 3f39d18c2b
commit 69661f3343
539 changed files with 10496 additions and 8254 deletions

View File

@@ -1,7 +1,7 @@
print('uPy')
print('a long string that is not interned')
print('a string that has unicode αβγ chars')
print(b'bytes 1234\x01')
print("uPy")
print("a long string that is not interned")
print("a string that has unicode αβγ chars")
print(b"bytes 1234\x01")
print(123456789)
for i in range(4):
print(i)

View File

@@ -50,7 +50,8 @@ void __stack_chk_fail(void) {
void __assert_fail(const char *__assertion, const char *__file,
unsigned int __line, const char *__function) {
printf("Assert at %s:%d:%s() \"%s\" failed\n", __file, __line, __function, __assertion);
for (;;) ;
for (;;) {;
}
}
static char *stack_top;
@@ -62,7 +63,7 @@ extern void uart_init_ppc(int qemu);
int main(int argc, char **argv) {
int stack_dummy;
stack_top = (char*)&stack_dummy;
stack_top = (char *)&stack_dummy;
// microwatt has argc/r3 = 0 whereas QEMU has r3 set in head.S
uart_init_ppc(argc);
@@ -124,11 +125,15 @@ mp_obj_t mp_builtin_open(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs)
MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_open_obj, 1, mp_builtin_open);
void nlr_jump_fail(void *val) {
while (1);
while (1) {
;
}
}
void NORETURN __fatal_error(const char *msg) {
while (1);
while (1) {
;
}
}
#ifndef NDEBUG

View File

@@ -93,7 +93,7 @@
// type definitions for the specific machine
#define MICROPY_MAKE_POINTER_CALLABLE(p) ((void*)((mp_uint_t)(p) | 1))
#define MICROPY_MAKE_POINTER_CALLABLE(p) ((void *)((mp_uint_t)(p) | 1))
// This port is 64-bit
#define UINT_FMT "%lu"

View File

@@ -25,7 +25,7 @@
*/
#define mftb() ({unsigned long rval; \
__asm__ volatile("mftb %0" : "=r" (rval)); rval;})
__asm__ volatile ("mftb %0" : "=r" (rval)); rval;})
#define TBFREQ 512000000

View File

@@ -101,11 +101,15 @@ void lpc_uart_init(void) {
}
char lpc_uart_read(void) {
while (lpc_uart_rx_empty()) ;
while (lpc_uart_rx_empty()) {
;
}
return lpc_uart_reg_read(REG_THR);
}
void lpc_uart_write(char c) {
while (lpc_uart_tx_full());
while (lpc_uart_tx_full()) {
;
}
lpc_uart_reg_write(REG_RBR, c);
}

View File

@@ -105,7 +105,9 @@ void potato_uart_init(void) {
char potato_uart_read(void) {
uint64_t val;
while (potato_uart_rx_empty());
while (potato_uart_rx_empty()) {
;
}
val = potato_uart_reg_read(POTATO_CONSOLE_RX);
return (char)(val & 0x000000ff);
@@ -116,6 +118,8 @@ void potato_uart_write(char c) {
val = c;
while (potato_uart_tx_full());
while (potato_uart_tx_full()) {
;
}
potato_uart_reg_write(POTATO_CONSOLE_TX, val);
}