- 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
require 'mkmf'
+$CFLAGS += '-Wall'
+
if /linux/ =~ RUBY_PLATFORM
$LDFLAGS += '-Wl,--rpath -Wl,$(EPREFIX)/lib'
elsif /solaris/ =~ RUBY_PLATFORM
#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;
}
VERSION = @VERSION@
AM_CFLAGS = @CFLAGS@
+### no including this by default @WERROR@
TCL_PREFIX = @TCL_PREFIX@
TCL_SHLIB_LD = @TCL_SHLIB_LD@
/* 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[])
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
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)
if (this->name != NULL)
{
- free (this->name);
+ free ((char *)this->name);
this->name = NULL;
}
free (this);
extern char *tzname[2];
#endif
-
-int rrd_dump_opt_r(
+static int rrd_dump_opt_r(
const char *filename,
char *outname,
int opt_noheader)
const char *text)
{
PangoLayout *layout = im->layout;
- PangoFontDescription *pfd;
+ const PangoFontDescription *pfd;
cairo_t *cr = im->cr;
static double last_tabwidth = -1;
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);
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] =