From: Philippe Gerum <rpm@xenomai.org>
To: Robert Schwebel <r.schwebel@domain.hid>
Cc: xenomai-core <xenomai@xenomai.org>
Subject: Re: [Xenomai-core] [PATCH][SOLO] add more warnings
Date: Fri, 28 Mar 2008 20:52:26 +0100 [thread overview]
Message-ID: <47ED4C7A.8070809@domain.hid> (raw)
In-Reply-To: <20080328190310.GB9009@domain.hid>
Robert Schwebel wrote:
> Contrary to what one would assume, -Wall doesn't warn on everything. It
> turned out to add a few more options, like -Wsign-compare, -Wfloat-equal
> and -Wformat-security, which is what the patch below does.
>
> When running with these options, we get the following warnings:
>
> kernelLib.c: In function 'kernelInit':
> kernelLib.c:63: warning: comparison between signed and unsigned
> msgQLib.c: In function 'msgQReceive':
> msgQLib.c:165: warning: comparison between signed and unsigned
> msgQLib.c: In function 'msgQSend':
> msgQLib.c:227: warning: comparison between signed and unsigned
> msgQLib.c:237: warning: comparison between signed and unsigned
> taskLib.c: In function 'taskSpawn':
> taskLib.c:382: warning: signed and unsigned type in conditional expression
> pt.c: In function 'get_pt_from_id':
> pt.c:56: warning: comparison between signed and unsigned
> pt.c:58: warning: comparison between signed and unsigned
> queue.c: In function 'get_queue_from_id':
> queue.c:49: warning: comparison between signed and unsigned
> queue.c: In function '__q_send':
> queue.c:224: warning: comparison between signed and unsigned
> queue.c: In function '__q_broadcast':
> queue.c:311: warning: comparison between signed and unsigned
> queue.c: In function '__q_receive':
> queue.c:365: warning: comparison between signed and unsigned
> rn.c: In function 'get_rn_from_id':
> rn.c:41: warning: comparison between signed and unsigned
> sem.c: In function 'get_sem_from_id':
> sem.c:41: warning: comparison between signed and unsigned
> task.c: In function 'find_psos_task':
> task.c:54: warning: comparison between signed and unsigned
> task.c: In function 'find_psos_task_or_self':
> task.c:86: warning: comparison between signed and unsigned
> task.c: In function 'get_psos_task':
> task.c:110: warning: comparison between signed and unsigned
> task.c: In function 'get_psos_task_or_self':
> task.c:131: warning: comparison between signed and unsigned
> task.c:140: warning: comparison between signed and unsigned
> task.c: In function 'check_task_priority':
> task.c:232: warning: comparison between signed and unsigned
> tm.c: In function 'get_tm_from_id':
> tm.c:43: warning: comparison between signed and unsigned
>
> I've looked into the first ones only yet and it looks to me like the
> type definitions have to be reviewed carefully. For example, TASK_ID is
> defined to be unsigned long, whereas the vxworks documentation [1] looks
> more like if we need 'int' there. Which also makes me wonder if vxworks
> has a special idea about what 'int' is;
VxWorks assumes 32bit and sizeof(void *) == sizeof(int), unfortunately. See
taskSpawn() for instance.
guessing from [2] it looks like
> it assumes sint32_t, so in order to fix this on 64 bit boxes, shouldn't
> these cases be converted to use the inttypes.h definitions?
>
Did you mean stdint.h? What we need is an integer type which is able to carry a
pointer on 32/64bit platforms, so we should rather use intptr_t I guess, as per
C99, which expands as a long type. Object ids as unsigned long is a left over
from the co-kernel version, where we use actual integer handles returned from
kernel space, and not pointers in disguise. Will fix, thanks.
> However, somebody with more vxworks knowledge than myself should have a
> look at this.
>
> Signed-off-by: Robert Schwebel <r.schwebel@domain.hid>
>
> [1] http://spacegrant.colorado.edu/~dixonc/vxworks/docs/vxworks/ref/taskLib.html#taskActivate
> [2] http://www.xs4all.nl/~borkhuis/vxworks/vxw_pt6.html
>
> ---
> configure.in | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
Merged, thanks.
> Index: xenomai-solo/configure.in
> ===================================================================
> --- xenomai-solo.orig/configure.in 2008-03-28 19:17:23.000000000 +0100
> +++ xenomai-solo/configure.in 2008-03-28 19:19:15.000000000 +0100
> @@ -163,7 +163,8 @@
> dnl Exported CFLAGS and LDFLAGS
> XENO_USER_APP_CFLAGS=$XENO_USER_CFLAGS
> XENO_USER_APP_LDFLAGS=$XENO_USER_LDFLAGS
> -XENO_USER_CFLAGS="$XENO_USER_CFLAGS -Wall -pipe -fstrict-aliasing $gcc_w_noalias"
> +XENO_USER_CFLAGS="$XENO_USER_CFLAGS -Wall -Wsign-compare -Wfloat-equal -Wformat-security"
> +XENO_USER_CFLAGS="$XENO_USER_CFLAGS -pipe -fstrict-aliasing $gcc_w_noalias"
>
> if test x$debug_symbols = xy; then
> XENO_USER_CFLAGS="-g -O0 $XENO_USER_CFLAGS -D__SOLO_DEBUG__"
>
--
Philippe.
next prev parent reply other threads:[~2008-03-28 19:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-28 19:03 [Xenomai-core] [PATCH][SOLO] add more warnings Robert Schwebel
2008-03-28 19:52 ` Philippe Gerum [this message]
2008-03-28 20:26 ` Philippe Gerum
2008-03-28 20:46 ` Robert Schwebel
2008-03-28 23:06 ` Wolfgang Denk
2008-03-29 8:32 ` Philippe Gerum
2008-03-28 20:14 ` Philippe Gerum
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47ED4C7A.8070809@domain.hid \
--to=rpm@xenomai.org \
--cc=r.schwebel@domain.hid \
--cc=xenomai@xenomai.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.