aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBurt P <pburt0@gmail.com>2018-10-27 12:58:17 -0500
committerLeandro A. F. Pereira <leandro@hardinfo.org>2018-12-02 02:07:23 -0800
commit95e53cda009f498a88f64ef71803a168cb08856c (patch)
treedacc6f84e8ed93db85708b1f58df8705a5d52f8a
parent58a9f093fc830ad3d17a77423136be30db631934 (diff)
enable and fix some warnings
Part of (#298). Signed-off-by: Burt P <pburt0@gmail.com>
-rw-r--r--CMakeLists.txt10
-rw-r--r--hardinfo/gpu_util.c4
-rw-r--r--hardinfo/pci_util.c10
-rw-r--r--hardinfo/x_util.c12
-rw-r--r--modules/network.c2
5 files changed, 22 insertions, 16 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b2f82fa0..d7dbd98d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -219,6 +219,16 @@ add_library(uber-graph STATIC
)
endif()
+set_source_files_properties(
+ hardinfo/usb_util.c
+ hardinfo/pci_util.c
+ hardinfo/gpu_util.c
+ hardinfo/cpu_util.c
+ hardinfo/x_util.c
+ PROPERTIES
+ COMPILE_FLAGS "-Wall -Wextra -Wno-parentheses -Wno-unused-function"
+)
+
if (HARDINFO_GTK3)
add_executable(hardinfo
hardinfo/usb_util.c
diff --git a/hardinfo/gpu_util.c b/hardinfo/gpu_util.c
index 34015cb3..bb3e06fd 100644
--- a/hardinfo/gpu_util.c
+++ b/hardinfo/gpu_util.c
@@ -255,7 +255,7 @@ gpud *dt_soc_gpu() {
{ "brcm,bcm2835-vc4", "Broadcom", "VideoCore IV" },
{ "arm,mali-450", "ARM", "Mali 450" },
{ "arm,mali", "ARM", "Mali family" },
- { NULL, NULL }
+ { NULL, NULL, NULL }
};
char tmp_path[256] = "";
char *dt_gpu_path = NULL;
@@ -399,7 +399,7 @@ gpud *gpu_get_device_list() {
/* Try other things ... */
-
+ return list;
}
diff --git a/hardinfo/pci_util.c b/hardinfo/pci_util.c
index b04a6e5e..aeb2e839 100644
--- a/hardinfo/pci_util.c
+++ b/hardinfo/pci_util.c
@@ -80,9 +80,7 @@ static char *lspci_line_value(char *line, const char *prefix) {
/* read output line of lspci -vmmnn */
static int lspci_line_string_and_code(char *line, char *prefix, char **str, uint32_t *code) {
char *l = lspci_line_value(line, prefix);
- char buff[512] = "";
char *e;
- int ec;
if (l) {
e = strchr(l, 0);
@@ -97,7 +95,7 @@ static int lspci_line_string_and_code(char *line, char *prefix, char **str, uint
static gboolean pci_fill_details(pcid *s) {
gboolean spawned;
- gchar *out, *err, *p, *l, *t, *next_nl;
+ gchar *out, *err, *p, *l, *next_nl;
gchar *pci_loc = pci_address_str(s->domain, s->bus, s->device, s->function);
gchar *lspci_cmd = g_strdup_printf("lspci -D -s %s -vvv", pci_loc);
@@ -154,9 +152,9 @@ gboolean _sysfs_bus_pci_read_hex(uint32_t dom, uint32_t bus, uint32_t dev, uint3
if (ec) {
*val = tval;
return TRUE;
- } else
- return FALSE;
+ }
}
+ return FALSE;
}
/* https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-bus-pci */
@@ -204,7 +202,7 @@ static gboolean pci_get_device_sysfs(uint32_t dom, uint32_t bus, uint32_t dev, u
static gboolean pci_get_device_lspci(uint32_t dom, uint32_t bus, uint32_t dev, uint32_t func, pcid *s) {
gboolean spawned;
- gchar *out, *err, *p, *l, *t, *next_nl;
+ gchar *out, *err, *p, *l, *next_nl;
gchar *pci_loc = pci_address_str(dom, bus, dev, func);
gchar *lspci_cmd = g_strdup_printf("lspci -D -s %s -vmmnn", pci_loc);
diff --git a/hardinfo/x_util.c b/hardinfo/x_util.c
index 49372f56..c052f00a 100644
--- a/hardinfo/x_util.c
+++ b/hardinfo/x_util.c
@@ -54,11 +54,9 @@ static char *simple_line_value(char *line, const char *prefix) {
gboolean fill_glx_info(glx_info *glx) {
gboolean spawned;
- gchar *out, *err, *p, *l, *t, *next_nl;
+ gchar *out, *err, *p, *l, *next_nl;
gchar *glx_cmd = g_strdup("glxinfo");
- int ec;
-
#define GLX_MATCH_LINE(prefix_str, struct_member) \
if (l = simple_line_value(p, prefix_str)) { glx->struct_member = g_strdup(l); goto glx_next_line; }
@@ -120,11 +118,9 @@ void glx_free(glx_info *s) {
gboolean fill_xinfo(xinfo *xi) {
gboolean spawned;
- gchar *out, *err, *p, *l, *t, *next_nl;
+ gchar *out, *err, *p, *l, *next_nl;
gchar *xi_cmd = g_strdup("xdpyinfo");
- int ec;
-
#define XI_MATCH_LINE(prefix_str, struct_member) \
if (l = simple_line_value(p, prefix_str)) { xi->struct_member = g_strdup(l); goto xi_next_line; }
@@ -154,10 +150,10 @@ gboolean fill_xinfo(xinfo *xi) {
gboolean fill_xrr_info(xrr_info *xrr) {
gboolean spawned;
- gchar *out, *err, *p, *l, *t, *next_nl;
+ gchar *out, *err, *p, *next_nl;
gchar *xrr_cmd = g_strdup("xrandr");
-
int ec;
+
x_screen ts;
x_output to;
char output_id[128];
diff --git a/modules/network.c b/modules/network.c
index 01c4955a..e08f08b6 100644
--- a/modules/network.c
+++ b/modules/network.c
@@ -27,6 +27,8 @@
#include <sys/stat.h>
#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
#include <netdb.h>
#include <hardinfo.h>