micropython icon indicating copy to clipboard operation
micropython copied to clipboard

Invalid return value in "machine_uart.c"

Open WebDust21 opened this issue 2 years ago • 0 comments

I have been trying to compile microPython for qemu-vexpress-a9, and have run into a problem.

Compilation fails here:

CC build/packages/micropython-v1.13.0/port/modules/machine/machine_lcd.o
CC build/packages/micropython-v1.13.0/port/modules/machine/machine_pin.o
CC build/packages/micropython-v1.13.0/port/modules/machine/machine_pwm.o
CC build/packages/micropython-v1.13.0/port/modules/machine/machine_rtc.o
CC build/packages/micropython-v1.13.0/port/modules/machine/machine_timer.o
CC build/packages/micropython-v1.13.0/port/modules/machine/machine_uart.o
packages/micropython-v1.13.0/port/modules/machine/machine_uart.c: In function 'machine_uart_ioctl':
packages/micropython-v1.13.0/port/modules/machine/machine_uart.c:253:12: error: return makes integer from pointer without a cast [-Werror=int-conversion]
     return NULL;
            ^~~~
cc1: all warnings being treated as errors
scons: *** [build/packages/micropython-v1.13.0/port/modules/machine/machine_uart.o] Error 1
scons: building terminated because of errors.

The offending line of source code is here: https://github.com/RT-Thread-packages/micropython/blob/07ab039837b7e2cbcb8089f0322fe58202eab6c1/port/modules/machine/machine_uart.c#L253

STATIC mp_uint_t machine_uart_ioctl(mp_obj_t obj, mp_uint_t request, uintptr_t arg, int *errcode) {
    return NULL;
}

In all other cases I can find in the RT-Thread microPython port, a function defined as "STATIC mp_uint_t" must have a numeric return value, for example

return -1;

https://github.com/RT-Thread-packages/micropython/blob/07ab039837b7e2cbcb8089f0322fe58202eab6c1/extmod/machine_signal.c#L132

Please advise.

WebDust21 avatar Nov 06 '22 18:11 WebDust21