drivers/at: fix invalid function pointer cast.#9740
drivers/at: fix invalid function pointer cast.#9740leandrolanzieri merged 1 commit intoRIOT-OS:masterfrom
Conversation
A-Paul
left a comment
There was a problem hiding this comment.
Hi @cladmi, thank you for your approach to fix this.
I have two remarks.
There are other places where the same cast is used:
paul@hedon:~/git/RIOT$ global --reference --cxref isrpipe_write_one isrpipe_write_one 29 drivers/at/at.c uart_init(uart, baudrate, (uart_rx_cb_t) isrpipe_write_one, isrpipe_write_one 105 drivers/ethos/ethos.c isrpipe_write_one(&uart_stdio_isrpipe, c); isrpipe_write_one 65 sys/include/isrpipe.h int isrpipe_write_one(isrpipe_t *isrpipe, char c); isrpipe_write_one 89 sys/uart_stdio/uart_stdio.c uart_init(UART_STDIO_DEV, UART_STDIO_BAUDRATE, (uart_rx_cb_t) isrpipe_write_one, &uart_stdio_isrpipe); isrpipe_write_one 91 sys/uart_stdio/uart_stdio.c uart_init(ETHOS_UART, ETHOS_BAUDRATE, (uart_rx_cb_t) isrpipe_write_one, &uart_stdio_isrpipe);
I think it might be better to change them all or none, instead of getting diversification.
Code size is increasing by 8 byte. I tried inline but gained 8 bytes too.
1002 0 20 1022 3fe xtimer_core.o (ex /xtimer.a) - 1012 0 0 1012 3f4 at.o (ex /at.a) + 1020 0 0 1020 3fc at.o (ex /at.a) 768 0 0 768 300 xtimer.o (ex /xtimer.a)
I'll take a look later. Is there a tool to find function pointer casts? As I mentioned before, most of the time a function cast is just wrong.
It is to be expected. In fact, I'm quite surprised it is only 8 bytes. If the exact same cast is used everywhere it may make sense to share the wrapper, instead of having each module replicate it as a static function. Btw, im not cladmi. |
|
Hi @jcarrano
How did I messed this up? :D Sorry. I hope neither you or cladmi feel insulted by this mismatch. ;-)
There is a tool called global. In my previous comment is the output for all places where |
|
@A-Paul Are you still there? The AT driver is still not compiling, so this fix remains relevant. Regarding other modules, I have to investigate why it does no fail compilation? Can we get this in first? |
|
marked for the Release |
do you need me to do anything regarding this? |
Agreed. I would still try to get this one in otherwise the Release tests fail with GCC8, and change the rest in follow ups. Maybe open a @jcarrano if we could get this in soon-ish would be nice! As said before, maybe a |
|
@leandrolanzieri as you did a duplicate PR, can you review here ? |
|
Sure. ACK for:
@jia200x will test this now. |
|
I added people who wrote and maintain this module to review. |
jcarrano
left a comment
There was a problem hiding this comment.
Auto-suggesting changes bc. I don't want to open up a real editor.
|
In current master: With PR: So, tested! |
|
@jcarrano please squash! ;) |
a0e9ee7 to
53de520
Compare
|
@jia200x Done. |
leandrolanzieri
left a comment
There was a problem hiding this comment.
Reviewed, tested and CI passing. So ACK.
|
@jcarrano can you please provide the backport against the 2018.10-branch? |
|
@leandrolanzieri Done: #10309 |
Contribution description
Fix an invalid cast of a function pointer. ARM GCC 8.2.0 (on Arch linux) was (rightly) complaining about this.
As a note, I'd regard any explicit cast of function pointers suspicious. That's something that simply should not be done.