- Add some missing @param lines.
- Add [in], [out], or [in,out] markers for @param tags.
- Add explicit "Must not be NULL" comments for parameters where
the caller should not pass in a NULL.
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.
For Windows builds (which require MinGW-w64) we currently support:
- cross-builds using MXE (mxe.cc) and possibly other cross-compile setups
- native builds using MSYS2 (sf.net/projects/msys2/)
Neither of those require explicitly specifying ACLOCAL_DIR.
The "old" MSYS related to the "old" and unsupported MinGW (from
mingw.org) may or may not work properly, so only refer to MSYS2 which
we currently recommend and which has been tested.
$build and $build_os refer to the machine on which the software is
built, $host and $host_os refer to the machine for which the software
is (cross-)built.
The variables $target and $target_os (despite the confusing names)
are only relevant in the context of building cross-compilers.
This fixes the following scan-build warning:
serialport.c: In function 'sp_list_ports':
serialport.c:354:1: warning: control reaches end of non-void function [-Wreturn-type]
This fixes the following scan-build warning:
serialport.c:1170:3: warning: Potential leak of memory pointed to by 'new_handles'
RETURN_ERROR(SP_ERR_MEM, "Mask array realloc() failed");
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This also fixes the following scan-build warning:
serialport.c:335:15: warning: Result of 'malloc' is converted to a
pointer of type 'struct sp_port *', which is incompatible with sizeof
operand type 'struct sp_port **'
if (!(list = malloc(sizeof(struct sp_port **))))
^~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~
Since we're not handling and clearing receive errors (framing, parity and
overrun), we should turn them off to avoid crashing out with
ERROR_OPERATION_ABORTED in various calls if they occur. Invalid data
will then simply not end up in the buffer. This is consistent with our
current behaviour on posix/termios systems.
It might be nice to be able to inform calling code about receive errors, but I
can't see a good way to do this in a cross-platform way at the moment.
This fixes (parts of) bug #341.