../asc2log.c:264:8: warning: implicit declaration of function 'strcasestr' is invalid in C99 [-Wimplicit-function-declaration]
ptr = strcasestr(buf, tmp1);
^
../asc2log.c:264:6: warning: incompatible integer to pointer conversion assigning to 'char *' from 'int' [-Wint-conversion]
ptr = strcasestr(buf, tmp1);
^ ~~~~~~~~~~~~~~~~~~~~~
../asc2log.c:328:6: warning: implicit declaration of function 'strcasestr' is invalid in C99 [-Wimplicit-function-declaration]
if (strcasestr(date, " pm ") != NULL) {
^
../asc2log.c:328:31: warning: comparison between pointer and integer ('int' and 'void *') [-Wpointer-integer-compare]
if (strcasestr(date, " pm ") != NULL) {
~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~
../asc2log.c:336:8: warning: implicit declaration of function 'strptime' is invalid in C99 [-Wimplicit-function-declaration]
if (!strptime(date, "%B %d %I:%M:%S %p %Y", &tms)) {
^
../asc2log.c:354:8: warning: implicit declaration of function 'strptime' is invalid in C99 [-Wimplicit-function-declaration]
if (!strptime(date, "%B %d %H:%M:%S %Y", &tms)) {
../slcanpty.c:476:7: warning: implicit declaration of function 'grantpt' is invalid in C99 [-Wimplicit-function-declaration]
if (grantpt(p) < 0) {
^
../slcanpty.c:481:7: warning: implicit declaration of function 'unlockpt' is invalid in C99 [-Wimplicit-function-declaration]
if (unlockpt(p) < 0) {
^
../slcanpty.c:486:14: warning: implicit declaration of function 'ptsname' is invalid in C99 [-Wimplicit-function-declaration]
name_pts = ptsname(p);
^
../slcanpty.c:486:12: warning: incompatible integer to pointer conversion assigning to 'char *' from 'int' [-Wint-conversion]
name_pts = ptsname(p);
^ ~~~~~~~~~~
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
although it looks like a false positive:
/home/travis/build/linux-can/can-utils/j1939cat.c: In function ‘main’:
/home/travis/build/linux-can/can-utils/j1939cat.c:648:6: warning: ‘ret’ may be used uninitialized in this function [-Wmaybe-uninitialized]
int ret;
^
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
although it looks like a false positive:
/home/travis/build/linux-can/can-utils/can-calc-bit-timing.c: In function ‘print_bit_timing.isra.6’:
/home/travis/build/linux-can/can-utils/can-calc-bit-timing.c:447:42: warning: ‘tseg2’ may be used uninitialized in this function [-Wmaybe-uninitialized]
unsigned int brp, tsegall, tseg, tseg1, tseg2;
^
/home/travis/build/linux-can/can-utils/can-calc-bit-timing.c:447:35: warning: ‘tseg1’ may be used uninitialized in this function [-Wmaybe-uninitialized]
unsigned int brp, tsegall, tseg, tseg1, tseg2;
^
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Fix missing (recently introduced) j1939 files that have not been fixed
in commit 43610bd621 ("Fix arithmetic on a pointer warning") from
Gary Bisson.
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Fix missing (recently introduced) j1939 files that have not been fixed
in commit 46895a41c5 ("Fix comparison type mismatch warnings") from
Gary Bisson.
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
open_socket() has a parameter to provide a network device name which
is properly assigned by its callers to s.intf in main().
Instead of using the callers value open_socket() directly accesses the
global s.intf which generates an unused variable warning with clang.
Fix this by using the provided parameter (no functional change).
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Some debug messages were implemented using err(), which does not return,
but exit the program. This patches replaces the debug messages by
fprintf(stdout, ).
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Android now uses clang with Werror by default which prevents from
building.
Removing Werror for the current warnings.
Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
As pointed out by Gary Bisson clang complains about unused variables in
some valid cases.
Reported-by: Gary Bisson <gary.bisson@boundarydevices.com>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
While strptime() does not support fractions of seconds in the date/time
string some new asc files support the milliseconds resolution.
When detecting this new format the msecs are retrieved by a separate
sscanf() invocation and added to the timeval's tv_usec element.
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Detailed change log:
log2asc:
- support CAN FD tags and Classic CAN frames
- support RTR frames including DLC values
- new option '-r' disable the RTR DLC value for potential compatibility reasons
- new option '-f' to use the CANFD format for Classic CAN too
asc2log:
- support CAN FD tags and Classic CAN frames
- be robust against fractions of seconds in date/time string
- fix reading of RTR frames including DLC values in Classic CAN parsing
- fix date/time string detection
cangen:
- new option '-E' to support ESI bit for CAN FD frame generation
(was needed for reference log file generation)
The CAN FD frames support BTR and ESI as special flags. While BTR could
be generated by cangen the ESI bit could not be generated so far.
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
RTR frames contain a valid DLC value which has not been exposed in the
ASC file format since v8.5 of the tools.
So log2asc will expose this DLC value by default which can be changed
by applying the '-r' option to create the former format.
It can be assumed that the tools pre v8.5 will ignore the value but
if not this switch will make sure to create the old format.
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
The CANFD tagged format also supports the encapsulation of Classic CAN
frames which is selected when logging on CAN FD capable CAN interfaces.
With a new option '-f' this CANFD format is selected.
Although this representation is even more inefficient it is seems to be
the common way and increases the readability for mixed CAN/CANFD logs.
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Add some more sanity checks and increase readability for the sscanf()
procedure to read a CANFD tagged line.
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
The CANFD asc format adds information about the CAN controllers bitrate
settings, CRCs and message length (in bits) and its duration.
The plan is to provide static values for these attributes that we can not
get from the log file anyway and stay on the 'old style' format for
classic CAN frames - which has been successfully tested on the latest tools.
The remaining drawback is that the 'old style' format is not able to
provide a DLC information for RTR frames.
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>