Fix for misc compiler warnings

Andrew Lunn andrew@lunn.ch
Wed Oct 13 21:10:00 GMT 2004


On Wed, Oct 13, 2004 at 05:51:06AM -0700, David Brennan wrote:
> I'm not sure if each of these is specifically correct. But they got rid 
> of some of the compiler warnings/errors with my particular configurations.
> 
> David Brennan
> 
> 
> Index: devs/eth/intel/i82559/current/src/if_i82559.c
> ===================================================================
> RCS file: 
> /cvs/ecos/ecos/packages/devs/eth/intel/i82559/current/src/if_i82559.c,v
> retrieving revision 1.27
> diff -U5 -r1.27 if_i82559.c
> --- devs/eth/intel/i82559/current/src/if_i82559.c    12 Aug 2004 
> 13:01:16 -0000    1.27
> +++ devs/eth/intel/i82559/current/src/if_i82559.c    13 Oct 2004 
> 05:05:10 -0000
> @@ -1109,20 +1109,18 @@
> {
>     void *p_memory;
>     int _size = size;
> 
>     CYG_ASSERT(
> -        (CYGHWR_INTEL_I82559_PCI_MEM_MAP_BASE <= (int)i82559_heap_free)
> +        ((cyg_uint8 *)CYGHWR_INTEL_I82559_PCI_MEM_MAP_BASE <= 
> i82559_heap_free)
>         &&
> -        ((CYGHWR_INTEL_I82559_PCI_MEM_MAP_BASE +
> -          CYGHWR_INTEL_I82559_PCI_MEM_MAP_SIZE) > (int)i82559_heap_free)
> -        &&
> -        (0 < i82559_heap_size)
> +        ((cyg_uint8 *)(CYGHWR_INTEL_I82559_PCI_MEM_MAP_BASE +
> +          CYGHWR_INTEL_I82559_PCI_MEM_MAP_SIZE) > i82559_heap_free)
>         &&
>         (CYGHWR_INTEL_I82559_PCI_MEM_MAP_SIZE >= i82559_heap_size)
>         &&
> -        (CYGHWR_INTEL_I82559_PCI_MEM_MAP_BASE == (int)i82559_heap_base),
> +        ((cyg_uint8 *)CYGHWR_INTEL_I82559_PCI_MEM_MAP_BASE == 
> i82559_heap_base),
>         "Heap variables corrupted" );
> 
>     p_memory = (void *)0;
>     size = (size + 3) & ~3;
>     if ( (i82559_heap_free+size) < (i82559_heap_base+i82559_heap_size) ) {

What version of GCC are you using. I don't get warnings in the
ethernet driver. The code looks OK to me
too. CYGHWR_INTEL_I82559_PCI_MEM_MAP_* will be int so casting
i82559_heap_free to int should be enough.

> Index: io/fileio/current/src/file.cxx
> ===================================================================
> RCS file: /cvs/ecos/ecos/packages/io/fileio/current/src/file.cxx,v
> retrieving revision 1.10
> diff -U5 -r1.10 file.cxx
> --- io/fileio/current/src/file.cxx    15 Mar 2004 15:41:36 -0000    1.10
> +++ io/fileio/current/src/file.cxx    13 Oct 2004 05:06:45 -0000
> @@ -570,10 +599,13 @@
>     }
>        
>     info.buf = buf;
>     info.size = size;
> 
> +    CYG_CHECK_DATA_PTR(mte,"Invalid MTAB entry for current directory");
> +    CYG_CHECK_DATA_PTR(mte->fs,"Invalid File System entry for current 
> directory");
> +
>     LOCK_FS( mte );
>    
>     err = mte->fs->getinfo( mte, dir, "",
>                             FS_INFO_GETCWD, (char *)&info, sizeof(info) );

This does not really fit. LOCK_FS already checks mte. I get the
feeling this is just leftover from debugging a problem you had at some
time.

> 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. 

> Index: io/pci/current/src/pci.c
> ===================================================================
> RCS file: /cvs/ecos/ecos/packages/io/pci/current/src/pci.c,v
> retrieving revision 1.21
> diff -U5 -r1.21 pci.c
> --- io/pci/current/src/pci.c    31 Aug 2004 20:22:15 -0000    1.21
> +++ io/pci/current/src/pci.c    13 Oct 2004 05:06:48 -0000
> @@ -63,10 +63,14 @@
> #ifdef CYG_PCI_PRESENT
> 
> #include <cyg/io/pci.h>
> #include <cyg/infra/cyg_ass.h>
> 
> +#ifdef CYGPKG_IO_PCI_DEBUG
> +#include <cyg/infra/diag.h>     // diag_printf
> +#endif // CYGPKG_IO_PCI_DEBUG
> +

There is no need for this to be conditional. 

Attached is the parts of the patch i have committed.

        Thanks
                Andrew
-------------- next part --------------
Index: fs/fat/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/fs/fat/current/ChangeLog,v
retrieving revision 1.2
diff -u -r1.2 ChangeLog
--- fs/fat/current/ChangeLog	5 Oct 2004 07:45:58 -0000	1.2
+++ fs/fat/current/ChangeLog	13 Oct 2004 21:08:27 -0000
@@ -1,3 +1,8 @@
+2004-10-06  David Brennan  <eCos@brennanhome.com>
+
+	* tests/fileio1.c: Added include of <stdio.h> to fix compiler
+	warning for rename().
+
 2004-08-10  Savin Zlobec  <savin@elatec.si>
 
         * src/fatfs.h:
Index: fs/fat/current/tests/fileio1.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/fs/fat/current/tests/fileio1.c,v
retrieving revision 1.1
diff -u -r1.1 fileio1.c
--- fs/fat/current/tests/fileio1.c	19 Jan 2004 14:35:02 -0000	1.1
+++ fs/fat/current/tests/fileio1.c	13 Oct 2004 21:08:27 -0000
@@ -71,6 +71,7 @@
 #include <errno.h>
 #include <string.h>
 #include <dirent.h>
+#include <stdio.h>
 
 #include <cyg/fileio/fileio.h>
 
Index: io/fileio/current/tests/pselect.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/fileio/current/tests/pselect.c,v
retrieving revision 1.2
diff -u -r1.2 pselect.c
--- io/fileio/current/tests/pselect.c	8 Mar 2003 03:36:32 -0000	1.2
+++ io/fileio/current/tests/pselect.c	13 Oct 2004 21:08:39 -0000
@@ -61,6 +61,8 @@
 # define NA_MSG "POSIX threads needed to run test"
 #elif !defined CYGPKG_NET
 # define NA_MSG "NET package needed to run test"
+#elif !defined CYGPKG_POSIX_SIGNALS
+# define NA_MSG "POSIX signals package needed to run test"
 #endif
 
 #include <cyg/infra/testcase.h>
Index: io/pci/current/src/pci.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/pci/current/src/pci.c,v
retrieving revision 1.21
diff -u -r1.21 pci.c
--- io/pci/current/src/pci.c	31 Aug 2004 20:22:15 -0000	1.21
+++ io/pci/current/src/pci.c	13 Oct 2004 21:08:41 -0000
@@ -64,6 +64,7 @@
 
 #include <cyg/io/pci.h>
 #include <cyg/infra/cyg_ass.h>
+#include <cyg/infra/diag.h>
 
 static cyg_bool cyg_pci_lib_initialized = false;
 static CYG_PCI_ADDRESS64 cyg_pci_memory_base;


More information about the Ecos-patches mailing list