* [Xenomai-core] [PATCH][SOLO] sparse fix: use NULL instead of 0
2008-04-01 10:36 [Xenomai-core] [PATCH][SOLO] add sparse support Robert Schwebel
@ 2008-04-01 10:43 ` Robert Schwebel
2008-04-01 10:44 ` [Xenomai-core] [PATCH][SOLO] sparse: clockobj_unmap not declared Robert Schwebel
` (5 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Robert Schwebel @ 2008-04-01 10:43 UTC (permalink / raw)
To: xenomai-core
Sparse has found this, fixed by the patch below:
tlsf/tlsf.c:383:51: warning: Using plain integer as NULL pointer
tlsf/tlsf.c:388:16: warning: Using plain integer as NULL pointer
tlsf/tlsf.c:467:16: warning: Using plain integer as NULL pointer
tlsf/tlsf.c:383:51: warning: Using plain integer as NULL pointer
tlsf/tlsf.c:388:16: warning: Using plain integer as NULL pointer
Signed-off-by: Robert Schwebel <r.schwebel@domain.hid>
---
base/tlsf/tlsf.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
Index: xenomai-solo/base/tlsf/tlsf.c
===================================================================
--- xenomai-solo.orig/base/tlsf/tlsf.c 2008-03-29 22:54:41.000000000 +0100
+++ xenomai-solo/base/tlsf/tlsf.c 2008-03-30 19:49:59.000000000 +0200
@@ -380,12 +380,12 @@
MIN_BLOCK_SIZE) ? MIN_BLOCK_SIZE : ROUNDUP_SIZE(sizeof(area_info_t)) | USED_BLOCK | PREV_USED;
b = (bhdr_t *) GET_NEXT_BLOCK(ib->ptr.buffer, ib->size & BLOCK_SIZE);
b->size = ROUNDDOWN_SIZE(size - 3 * BHDR_OVERHEAD - (ib->size & BLOCK_SIZE)) | USED_BLOCK | PREV_USED;
- b->ptr.free_ptr.prev = b->ptr.free_ptr.next = 0;
+ b->ptr.free_ptr.prev = b->ptr.free_ptr.next = NULL;
lb = GET_NEXT_BLOCK(b->ptr.buffer, b->size & BLOCK_SIZE);
lb->prev_hdr = b;
lb->size = 0 | USED_BLOCK | PREV_FREE;
ai = (area_info_t *) ib->ptr.buffer;
- ai->next = 0;
+ ai->next = NULL;
ai->end = lb;
return ib;
}
@@ -464,7 +464,7 @@
memset(area, 0, area_size);
ptr = tlsf->area_head;
- ptr_prev = 0;
+ ptr_prev = NULL;
ib0 = process_area(area, area_size);
b0 = GET_NEXT_BLOCK(ib0->ptr.buffer, ib0->size & BLOCK_SIZE);
--
Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
Pengutronix - Linux Solutions for Science and Industry
Handelsregister: Amtsgericht Hildesheim, HRA 2686
Hannoversche Str. 2, 31134 Hildesheim, Germany
Phone: +49-5121-206917-0 | Fax: +49-5121-206917-9
^ permalink raw reply [flat|nested] 9+ messages in thread* [Xenomai-core] [PATCH][SOLO] sparse: clockobj_unmap not declared
2008-04-01 10:36 [Xenomai-core] [PATCH][SOLO] add sparse support Robert Schwebel
2008-04-01 10:43 ` [Xenomai-core] [PATCH][SOLO] sparse fix: use NULL instead of 0 Robert Schwebel
@ 2008-04-01 10:44 ` Robert Schwebel
2008-04-01 10:44 ` [Xenomai-core] [PATCH][SOLO] sparse: threadobj_global_rr " Robert Schwebel
` (4 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Robert Schwebel @ 2008-04-01 10:44 UTC (permalink / raw)
To: xenomai-core
Sparse warns about this one:
clockobj.c:245:5: warning: symbol 'clockobj_unmap' was not declared. Should it be static?
Looks like the declaration for clockobj_unmap is missing.
Signed-off-by: Robert Schwebel <r.schwebel@domain.hid>
---
include/xenomai/clockobj.h | 2 ++
1 file changed, 2 insertions(+)
Index: xenomai-solo/include/xenomai/clockobj.h
===================================================================
--- xenomai-solo.orig/include/xenomai/clockobj.h 2008-03-30 19:53:51.000000000 +0200
+++ xenomai-solo/include/xenomai/clockobj.h 2008-03-30 19:54:04.000000000 +0200
@@ -66,6 +66,8 @@
int clockobj_destroy(struct clockobj *clkobj);
+int clockobj_unmap(struct clockobj *clkobj);
+
#ifdef __cplusplus
}
#endif
--
Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
Pengutronix - Linux Solutions for Science and Industry
Handelsregister: Amtsgericht Hildesheim, HRA 2686
Hannoversche Str. 2, 31134 Hildesheim, Germany
Phone: +49-5121-206917-0 | Fax: +49-5121-206917-9
^ permalink raw reply [flat|nested] 9+ messages in thread* [Xenomai-core] [PATCH][SOLO] sparse: threadobj_global_rr not declared
2008-04-01 10:36 [Xenomai-core] [PATCH][SOLO] add sparse support Robert Schwebel
2008-04-01 10:43 ` [Xenomai-core] [PATCH][SOLO] sparse fix: use NULL instead of 0 Robert Schwebel
2008-04-01 10:44 ` [Xenomai-core] [PATCH][SOLO] sparse: clockobj_unmap not declared Robert Schwebel
@ 2008-04-01 10:44 ` Robert Schwebel
2008-04-01 10:45 ` [Xenomai-core] [PATCH][SOLO] sparse: include panic header file Robert Schwebel
` (3 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Robert Schwebel @ 2008-04-01 10:44 UTC (permalink / raw)
To: xenomai-core
Sparse warns about this one:
clockobj.c:245:5: warning: symbol 'clockobj_unmap' was not declared. Should it be static?
Looks like the declaration for threadobj_global_rr is missing.
Signed-off-by: Robert Schwebel <r.schwebel@domain.hid>
---
include/xenomai/threadobj.h | 2 ++
1 file changed, 2 insertions(+)
Index: xenomai-solo/include/xenomai/threadobj.h
===================================================================
--- xenomai-solo.orig/include/xenomai/threadobj.h 2008-03-30 19:57:52.000000000 +0200
+++ xenomai-solo/include/xenomai/threadobj.h 2008-03-30 19:58:14.000000000 +0200
@@ -79,6 +79,8 @@
extern int threadobj_async;
+extern int threadobj_global_rr;
+
#ifdef __cplusplus
extern "C" {
#endif
--
Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
Pengutronix - Linux Solutions for Science and Industry
Handelsregister: Amtsgericht Hildesheim, HRA 2686
Hannoversche Str. 2, 31134 Hildesheim, Germany
Phone: +49-5121-206917-0 | Fax: +49-5121-206917-9
^ permalink raw reply [flat|nested] 9+ messages in thread* [Xenomai-core] [PATCH][SOLO] sparse: include panic header file
2008-04-01 10:36 [Xenomai-core] [PATCH][SOLO] add sparse support Robert Schwebel
` (2 preceding siblings ...)
2008-04-01 10:44 ` [Xenomai-core] [PATCH][SOLO] sparse: threadobj_global_rr " Robert Schwebel
@ 2008-04-01 10:45 ` Robert Schwebel
2008-04-01 10:46 ` [Xenomai-core] [PATCH][SOLO] sparse: include sysClkRateGet declaration Robert Schwebel
` (2 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Robert Schwebel @ 2008-04-01 10:45 UTC (permalink / raw)
To: xenomai-core
Sparse warns about this one:
panic.c:31:6: warning: symbol 'warning' was not declared. Should it be static?
panic.c:40:6: warning: symbol 'panic' was not declared. Should it be static?
Include the declarations.
Signed-off-by: Robert Schwebel <r.schwebel@domain.hid>
---
base/panic.c | 1 +
1 file changed, 1 insertion(+)
Index: xenomai-solo/base/panic.c
===================================================================
--- xenomai-solo.orig/base/panic.c 2008-03-30 20:51:06.000000000 +0200
+++ xenomai-solo/base/panic.c 2008-03-30 20:51:20.000000000 +0200
@@ -19,6 +19,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
+#include <xenomai/panic.h>
static void __warning(const char *fmt, va_list ap)
{
--
Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
Pengutronix - Linux Solutions for Science and Industry
Handelsregister: Amtsgericht Hildesheim, HRA 2686
Hannoversche Str. 2, 31134 Hildesheim, Germany
Phone: +49-5121-206917-0 | Fax: +49-5121-206917-9
^ permalink raw reply [flat|nested] 9+ messages in thread* [Xenomai-core] [PATCH][SOLO] sparse: include sysClkRateGet declaration
2008-04-01 10:36 [Xenomai-core] [PATCH][SOLO] add sparse support Robert Schwebel
` (3 preceding siblings ...)
2008-04-01 10:45 ` [Xenomai-core] [PATCH][SOLO] sparse: include panic header file Robert Schwebel
@ 2008-04-01 10:46 ` Robert Schwebel
2008-04-01 14:38 ` [Xenomai-core] [PATCH][SOLO] add sparse support Uwe Kleine-König
2008-04-03 9:37 ` Philippe Gerum
6 siblings, 0 replies; 9+ messages in thread
From: Robert Schwebel @ 2008-04-01 10:46 UTC (permalink / raw)
To: xenomai-core
Sparse warns about this one:
sysLib.c:22:5: warning: symbol 'sysClkRateGet' was not declared. Should it be static?
sysLib.c:28:8: warning: symbol 'sysClkRateSet' was not declared. Should it be static?
Signed-off-by: Robert Schwebel <r.schwebel@domain.hid>
---
vxworks/sysLib.c | 1 +
1 file changed, 1 insertion(+)
Index: xenomai-solo/vxworks/sysLib.c
===================================================================
--- xenomai-solo.orig/vxworks/sysLib.c 2008-03-30 21:14:49.000000000 +0200
+++ xenomai-solo/vxworks/sysLib.c 2008-03-30 21:14:54.000000000 +0200
@@ -18,6 +18,7 @@
#include "tickLib.h"
#include <vxworks/errnoLib.h>
+#include <vxworks/sysLib.h>
int sysClkRateGet(void)
{
--
Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
Pengutronix - Linux Solutions for Science and Industry
Handelsregister: Amtsgericht Hildesheim, HRA 2686
Hannoversche Str. 2, 31134 Hildesheim, Germany
Phone: +49-5121-206917-0 | Fax: +49-5121-206917-9
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [Xenomai-core] [PATCH][SOLO] add sparse support
2008-04-01 10:36 [Xenomai-core] [PATCH][SOLO] add sparse support Robert Schwebel
` (4 preceding siblings ...)
2008-04-01 10:46 ` [Xenomai-core] [PATCH][SOLO] sparse: include sysClkRateGet declaration Robert Schwebel
@ 2008-04-01 14:38 ` Uwe Kleine-König
2008-04-03 9:37 ` Philippe Gerum
6 siblings, 0 replies; 9+ messages in thread
From: Uwe Kleine-König @ 2008-04-01 14:38 UTC (permalink / raw)
To: Robert Schwebel; +Cc: xenomai-core
Hello,
Robert Schwebel wrote:
> This patch adds static analysis support with sparse to the xenomai-solo
> makefiles. To enable sparse checking, use
>
> ./configure --with-sparse[=PATH]
>
> and run 'make sparse' afterwards. I don't have a good idea right now how
> to avoid this extra step; it would be much nicer if every call to
> $(COMPILE) could be substituted by a sparse call plus the original one,
> but I didn't find a good method for that yet that also works with the
> libtool calls.
I haven't looked at it, but cgcc might help you. I don't know how it
interacts with libtool, but maybe simply:
make CC=cgcc
works?
Best regards
Uwe
--
Uwe Kleine-König, Software Engineer
Digi International GmbH Branch Breisach, Küferstrasse 8, 79206 Breisach, Germany
Tax: 315/5781/0242 / VAT: DE153662976 / Reg. Amtsgericht Dortmund HRB 13962
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [Xenomai-core] [PATCH][SOLO] add sparse support
2008-04-01 10:36 [Xenomai-core] [PATCH][SOLO] add sparse support Robert Schwebel
` (5 preceding siblings ...)
2008-04-01 14:38 ` [Xenomai-core] [PATCH][SOLO] add sparse support Uwe Kleine-König
@ 2008-04-03 9:37 ` Philippe Gerum
2008-04-04 12:22 ` Robert Schwebel
6 siblings, 1 reply; 9+ messages in thread
From: Philippe Gerum @ 2008-04-03 9:37 UTC (permalink / raw)
To: Robert Schwebel; +Cc: xenomai-core
Robert Schwebel wrote:
> This patch adds static analysis support with sparse to the xenomai-solo
> makefiles. To enable sparse checking, use
>
> ./configure --with-sparse[=PATH]
>
> and run 'make sparse' afterwards. I don't have a good idea right now how
> to avoid this extra step; it would be much nicer if every call to
> $(COMPILE) could be substituted by a sparse call plus the original one,
> but I didn't find a good method for that yet that also works with the
> libtool calls.
>
I have merged this patch series, adapting the Makefiles so that we don't need
any support from configure.in to run sparse.
Normally, you should be able to run "make [SPARSE=/path/to/sparse] sparse" to
start the analysis. Default path is "sparse".
Additionally, this now works with out of tree builds and supports mixed 32/64bit
environments.
Thanks,
> Signed-off-by: Robert Schwebel <r.schwebel@domain.hid>
>
> ---
> Makefile.am | 18 +++++++++++++++++-
> base/Makefile.am | 6 ++++++
> configure.in | 32 ++++++++++++++++++++++++++++++++
> psos/Makefile.am | 6 ++++++
> vxworks/Makefile.am | 5 +++++
> 5 files changed, 66 insertions(+), 1 deletion(-)
>
> Index: xenomai-solo/base/Makefile.am
> ===================================================================
> --- xenomai-solo.orig/base/Makefile.am 2008-03-30 21:29:12.000000000 +0200
> +++ xenomai-solo/base/Makefile.am 2008-03-30 21:29:46.000000000 +0200
> @@ -36,3 +36,9 @@
> -DTLSF_USE_LOCKS=1 -DUSE_MMAP=1 -DUSE_SBRK=1
>
> EXTRA_DIST = tlsf/README
> +
> +sparse:
> + @for i in $(libxenomai_la_SOURCES) $(libtlsf_la_SOURCES); do \
> + $(SPARSE) $(CHECKFLAGS) $$i; \
> + done
> +
> Index: xenomai-solo/configure.in
> ===================================================================
> --- xenomai-solo.orig/configure.in 2008-03-30 21:29:12.000000000 +0200
> +++ xenomai-solo/configure.in 2008-03-30 21:29:14.000000000 +0200
> @@ -70,6 +70,38 @@
> esac])
> AC_MSG_RESULT(${debug_symbols:-no})
>
> +dnl Sparse check (default: off)
> +
> +sparse=
> +AC_MSG_CHECKING(whether to enable sparse)
> +AC_ARG_WITH(sparse,
> + AC_HELP_STRING([--with-sparse@<:@=PATH@:>@], [activate static code analysis with sparse]),
> + [case "$withval" in
> + y | yes) sparse=sparse ;;
> + n | no) sparse= ;;
> + *) sparse=$withval
> + esac],
> + [sparse=],[]
> +)
> +if test -n "$sparse" ; then
> + AC_MSG_RESULT(yes)
> + AC_SUBST(SPARSE, $sparse)
> + AC_MSG_CHECKING(whether sparse=$sparse is executable)
> + if test "`$sparse 2>&1 > /dev/null; echo $?`" = "0"; then
> + AC_MSG_RESULT(yes)
> + AC_SUBST(SPARSE, $sparse)
> + else
> + AC_MSG_RESULT(no)
> + AC_MSG_ERROR($sparse is not executable)
> + fi
> +else
> + AC_MSG_RESULT(no)
> + AC_SUBST(SPARSE, true)
> +fi
> +
> +checkflags="-nostdinc -isystem \$(SYSROOT)/usr/include -isystem `$CC -print-file-name=include` -Wbitwise -Wno-transparent-union -D_GNU_SOURCE -D_XOPEN_SOURCE=500 -D_REENTRANT \$(DEFS) \$(DEFAULT_INCLUDES) \$(INCLUDES) \$(AM_CPPFLAGS) \$(CPPFLAGS)"
> +AC_SUBST(CHECKFLAGS, $checkflags)
> +
> dnl Enable assertions (default: off)
>
> AC_MSG_CHECKING(whether assertions should be enabled)
> Index: xenomai-solo/Makefile.am
> ===================================================================
> --- xenomai-solo.orig/Makefile.am 2008-03-30 21:29:12.000000000 +0200
> +++ xenomai-solo/Makefile.am 2008-03-30 21:29:14.000000000 +0200
> @@ -1,6 +1,15 @@
> ACLOCAL_AMFLAGS=-I config
>
> -SUBDIRS = base vxworks psos include config scripts
> +SRC_SUBDIRS= \
> + base \
> + vxworks \
> + psos
> +
> +SUBDIRS = \
> + $(SRC_SUBDIRS) \
> + include \
> + config \
> + scripts
>
> EXTRA_DIST =
>
> @@ -11,3 +20,10 @@
>
> install-user:
> $(MAKE) install
> +
> +sparse:
> + @for i in $(SRC_SUBDIRS); do \
> + echo; \
> + make -C $$i sparse; \
> + done
> +
> Index: xenomai-solo/psos/Makefile.am
> ===================================================================
> --- xenomai-solo.orig/psos/Makefile.am 2008-03-30 21:29:12.000000000 +0200
> +++ xenomai-solo/psos/Makefile.am 2008-03-30 21:29:14.000000000 +0200
> @@ -22,3 +22,9 @@
> -I$(top_srcdir)/include
>
> EXTRA_DIST =
> +
> +sparse:
> + @for i in $(libpsos_la_SOURCES); do \
> + $(SPARSE) $(CHECKFLAGS) $$i; \
> + done
> +
> Index: xenomai-solo/vxworks/Makefile.am
> ===================================================================
> --- xenomai-solo.orig/vxworks/Makefile.am 2008-03-30 21:29:53.000000000 +0200
> +++ xenomai-solo/vxworks/Makefile.am 2008-03-30 21:30:10.000000000 +0200
> @@ -24,3 +24,8 @@
> -I$(top_srcdir)/include
>
> EXTRA_DIST = testsuite
> +
> +sparse:
> + @for i in $(libvxworks_la_SOURCES); do \
> + $(SPARSE) $(CHECKFLAGS) $$i; \
> + done
>
--
Philippe.
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [Xenomai-core] [PATCH][SOLO] add sparse support
2008-04-03 9:37 ` Philippe Gerum
@ 2008-04-04 12:22 ` Robert Schwebel
0 siblings, 0 replies; 9+ messages in thread
From: Robert Schwebel @ 2008-04-04 12:22 UTC (permalink / raw)
To: Philippe Gerum; +Cc: xenomai-core
On Thu, Apr 03, 2008 at 11:37:31AM +0200, Philippe Gerum wrote:
> Robert Schwebel wrote:
> > This patch adds static analysis support with sparse to the xenomai-solo
> > makefiles. To enable sparse checking, use
> >
> > ./configure --with-sparse[=PATH]
> >
> > and run 'make sparse' afterwards. I don't have a good idea right now how
> > to avoid this extra step; it would be much nicer if every call to
> > $(COMPILE) could be substituted by a sparse call plus the original one,
> > but I didn't find a good method for that yet that also works with the
> > libtool calls.
> >
>
> I have merged this patch series, adapting the Makefiles so that we don't need
> any support from configure.in to run sparse.
>
> Normally, you should be able to run "make [SPARSE=/path/to/sparse] sparse" to
> start the analysis. Default path is "sparse".
>
> Additionally, this now works with out of tree builds and supports mixed 32/64bit
> environments.
Great! Thanks.
Robert
--
Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
Pengutronix - Linux Solutions for Science and Industry
Handelsregister: Amtsgericht Hildesheim, HRA 2686
Hannoversche Str. 2, 31134 Hildesheim, Germany
Phone: +49-5121-206917-0 | Fax: +49-5121-206917-9
^ permalink raw reply [flat|nested] 9+ messages in thread