summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ad36ac7)
raw | patch | inline | side by side (parent: ad36ac7)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Wed, 1 Oct 2008 20:01:43 +0000 (20:01 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Wed, 1 Oct 2008 20:01:43 +0000 (20:01 +0000) |
- unused variable
- unused parameter
- assignment / argument discards qualifiers from pointer target type
- comparison between signed and unsigned
- too many arguments to function
- assignment makes pointer from integer without a cast
- incompatible pointer type
- differ in signedness
- implicit declaration of function
- enumeration value not handled in switch
- value computed is not used
Most notably, a possible segfault in the Rrd_Lastupdate() code of the TCL
bindings has been fixed.
Also, -Wundef (warn if an undefined identifier is evaluated in an #if
directive) has been removed from CFLAGS. I don't see any problem with letting
undefined identifiers evaluate to "false" in rrdtool. Keeping that option
would produce a lot of (imho unnecessary) errors which would need to be fixed
using ugly preprocessor statements like '#if defined(FOO) && FOO'.
-- Sebastian Harl
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1557 a5681a0c-68f1-0310-ab6d-d61299d08faa
- unused parameter
- assignment / argument discards qualifiers from pointer target type
- comparison between signed and unsigned
- too many arguments to function
- assignment makes pointer from integer without a cast
- incompatible pointer type
- differ in signedness
- implicit declaration of function
- enumeration value not handled in switch
- value computed is not used
Most notably, a possible segfault in the Rrd_Lastupdate() code of the TCL
bindings has been fixed.
Also, -Wundef (warn if an undefined identifier is evaluated in an #if
directive) has been removed from CFLAGS. I don't see any problem with letting
undefined identifiers evaluate to "false" in rrdtool. Keeping that option
would produce a lot of (imho unnecessary) errors which would need to be fixed
using ugly preprocessor statements like '#if defined(FOO) && FOO'.
-- Sebastian Harl
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1557 a5681a0c-68f1-0310-ab6d-d61299d08faa
index 2045e5a5dca2a06dbc86356eeb520684d5197e85..8f0c67da30d60608ab95b8199e3998e068e19598 100644 (file)
--- a/bindings/ruby/extconf.rb
+++ b/bindings/ruby/extconf.rb
require 'mkmf'
+$CFLAGS += '-Wall'
+
if /linux/ =~ RUBY_PLATFORM
$LDFLAGS += '-Wl,--rpath -Wl,$(EPREFIX)/lib'
elsif /solaris/ =~ RUBY_PLATFORM
diff --git a/bindings/ruby/main.c b/bindings/ruby/main.c
index d2a7ace09b1b05ad9b3aad2bb401e2ae614afcbf..d18b905c356d21c71de67de3895847f88ed73bde 100644 (file)
--- a/bindings/ruby/main.c
+++ b/bindings/ruby/main.c
#include <unistd.h>
#include <ruby.h>
+#include <math.h>
#include "../../src/rrd_tool.h"
typedef struct string_arr_t {
int argc,
char **argv);
+typedef rrd_info_t *(
+ *RRDINFOFUNC) (
+ int argc,
+ char **argv);
+
#define RRD_CHECK_ERROR \
if (rrd_test_error()) \
rb_raise(rb_eRRDError, rrd_get_error()); \
/* Calls Returning Data via the Info Interface */
VALUE rb_rrd_infocall(
- RRDFUNC func,
+ RRDINFOFUNC func,
VALUE args)
{
string_arr a;
case RD_I_STR:
rb_hash_aset(result, key, rb_str_new2(data->value.u_str));
break;
+ case RD_I_INT:
+ rb_hash_aset(result, key, INT2FIX(data->value.u_int));
+ break;
case RD_I_BLO:
rb_hash_aset(result, key,
- rb_str_new(data->value.u_blo.ptr,
+ rb_str_new((char *)data->value.u_blo.ptr,
data->value.u_blo.size));
break;
}
index 34f4077bf55cea90d6c5f8812204a7da15b60159..c0e8b0ff9b2217be48d17b4deb657562111813f3 100644 (file)
--- a/bindings/tcl/Makefile.am
+++ b/bindings/tcl/Makefile.am
VERSION = @VERSION@
AM_CFLAGS = @CFLAGS@
+### no including this by default @WERROR@
TCL_PREFIX = @TCL_PREFIX@
TCL_SHLIB_LD = @TCL_SHLIB_LD@
diff --git a/bindings/tcl/tclrrd.c b/bindings/tcl/tclrrd.c
index d4593bb41c27fb85f6383e103c61c9a2afc2be39..7f604d980e96b6bb7138ed042dd6ef01b471848f 100644 (file)
--- a/bindings/tcl/tclrrd.c
+++ b/bindings/tcl/tclrrd.c
/* Thread-safe version */
static int Rrd_Create(
- ClientData clientData,
+ ClientData __attribute__((unused)) clientData,
Tcl_Interp *interp,
int argc,
CONST84 char *argv[])
return TCL_ERROR;
}
- rrd_create_r(argv2[1], pdp_step, last_up, argc - 2, argv2 + 2);
+ rrd_create_r(argv2[1], pdp_step, last_up, argc - 2,
+ (const char **)argv2 + 2);
getopt_cleanup(argc, argv2);
/* Thread-safe version */
static int Rrd_Dump(
- ClientData clientData,
+ ClientData __attribute__((unused)) clientData,
Tcl_Interp *interp,
int argc,
CONST84 char *argv[])
/* Thread-safe version */
static int Rrd_Last(
- ClientData clientData,
+ ClientData __attribute__((unused)) clientData,
Tcl_Interp *interp,
int argc,
CONST84 char *argv[])
/* Thread-safe version */
static int Rrd_Update(
- ClientData clientData,
+ ClientData __attribute__((unused)) clientData,
Tcl_Interp *interp,
int argc,
CONST84 char *argv[])
return TCL_ERROR;
}
- rrd_update_r(argv2[1], template, argc - 2, argv2 + 2);
+ rrd_update_r(argv2[1], template, argc - 2, (const char **)argv2 + 2);
if (template != NULL) {
free(template);
}
static int Rrd_Lastupdate(
- ClientData clientData,
+ ClientData __attribute__((unused)) clientData,
Tcl_Interp *interp,
int argc,
CONST84 char *argv[])
Tcl_Obj *listPtr;
unsigned long ds_cnt, i;
+ /* TODO: support for rrdcached */
+ if (argc != 2) {
+ Tcl_AppendResult(interp, "RRD Error: needs a single rrd filename",
+ (char *) NULL);
+ return TCL_ERROR;
+ }
+
argv2 = getopt_init(argc, argv);
- if (rrd_lastupdate(argc - 1, argv2, &last_update,
+ if (rrd_lastupdate_r(argv2[1], &last_update,
&ds_cnt, &ds_namv, &last_ds) == 0) {
listPtr = Tcl_GetObjResult(interp);
for (i = 0; i < ds_cnt; i++) {
}
static int Rrd_Fetch(
- ClientData clientData,
+ ClientData __attribute__((unused)) clientData,
Tcl_Interp *interp,
int argc,
CONST84 char *argv[])
static int Rrd_Graph(
- ClientData clientData,
+ ClientData __attribute__((unused)) clientData,
Tcl_Interp *interp,
int argc,
CONST84 char *argv[])
static int Rrd_Tune(
- ClientData clientData,
+ ClientData __attribute__((unused)) clientData,
Tcl_Interp *interp,
int argc,
CONST84 char *argv[])
static int Rrd_Resize(
- ClientData clientData,
+ ClientData __attribute__((unused)) clientData,
Tcl_Interp *interp,
int argc,
CONST84 char *argv[])
static int Rrd_Restore(
- ClientData clientData,
+ ClientData __attribute__((unused)) clientData,
Tcl_Interp *interp,
int argc,
CONST84 char *argv[])
diff --git a/configure.ac b/configure.ac
index 1e3da864fc80b9a508801e9bdb745090aea8f84d..2370f2166cb42d428d99b3357c8df1ed22ce6629 100644 (file)
--- a/configure.ac
+++ b/configure.ac
dnl Try to detect/use GNU features
CFLAGS="$CFLAGS -D_GNU_SOURCE"
+dnl check for -Werror separatly
+dnl (quite a few autotool checks don't work with -Werror; also, the
+dnl check for -Werror fails after checking and adding the other flags)
+AC_CACHE_CHECK([if gcc likes the -Werror flag], rd_cv_gcc_flag__Werror,
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[]], [[return 0 ]])],
+ [rd_cv_gcc_flag__Werror="yes"],
+ [rd_cv_gcc_flag__Werror="no"])])
+if test "x$rd_cv_gcc_flag__Werror" = "xyes"; then
+ WERROR="-Werror"
+else
+ WERROR=""
+fi
+AC_SUBST(WERROR)
+
dnl which flags does the compiler support?
if test "x$GCC" = "xyes"; then
for flag in -fno-strict-aliasing -Wall -std=c99 -pedantic -Wundef -Wshadow -Wpointer-arith -Wcast-align -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline -Wold-style-definition -W; do
diff --git a/src/Makefile.am b/src/Makefile.am
index 420aeab365a65bea2f92d3939c5c5178052e41cf..09bbe86c08b5e91a1cdcc9f124f69aec242779a9 100644 (file)
--- a/src/Makefile.am
+++ b/src/Makefile.am
INCLUDES = -DLOCALEDIR="\"$(datadir)/locale\""
RRD_DEFAULT_FONT=@RRD_DEFAULT_FONT@
AM_CPPFLAGS = -DRRD_DEFAULT_FONT=\"$(RRD_DEFAULT_FONT)\" -DNUMVERS=@NUMVERS@
+AM_CFLAGS = @CFLAGS@
+## no including this by default @WERROR@
UPD_C_FILES = \
rrd_parsetime.c \
librrd_th_la_SOURCES = $(UPD_C_FILES) $(RRD_C_FILES) rrd_thread_safe.c
librrd_th_la_DEPENDENCIES = librrd.sym
-librrd_th_la_CFLAGS = $(MULTITHREAD_CFLAGS)
+librrd_th_la_CFLAGS = $(AM_CFLAGS) $(MULTITHREAD_CFLAGS)
librrd_th_la_LDFLAGS = $(MULTITHREAD_LDFLAGS) -version-info @LIBVERS@
librrd_th_la_LDFLAGS += -export-symbols librrd.sym
librrd_th_la_LIBADD = $(ALL_LIBS)
diff --git a/src/rrd_client.c b/src/rrd_client.c
index 44d4d603b7df5a11208e40f0375389cc383f3c8b..76fded03830fee7346f9ee98258bff027661b29d 100644 (file)
--- a/src/rrd_client.c
+++ b/src/rrd_client.c
if (this->name != NULL)
{
- free (this->name);
+ free ((char *)this->name);
this->name = NULL;
}
free (this);
diff --git a/src/rrd_dump.c b/src/rrd_dump.c
index a32f4fb32768dd75c4ef94592b252d5c062dcffb..3f79a96ff7340463c58242cc02d3032d63d34f0a 100644 (file)
--- a/src/rrd_dump.c
+++ b/src/rrd_dump.c
extern char *tzname[2];
#endif
-
-int rrd_dump_opt_r(
+static int rrd_dump_opt_r(
const char *filename,
char *outname,
int opt_noheader)
diff --git a/src/rrd_gfx.c b/src/rrd_gfx.c
index fa938617f51ba22d763332829d062fdd20458ddf..421332f103ecfffc919726e1a7882c36c16b9089 100644 (file)
--- a/src/rrd_gfx.c
+++ b/src/rrd_gfx.c
const char *text)
{
PangoLayout *layout = im->layout;
- PangoFontDescription *pfd;
+ const PangoFontDescription *pfd;
cairo_t *cr = im->cr;
static double last_tabwidth = -1;
diff --git a/src/rrd_open.c b/src/rrd_open.c
index af91c7bb5099b72c9cb380c9d28cc6eb619c4309..af08f90008c2d5979324e00d992e9b4019601eaf 100644 (file)
--- a/src/rrd_open.c
+++ b/src/rrd_open.c
rrd_t *rrd)
{
#if defined USE_MADVISE || defined HAVE_POSIX_FADVISE
- unsigned long dontneed_start;
- unsigned long rra_start;
- unsigned long active_block;
+ off_t dontneed_start;
+ off_t rra_start;
+ off_t active_block;
unsigned long i;
ssize_t _page_size = sysconf(_SC_PAGESIZE);
diff --git a/src/rrd_xport.c b/src/rrd_xport.c
index caf23d0cb2950541d7695c115bb5d0ea5b39b3ff..225fba5587652f3de1ff17eb6210495c5462f578 100644 (file)
--- a/src/rrd_xport.c
+++ b/src/rrd_xport.c
ref_list[xport_counter++] = i;
*step_list_ptr = im->gdes[im->gdes[i].vidx].step;
printf("%s:%lu\n",im->gdes[i].legend,*step_list_ptr);
- *step_list_ptr++;
+ step_list_ptr++;
/* reserve room for one legend entry */
/* is FMT_LEG_LEN + 5 the correct size? */
if ((legend_list[j] =