Merge pull request #225 from marckleinebudde/fix-warnings

Fix warnings
pull/237/head
Marc Kleine-Budde 2020-08-07 13:53:48 +02:00 committed by GitHub
commit dec3c5eda1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 8 deletions

View File

@ -2,13 +2,15 @@ cmake_minimum_required(VERSION 3.3)
project(can-utils LANGUAGES C) project(can-utils LANGUAGES C)
include (CheckSymbolExists)
include (GNUInstallDirs) include (GNUInstallDirs)
if(NOT CMAKE_BUILD_TYPE) if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release) set(CMAKE_BUILD_TYPE Release)
endif() endif()
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") check_symbol_exists(__GNU_LIBRARY__ "features.h" _GNU_SOURCE)
if(_GNU_SOURCE)
add_definitions(-D_GNU_SOURCE) add_definitions(-D_GNU_SOURCE)
endif() endif()

View File

@ -444,7 +444,7 @@ static int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt,
unsigned int spt_nominal; /* nominal sample point */ unsigned int spt_nominal; /* nominal sample point */
unsigned int best_tseg = 0; /* current best value for tseg */ unsigned int best_tseg = 0; /* current best value for tseg */
unsigned int best_brp = 0; /* current best value for brp */ unsigned int best_brp = 0; /* current best value for brp */
unsigned int brp, tsegall, tseg, tseg1, tseg2; unsigned int brp, tsegall, tseg, tseg1 = 0, tseg2 = 0;
u64 v64; u64 v64;
/* Use CiA recommended sample points */ /* Use CiA recommended sample points */

View File

@ -645,7 +645,7 @@ static int j1939cat_parse_args(struct j1939cat_priv *priv, int argc, char *argv[
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
struct j1939cat_priv *priv; struct j1939cat_priv *priv;
int ret; int ret = 0;
priv = malloc(sizeof(*priv)); priv = malloc(sizeof(*priv));
if (!priv) if (!priv)
@ -679,6 +679,6 @@ int main(int argc, char *argv[])
close(priv->infile); close(priv->infile);
close(priv->outfile); close(priv->outfile);
close(priv->sock); close(priv->sock);
return ret; return ret;
} }

View File

@ -24,17 +24,18 @@
* *
*/ */
#include <fcntl.h>
#include <libgen.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <libgen.h>
#include <string.h> #include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <termios.h> #include <termios.h>
#include <unistd.h>
#include <net/if.h> #include <net/if.h>
#include <sys/socket.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/select.h>
#include <sys/socket.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>