This is the mail archive of the ecos-patches@sourceware.org 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]

Silence [some] GCC 4.2.x warnings


GCC 4.2.0 introduced a new deprecation:
  char *s = "this is a string"
is no longer implicitly correct.

The attach patch (applied) removes some of these, at least
enough to get RedBoot to build without any warnings.

-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------
Index: infra/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/infra/current/ChangeLog,v
retrieving revision 1.58
diff -u -5 -p -r1.58 ChangeLog
--- infra/current/ChangeLog	31 May 2007 16:00:55 -0000	1.58
+++ infra/current/ChangeLog	28 Jun 2007 15:41:18 -0000
@@ -1,5 +1,10 @@
+2007-06-28  Gary Thomas  <gary@mlbassoc.com>
+
+	* src/tcdiag.cxx: 
+	* src/diag.cxx: Add (char *) casts to make GCC 4.2.x happy.
+
 2007-05-31  Rutger Hofman <rutger@cs.vu.nl>
 
 	* src/diag.cxx: when printing a long long, should not truncate
 	its value to a long or int size
 
Index: infra/current/src/diag.cxx
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/infra/current/src/diag.cxx,v
retrieving revision 1.21
diff -u -5 -p -r1.21 diag.cxx
--- infra/current/src/diag.cxx	31 May 2007 16:01:45 -0000	1.21
+++ infra/current/src/diag.cxx	28 Jun 2007 15:39:33 -0000
@@ -174,11 +174,11 @@ externC void diag_write_long_num(
     )
 {
     char buf[32];
     cyg_count8 bpos;
     char bufinit = pfzero?'0':' ';
-    char *digits = "0123456789ABCDEF";
+    char *digits = (char *)"0123456789ABCDEF";
 
     /* init buffer to padding char: space or zero */
     for( bpos = 0; bpos < (cyg_count8)sizeof(buf); bpos++ ) buf[bpos] = bufinit;
 
     /* Set pos to start */
@@ -402,31 +402,31 @@ _vprintf(void (*putc)(char c, void **par
                 switch (c) {
                 case 'd':
                 case 'D':
                 case 'u':
                 case 'U':
-                    length = _cvt(val, buf, 10, "0123456789");
+                    length = _cvt(val, buf, 10, (char *)"0123456789");
                     break;
                 case 'p':
                 case 'x':
-                    length = _cvt(val, buf, 16, "0123456789abcdef");
+                    length = _cvt(val, buf, 16, (char *)"0123456789abcdef");
                     break;
                 case 'X':
-                    length = _cvt(val, buf, 16, "0123456789ABCDEF");
+                    length = _cvt(val, buf, 16, (char *)"0123456789ABCDEF");
                     break;
                 }
                 cp = buf;
                 break;
             case 's':
             case 'S':
                 cp = va_arg(ap, char *);
                 if (cp == NULL) 
-                    cp = "<null>";
+                    cp = (char *)"<null>";
                 else if (!diag_check_string(cp)) {
                     diag_write_string("<Not a string: 0x");
                     diag_write_hex((cyg_uint32)cp);
-                    cp = ">";
+                    cp = (char *)">";
                 }
                 length = 0;
                 while (cp[length] != '\0') length++;
                 break;
             case 'c':
Index: infra/current/src/tcdiag.cxx
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/infra/current/src/tcdiag.cxx,v
retrieving revision 1.13
diff -u -5 -p -r1.13 tcdiag.cxx
--- infra/current/src/tcdiag.cxx	5 Jan 2004 21:58:24 -0000	1.13
+++ infra/current/src/tcdiag.cxx	28 Jun 2007 15:39:33 -0000
@@ -154,16 +154,16 @@ cyg_assert_msg( const char *psz_func, co
         int cur_console;
         int i;
         struct cyg_fconfig fc;
 
         cur_console = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT);
-        fc.key = "info_console_force";
+        fc.key = (char *)"info_console_force";
         fc.type = CYGNUM_FLASH_CFG_TYPE_CONFIG_BOOL;
         fc.val = (void *)&i;
         if (CYGACC_CALL_IF_FLASH_CFG_OP2(CYGNUM_CALL_IF_FLASH_CFG_GET, &fc)) {
             if (i) {
-                fc.key = "info_console_number";
+                fc.key = (char *)"info_console_number";
                 fc.type = CYGNUM_FLASH_CFG_TYPE_CONFIG_INT;
                 if (CYGACC_CALL_IF_FLASH_CFG_OP2(CYGNUM_CALL_IF_FLASH_CFG_GET, &fc)) {
                     // Then i is the console to force it to:
                     CYGACC_CALL_IF_SET_CONSOLE_COMM(i);
                 }
@@ -203,29 +203,29 @@ cyg_test_output(Cyg_test_code status, co
 {
     char *st;
 
     switch (status) {
     case CYGNUM_TEST_FAIL:
-        st = "FAIL:";
+        st = (char *)"FAIL:";
         break;
     case CYGNUM_TEST_PASS:
-        st = "PASS:";
+        st = (char *)"PASS:";
         break;
     case CYGNUM_TEST_EXIT:
-        st = "EXIT:";
+        st = (char *)"EXIT:";
         break;
     case CYGNUM_TEST_INFO:
-        st = "INFO:";
+        st = (char *)"INFO:";
         break;
     case CYGNUM_TEST_GDBCMD:
-        st = "GDB:";
+        st = (char *)"GDB:";
         break;
     case CYGNUM_TEST_NA:
-        st = "NOTAPPLICABLE:";
+        st = (char *)"NOTAPPLICABLE:";
         break;
     default:
-        st = "UNKNOWN STATUS:";
+        st = (char *)"UNKNOWN STATUS:";
         break;
     }
 
 #ifdef CYG_HAL_DIAG_LOCK
     CYG_HAL_DIAG_LOCK();
Index: error/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/error/current/ChangeLog,v
retrieving revision 1.11
diff -u -5 -p -r1.11 ChangeLog
--- error/current/ChangeLog	29 Jul 2003 20:09:58 -0000	1.11
+++ error/current/ChangeLog	28 Jun 2007 15:42:18 -0000
@@ -1,5 +1,9 @@
+2007-06-28  Gary Thomas  <gary@mlbassoc.com>
+
+	* src/strerror.cxx: Add (char *) casts to make GCC 4.2.x happy.
+
 2003-06-24  Andrew Lunn  <andrew.lunn@ascom.ch>
 
 	* include/codes.h (ENOTEMPTY): Needed by the sysctl call in the
 	freeBSD stack.
 
Index: error/current/src/strerror.cxx
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/error/current/src/strerror.cxx,v
retrieving revision 1.8
diff -u -5 -p -r1.8 strerror.cxx
--- error/current/src/strerror.cxx	23 May 2002 23:01:38 -0000	1.8
+++ error/current/src/strerror.cxx	28 Jun 2007 15:39:33 -0000
@@ -80,357 +80,357 @@ __strerror( int errnum )
     switch (errnum)
     {
 
 #ifdef ENOERR
     case ENOERR:
-        s = "No error";
+        s = (char *)"No error";
         break;
 #endif
 
 #ifdef EPERM
     case EPERM:
-        s = "Not permitted";
+        s = (char *)"Not permitted";
         break;
 #endif
 
 #ifdef ENOENT
     case ENOENT:
-        s = "No such entity";
+        s = (char *)"No such entity";
         break;
 #endif
 
 #ifdef ESRCH
     case ESRCH:
-        s = "No such process";
+        s = (char *)"No such process";
         break;
 #endif
 
 #ifdef EINTR
     case EINTR:
-        s = "Operation interrupted";
+        s = (char *)"Operation interrupted";
         break;
 #endif
 
 #ifdef EIO
     case EIO:
-        s = "I/O error";
+        s = (char *)"I/O error";
         break;
 #endif
 
 #ifdef EBADF
     case EBADF:
-        s = "Bad file handle";
+        s = (char *)"Bad file handle";
         break;
 #endif
 
 #ifdef EAGAIN
     case EAGAIN:
-        s = "Try again later";
+        s = (char *)"Try again later";
         break;
 #endif
 
 #ifdef ENOMEM
     case ENOMEM:
-        s = "Out of memory";
+        s = (char *)"Out of memory";
         break;
 #endif
 
 #ifdef EBUSY
     case EBUSY:
-        s = "Resource busy";
+        s = (char *)"Resource busy";
         break;
 #endif
 
 #ifdef ENODEV
     case ENODEV:
-        s = "No such device";
+        s = (char *)"No such device";
         break;
 #endif
 
 #ifdef ENOTDIR
     case ENOTDIR:
-        s = "Not a directory";
+        s = (char *)"Not a directory";
         break;
 #endif
 
 #ifdef EISDIR
     case EISDIR:
-        s = "Is a directory";
+        s = (char *)"Is a directory";
         break;
 #endif
 
 #ifdef EINVAL
     case EINVAL:
-        s = "Invalid argument";
+        s = (char *)"Invalid argument";
         break;
 #endif
 
 #ifdef ENFILE
     case ENFILE:
-        s = "Too many open files in system";
+        s = (char *)"Too many open files in system";
         break;
 #endif
 
 #ifdef EMFILE
     case EMFILE:
-        s = "Too many open files";
+        s = (char *)"Too many open files";
         break;
 #endif
 
 #ifdef EFBIG
     case EFBIG:
-        s = "File too large";
+        s = (char *)"File too large";
         break;
 #endif
         
 #ifdef ENOSPC
     case ENOSPC:
-        s = "No space left on device";
+        s = (char *)"No space left on device";
         break;
 #endif
 
 #ifdef ESPIPE
     case ESPIPE:
-        s = "Illegal seek";
+        s = (char *)"Illegal seek";
         break;
 #endif
         
 #ifdef EROFS
     case EROFS:
-        s = "Read-only file system";
+        s = (char *)"Read-only file system";
         break;
 #endif
         
 #ifdef EDOM
     case EDOM:
-        s = "Argument to math function outside valid domain";
+        s = (char *)"Argument to math function outside valid domain";
         break;
 #endif
 
 #ifdef ERANGE
     case ERANGE:
-        s = "Math result cannot be represented";
+        s = (char *)"Math result cannot be represented";
         break;
 #endif
 
 #ifdef EDEADLK
     case EDEADLK:
-        s = "Resource deadlock would occur";
+        s = (char *)"Resource deadlock would occur";
         break;
 #endif
 
 #ifdef ENOSYS
     case ENOSYS:
-        s = "Function not implemented";
+        s = (char *)"Function not implemented";
         break;
 #endif
 
 #ifdef ENAMETOOLONG
     case ENAMETOOLONG:
-        s = "File name too long";
+        s = (char *)"File name too long";
         break;
 #endif
         
 #ifdef ENOTSUP
     case ENOTSUP:
-        s = "Not supported";
+        s = (char *)"Not supported";
         break;
 #endif
 
 #ifdef EEOF
     case EEOF:
-        s = "End of file reached";
+        s = (char *)"End of file reached";
         break;
 #endif
 
 #ifdef ENOSUPP
     case ENOSUPP:
-        s = "Operation not supported";
+        s = (char *)"Operation not supported";
         break;
 #endif
 
 #ifdef EDEVNOSUPP
     case EDEVNOSUPP:
-        s = "Device does not support this operation";
+        s = (char *)"Device does not support this operation";
         break;
 #endif
 
 #ifdef EXDEV
     case EXDEV:
-        s = "Improper link";
+        s = (char *)"Improper link";
         break;
 #endif
         
 // Additional errors used by networking
 #ifdef ENXIO
     case ENXIO:
-        s =  "Device not configured";
+        s = (char *)"Device not configured";
         break;
 #endif
 #ifdef EACCES
     case EACCES:
-        s =  "Permission denied";
+        s = (char *)"Permission denied";
         break;
 #endif
 #ifdef EEXIST
     case EEXIST:
-        s =  "File exists";
+        s = (char *)"File exists";
         break;
 #endif
 #ifdef ENOTTY
     case ENOTTY:
-        s =  "Inappropriate ioctl for device";
+        s = (char *)"Inappropriate ioctl for device";
         break;
 #endif
 #ifdef EPIPE
     case EPIPE:
-        s =  "Broken pipe";
+        s = (char *)"Broken pipe";
         break;
 #endif
 #ifdef EINPROGRESS
     case EINPROGRESS:
-        s =  "Operation now in progress";
+        s = (char *)"Operation now in progress";
         break;
 #endif
 #ifdef EALREADY
     case EALREADY:
-        s =  "Operation already in progress";
+        s = (char *)"Operation already in progress";
         break;
 #endif
 #ifdef ENOTSOCK
     case ENOTSOCK:
-        s =  "Socket operation on non-socket";
+        s = (char *)"Socket operation on non-socket";
         break;
 #endif
 #ifdef EDESTADDRREQ
     case EDESTADDRREQ:
-        s =  "Destination address required";
+        s = (char *)"Destination address required";
         break;
 #endif
 #ifdef EMSGSIZE
     case EMSGSIZE:
-        s =  "Message too long";
+        s = (char *)"Message too long";
         break;
 #endif
 #ifdef EPROTOTYPE
     case EPROTOTYPE:
-        s =  "Protocol wrong type for socket";
+        s = (char *)"Protocol wrong type for socket";
         break;
 #endif
 #ifdef ENOPROTOOPT
     case ENOPROTOOPT:
-        s =  "Protocol not available";
+        s = (char *)"Protocol not available";
         break;
 #endif
 #ifdef EPROTONOSUPPORT
     case EPROTONOSUPPORT:
-        s =  "Protocol not supported";
+        s = (char *)"Protocol not supported";
         break;
 #endif
 #ifdef ESOCKTNOSUPPORT
     case ESOCKTNOSUPPORT:
-        s =  "Socket type not supported";
+        s = (char *)"Socket type not supported";
         break;
 #endif
 #ifdef EOPNOTSUPP
     case EOPNOTSUPP:
-        s =  "Operation not supported";
+        s = (char *)"Operation not supported";
         break;
 #endif
 #ifdef EPFNOSUPPORT
     case EPFNOSUPPORT:
-        s =  "Protocol family not supported";
+        s = (char *)"Protocol family not supported";
         break;
 #endif
 #ifdef EAFNOSUPPORT
     case EAFNOSUPPORT:
-        s =  "Address family not supported by protocol family";
+        s = (char *)"Address family not supported by protocol family";
         break;
 #endif
 #ifdef EADDRINUSE
     case EADDRINUSE:
-        s =  "Address already in use";
+        s = (char *)"Address already in use";
         break;
 #endif
 #ifdef EADDRNOTAVAIL
     case EADDRNOTAVAIL:
-        s =  "Can't assign requested address";
+        s = (char *)"Can't assign requested address";
         break;
 #endif
 #ifdef ENETDOWN
     case ENETDOWN:
-        s =  "Network is down";
+        s = (char *)"Network is down";
         break;
 #endif
 #ifdef ENETUNREACH
     case ENETUNREACH:
-        s =  "Network is unreachable";
+        s = (char *)"Network is unreachable";
         break;
 #endif
 #ifdef ENETRESET
     case ENETRESET:
-        s =  "Network dropped connection on reset";
+        s = (char *)"Network dropped connection on reset";
         break;
 #endif
 #ifdef ECONNABORTED
     case ECONNABORTED:
-        s =  "Software caused connection abort";
+        s = (char *)"Software caused connection abort";
         break;
 #endif
 #ifdef ECONNRESET
     case ECONNRESET:
-        s =  "Connection reset by peer";
+        s = (char *)"Connection reset by peer";
         break;
 #endif
 #ifdef ENOBUFS
     case ENOBUFS:
-        s =  "No buffer space available";
+        s = (char *)"No buffer space available";
         break;
 #endif
 #ifdef EISCONN
     case EISCONN:
-        s =  "Socket is already connected";
+        s = (char *)"Socket is already connected";
         break;
 #endif
 #ifdef ENOTCONN
     case ENOTCONN:
-        s =  "Socket is not connected";
+        s = (char *)"Socket is not connected";
         break;
 #endif
 #ifdef ESHUTDOWN
     case ESHUTDOWN:
-        s =  "Can't send after socket shutdown";
+        s = (char *)"Can't send after socket shutdown";
         break;
 #endif
 #ifdef ETOOMANYREFS
     case ETOOMANYREFS:
-        s =  "Too many references: can't splice";
+        s = (char *)"Too many references: can't splice";
         break;
 #endif
 #ifdef ETIMEDOUT
     case ETIMEDOUT:
-        s =  "Operation timed out";
+        s = (char *)"Operation timed out";
         break;
 #endif
 #ifdef ECONNREFUSED
     case ECONNREFUSED:
-        s =  "Connection refused";
+        s = (char *)"Connection refused";
         break;
 #endif
 #ifdef EHOSTDOWN
     case EHOSTDOWN:
-        s =  "Host is down";
+        s = (char *)"Host is down";
         break;
 #endif
 #ifdef EHOSTUNREACH
     case EHOSTUNREACH:
-        s =  "No route to host";
+        s = (char *)"No route to host";
         break;
 #endif
 
     default:
-        s = "Unknown error";
+        s = (char *)"Unknown error";
         break;
 
     } // switch
 
     CYG_REPORT_RETVAL(s);

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