mirror of
git://sigrok.org/libserialport
synced 2023-08-10 21:13:24 +03:00
Fix a compiler warning when -Wshadow is used.
CC serialport.lo In file included from ../serialport.c:25:0: ../serialport.c: In function 'get_config': ../libserialport_internal.h:227:25: warning: declaration of 'ret' shadows a previous local [-Wshadow] #define TRY(x) do { int ret = x; if (ret != SP_OK) RETURN_CODEVAL(ret); } while (0) ^ ../serialport.c:1566:3: note: in expansion of macro 'TRY' TRY(get_baudrate(port->fd, &config->baudrate)); ^ ../serialport.c:1543:6: warning: shadowed declaration is here [-Wshadow] int ret = get_flow(port->fd, data); ^ Also, add -Wshadow to the list of default compiler options.
This commit is contained in:
parent
b3e619c8b2
commit
613c48f191
@ -39,7 +39,7 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
|||||||
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
|
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
|
||||||
|
|
||||||
# Enable more compiler warnings.
|
# Enable more compiler warnings.
|
||||||
CFLAGS="$CFLAGS -std=c99 -Wall -Wextra -pedantic -Wmissing-prototypes"
|
CFLAGS="$CFLAGS -std=c99 -Wall -Wextra -pedantic -Wmissing-prototypes -Wshadow"
|
||||||
|
|
||||||
# Checks for programs.
|
# Checks for programs.
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
|
@ -224,7 +224,7 @@ extern void (*sp_debug_handler)(const char *format, ...);
|
|||||||
#define TRACE(fmt, ...) DEBUG_FMT("%s(" fmt ") called", __func__, __VA_ARGS__)
|
#define TRACE(fmt, ...) DEBUG_FMT("%s(" fmt ") called", __func__, __VA_ARGS__)
|
||||||
#define TRACE_VOID() DEBUG_FMT("%s() called", __func__)
|
#define TRACE_VOID() DEBUG_FMT("%s() called", __func__)
|
||||||
|
|
||||||
#define TRY(x) do { int ret = x; if (ret != SP_OK) RETURN_CODEVAL(ret); } while (0)
|
#define TRY(x) do { int retval = x; if (retval != SP_OK) RETURN_CODEVAL(retval); } while (0)
|
||||||
|
|
||||||
SP_PRIV struct sp_port **list_append(struct sp_port **list, const char *portname);
|
SP_PRIV struct sp_port **list_append(struct sp_port **list, const char *portname);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user