This is the mail archive of the
ecos-patches@sourceware.org
mailing list for the eCos project.
Re: thread name made constant...
- From: Bart Veer <bartv at ecoscentric dot com>
- To: Andrew Lunn <andrew at lunn dot ch>
- Cc: ecos-patches at ecos dot sourceware dot org
- Date: Wed, 24 Dec 2008 16:35:52 +0000
- Subject: Re: thread name made constant...
- References: <20081224000825.GE28867@lunn.ch>
>>>>> "Andrew" == Andrew Lunn <andrew@lunn.ch> writes:
Andrew> I wanted to fix a compiler warning in mainthread.cxx which
Andrew> snowballed into something a bit bigger.
Andrew> Newer versions of gcc C++ compile complains about passing
Andrew> a constant string to a function which expects a char *.
Andrew> The mainthread.cxx does this:
Andrew> Cyg_Thread cyg_libc_main_thread CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_LIBC) =
Andrew> Cyg_Thread(CYGNUM_LIBC_MAIN_THREAD_PRIORITY,
Andrew> &cyg_libc_invoke_main, (CYG_ADDRWORD) 0,
Andrew> "main",
Andrew> (CYG_ADDRESS) &cyg_libc_main_stack[0],
Andrew> #ifdef CYGSEM_LIBC_MAIN_STACK_FROM_SYSTEM
Andrew> CYGNUM_LIBC_MAIN_DEFAULT_STACK_SIZE
Andrew> #else
Andrew> cyg_libc_main_stack_size
Andrew> #endif
Andrew> );
Andrew> "main" is a constant string, but Cyg_Thread() wants a char
Andrew> *. The kernel never changes the thread name, so rather
Andrew> than adding a char * cast i modified the KAPI to expect a
Andrew> const char *. This effectively changes the kernel API, so
Andrew> before i commit it i though it best to get comments.
The current plan is to make those warnings go away by adding
-Wno-write-strings to the compiler flags. I have no objections to
fixing e.g. const correctness in the kernel. However we also have an
awful lot of imported code, e.g. the TCP/IP stacks. Those may have
APIs which are not const-correct, and we really don't want to go
around fixing all of those and making future merges more difficult. I
think this may be a case where the compiler warnings are more trouble
than they are worth.
Bart
--
Bart Veer eCos Configuration Architect
eCosCentric Limited The eCos experts http://www.ecoscentric.com/
Barnwell House, Barnwell Drive, Cambridge, UK. Tel: +44 1223 245571
Registered in England and Wales: Reg No 4422071.