Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Multiple functions with no return value although declared in prototype #7

@maxgerhardt

Description

@maxgerhardt

GCC is throwing errors in your code regarding warning: no return statement in function returning non-void errors.

E.g., where is the return statement in this function that's supposed return a signed short?

extern "C" signed short uart_rx_cb(uint16_t uart_no, unsigned short len,
unsigned char * pbuf, int *pend)
{
int ret = 0;
int _len = 0;
do
{
ret = tls_uart_read(uart_no, pbuf + *pend, 1);
if (ret > 0)
(*pend) = *pend + ret;
_len += ret;
} while (ret != 0);
}

Same here

int init_uart1_cfg(int uart_no, bool uart1_mul)
{
unsigned int reg = 0;
if (TLS_UART_1 == uart_no
&& true == uart1_mul
&& ~(INIT_UART1_MUL & init_uart1_pin_cfg))
{
delay(10); // SHOULD delay 0.010 second.
reg = tls_reg_read32(HR_GPIOB_AFSEL);
reg &= ~(BIT(11) | BIT(12));
tls_reg_write32(HR_GPIOB_AFSEL, reg);
wm_uart1_rx_config(TLS_UART1_MUL_RX);
wm_uart1_tx_config(TLS_UART1_MUL_TX);
} else if (TLS_UART_1 == uart_no
&& false == uart1_mul
&& ~(INIT_UART1_DEF & init_uart1_pin_cfg))
{
delay(10); // SHOULD delay 0.010 second.
reg = tls_reg_read32(HR_GPIOB_AFSEL);
reg &= ~(BIT(17) | BIT(18));
tls_reg_write32(HR_GPIOB_AFSEL, reg);
wm_uart1_rx_config(WM_IO_PB_11);
wm_uart1_tx_config(WM_IO_PB_12);
init_uart1_pin_cfg = INIT_UART1_DEF;
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions