This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix for misc compiler warnings


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

Attachment: warnings.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]