lua-rs232: fix compilation with GCC13

Patch taken from upstream.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2023-07-01 11:30:42 -07:00
parent b883a69413
commit 7709b85f86
2 changed files with 57 additions and 1 deletions

View File

@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=lua-rs232
PKG_SOURCE_DATE:=2019-11-20
PKG_SOURCE_VERSION:=c106c94d1a5a84e8582c936528303528608776c2
PKG_RELEASE:=2
PKG_RELEASE:=3
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/srdgame/librs232

View File

@ -0,0 +1,56 @@
From 3467c3c354263b066ad47bddfe6eb869c0111e0d Mon Sep 17 00:00:00 2001
From: Damian Wrobel <dwrobel@ertelnet.rybnik.pl>
Date: Tue, 24 Jan 2023 10:19:16 +0100
Subject: [PATCH] Fix rs232_set_* prototypes mismatch
Fixes compilation error on gcc 13 (excerpt):
rs232_posix.c:490:1: error: conflicting types for 'rs232_set_baud' \
due to enum/integer mismatch; have 'unsigned int(struct rs232_port_t *, \
enum rs232_baud_e)' [-Werror=enum-int-mismatch]
490 | rs232_set_baud(struct rs232_port_t *p, enum rs232_baud_e baud)
| ^~~~~~~~~~~~~~
In file included from rs232_posix.c:39:
../include/librs232/rs232.h:203:24: note: previous declaration of \
'rs232_set_baud' with type 'unsigned int(struct rs232_port_t *, unsigned int)'
203 | RS232_LIB unsigned int rs232_set_baud(struct rs232_port_t *p, unsigned int baud);
| ^~~~~~~~~~~~~~
rs232_posix.c:591:1: error: conflicting types for 'rs232_set_dtr' \
due to enum/integer mismatch; have 'unsigned int(struct rs232_port_t *, \
enum rs232_dtr_e)' [-Werror=enum-int-mismatch]
591 | rs232_set_dtr(struct rs232_port_t *p, enum rs232_dtr_e state)
| ^~~~~~~~~~~~~
In file included from rs232_posix.c:39:
../include/librs232/rs232.h:208:24: note: previous declaration of 'rs232_set_dtr' \
with type 'unsigned int(struct rs232_port_t *, unsigned int)'
208 | RS232_LIB unsigned int rs232_set_dtr(struct rs232_port_t *p, unsigned int dtr);
| ^~~~~~~~~~~~~
Signed-off-by: Damian Wrobel <dwrobel@ertelnet.rybnik.pl>
---
include/librs232/rs232.h | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
--- a/include/librs232/rs232.h
+++ b/include/librs232/rs232.h
@@ -200,13 +200,13 @@ RS232_LIB unsigned int rs232_port_open(s
RS232_LIB unsigned int rs232_close(struct rs232_port_t *p);
RS232_LIB unsigned int rs232_flush(struct rs232_port_t *p);
RS232_LIB void rs232_set_device(struct rs232_port_t *p, const char *device);
-RS232_LIB unsigned int rs232_set_baud(struct rs232_port_t *p, unsigned int baud);
-RS232_LIB unsigned int rs232_set_stop(struct rs232_port_t *p, unsigned int stop);
-RS232_LIB unsigned int rs232_set_data(struct rs232_port_t *p, unsigned int data);
-RS232_LIB unsigned int rs232_set_parity(struct rs232_port_t *p, unsigned int parity);
-RS232_LIB unsigned int rs232_set_flow(struct rs232_port_t *p, unsigned int flow);
-RS232_LIB unsigned int rs232_set_dtr(struct rs232_port_t *p, unsigned int dtr);
-RS232_LIB unsigned int rs232_set_rts(struct rs232_port_t *p, unsigned int rts);
+RS232_LIB unsigned int rs232_set_baud(struct rs232_port_t *p, enum rs232_baud_e baud);
+RS232_LIB unsigned int rs232_set_stop(struct rs232_port_t *p, enum rs232_stop_e stop);
+RS232_LIB unsigned int rs232_set_data(struct rs232_port_t *p, enum rs232_data_e data);
+RS232_LIB unsigned int rs232_set_parity(struct rs232_port_t *p, enum rs232_parity_e parity);
+RS232_LIB unsigned int rs232_set_flow(struct rs232_port_t *p, enum rs232_flow_e flow);
+RS232_LIB unsigned int rs232_set_dtr(struct rs232_port_t *p, enum rs232_dtr_e state);
+RS232_LIB unsigned int rs232_set_rts(struct rs232_port_t *p, enum rs232_rts_e state);
RS232_LIB const char * rs232_get_device(struct rs232_port_t *p);
RS232_LIB unsigned int rs232_get_baud(struct rs232_port_t *p);
RS232_LIB unsigned int rs232_get_stop(struct rs232_port_t *p);