This is the mail archive of the
mailing list for the eCos project.
Re: Fix for misc compiler warnings
On Wed, Oct 13, 2004 at 08:40:44PM -0700, David Brennan wrote:
> Yes I agree that casting i82559_heap_free to an int should be enough. I
> am using gcc 3.2.3. And I guess it is possible that the gcc folks made a
> mistake with this warning. However, I submitted this to get rid of it.
What exactly is the warning?
> Ok, the whole point of the CYG_CHECK is to protect programmers from
> themselves. And I agree tat the first check might not be necessary. But
> I am trying to get my i386-pc ide driver working on a different machine
> than my usual target. I am testing it with fs/fat/fileio1.c. If the
> mount fails, (which it currently is on my hardware), and you try and
> getcwd, you will get a SIGILL because mte->fs is null. (I originally
> thought the roblem was that mte was NULL, that is the reason the first
> is in there.) So I think there is value in the second check, but if you
> insist on removing the first, I am ok with that.
Humm. I would say you are actually checking in the wrong place. The
root problem here is that mount() failed. That probably means
virtually every other filesystem system call will then fail in some
way or other. Picking out just getcwd() for a test is not particularly
robust since most people will actually call open() next. I would say
the assert really belongs in your application checking the return code
from mount. If i were going to add an assert for mts->fs i would make
it part of LOCK_FS().
> >>Index: io/fileio/current/tests/select.c
> >>RCS file: /cvs/ecos/ecos/packages/io/fileio/current/tests/select.c,v
> >>retrieving revision 1.6
> >>diff -U5 -r1.6 select.c
> >>--- io/fileio/current/tests/select.c 11 Nov 2002 23:58:54 -0000 1.6
> >>+++ io/fileio/current/tests/select.c 13 Oct 2004 05:06:46 -0000
> >>@@ -81,10 +81,11 @@
> >>#include <unistd.h>
> >>#include <fcntl.h>
> >>#include <sys/stat.h>
> >>#include <errno.h>
> >>#include <string.h>
> >>+#include <sys/select.h> // select()
> >>#ifdef CYGPKG_NET
> >>#include <network.h>
> >>#include <arpa/inet.h>
> >>#define TEST_NET
> >Again, i don't get a warning.
> I "think" I was only getting this warning on my "NoNet" configuration.
> It could be that either network.h or arpa/inet.h is including sys/select
> for you.
I checked the man page and it suggests sys/select.h should be
included, so i will add this.