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]

Re: [PATCH] Speed-up sprintf() family of functions.


On Thu, Jan 25, 2007 at 01:21:23PM +0300, Sergei Organov wrote:
> Andrew Lunn <andrew@lunn.ch> writes:
> 
> >> The updated patch is attached.
> >> 
> > Hi Sergei
> >
> > Im looking at the patch now ready for including into anoncvs. I have
> > one minor problem which needs fixing. When i compile for the linux
> > target with gcc 4.1.2 i get a warning:
> >
> > lunn@londo:~/eCos/work$ make -s
> > headers finished
> > /home/lunn/eCos/anoncvs-clean/packages/language/c/libc/stdio/current/src/common/vsnprintf.cxx: In function 'int vsnprintf(char*, size_t, const char*, char*)':
> > /home/lunn/eCos/anoncvs-clean/packages/language/c/libc/stdio/current/src/common/vsnprintf.cxx:106: warning: dereferencing type-punned pointer will break strict-aliasing rules
> > build finished
> >
> > Could you try to fix this please. Once i have a fix for this i will
> > commit your change.
> 
> I don't think it's my patch problem, as initial vsnprintf implementation
> had almost exactly the same line:
> 
>     rc = vfnprintf( (FILE *)&my_stream, size, format, arg );
> 
> and thus should have been triggering the same warning.

Humm, i checked this before i posted. And i checked again:

lunn@londo:~/eCos/anoncvs-clean/packages$ cvs up language/c/libc/stdio

So this shows i have a clean version of stdio.

lunn@londo:~/eCos/anoncvs-clean/packages$ cd ~/eCos/work/
lunn@londo:~/eCos/work$ rm -fr *
lunn@londo:~/eCos/work$ ecosconfig new linux
U CYGDBG_KERNEL_DEBUG_GDB_THREAD_SUPPORT, new inferred value 0
U CYGNUM_LIBC_MAIN_DEFAULT_STACK_SIZE, new inferred value 16384
lunn@londo:~/eCos/work$ ecosconfig tree
lunn@londo:~/eCos/work$ make -s
headers finished
/home/lunn/eCos/anoncvs-clean/packages/infra/current/src/diag.cxx: In function 'int diag_sprintf(char*, const char*, ...)':
/home/lunn/eCos/anoncvs-clean/packages/infra/current/src/diag.cxx:535: warning: dereferencing type-punned pointer will break strict-aliasing rules
/home/lunn/eCos/anoncvs-clean/packages/infra/current/src/diag.cxx: In function 'int diag_snprintf(char*, size_t, const char*, ...)':
/home/lunn/eCos/anoncvs-clean/packages/infra/current/src/diag.cxx:551: warning: dereferencing type-punned pointer will break strict-aliasing rules
/home/lunn/eCos/anoncvs-clean/packages/infra/current/src/diag.cxx: In function 'int diag_vsprintf(char*, const char*, char*)':
/home/lunn/eCos/anoncvs-clean/packages/infra/current/src/diag.cxx:565: warning: dereferencing type-punned pointer will break strict-aliasing rules
/home/lunn/eCos/anoncvs-clean/packages/kernel/current/src/sync/mbox.cxx: In member function 'void* Cyg_Mbox::get()':
/home/lunn/eCos/anoncvs-clean/packages/kernel/current/src/sync/mbox.cxx:114: warning: 'p' is used uninitialized in this function
cc1: warning: command line option "-Woverloaded-virtual" is valid for C++/ObjC++ but not for C
cc1: warning: command line option "-fno-rtti" is valid for C++/ObjC++ but not for C
build finished

There are no warnings from stdio files.

lunn@londo:~/eCos/work$ cd ~/eCos/anoncvs-clean/packages/
lunn@londo:~/eCos/anoncvs-clean/packages$ patch -p1 < ~/ecos_sprintf_speedup.patch 
patching file language/c/libc/stdio/current/ChangeLog
patching file language/c/libc/stdio/current/include/stream.hxx
patching file language/c/libc/stdio/current/src/common/stream.cxx
patching file language/c/libc/stdio/current/src/common/vsnprintf.cxx
patching file language/c/libc/stdio/current/src/output/vfnprintf.cxx
lunn@londo:~/eCos/anoncvs-clean/packages$ cd ~/eCos/work/
lunn@londo:~/eCos/work$ rm -fr *
lunn@londo:~/eCos/work$ ecosconfig new linux 
U CYGDBG_KERNEL_DEBUG_GDB_THREAD_SUPPORT, new inferred value 0
U CYGNUM_LIBC_MAIN_DEFAULT_STACK_SIZE, new inferred value 16384
lunn@londo:~/eCos/work$ ecosconfig tree
lunn@londo:~/eCos/work$ make -s
headers finished
/home/lunn/eCos/anoncvs-clean/packages/infra/current/src/diag.cxx: In function 'int diag_sprintf(char*, const char*, ...)':
/home/lunn/eCos/anoncvs-clean/packages/infra/current/src/diag.cxx:535: warning: dereferencing type-punned pointer will break strict-aliasing rules
/home/lunn/eCos/anoncvs-clean/packages/infra/current/src/diag.cxx: In function 'int diag_snprintf(char*, size_t, const char*, ...)':
/home/lunn/eCos/anoncvs-clean/packages/infra/current/src/diag.cxx:551: warning: dereferencing type-punned pointer will break strict-aliasing rules
/home/lunn/eCos/anoncvs-clean/packages/infra/current/src/diag.cxx: In function 'int diag_vsprintf(char*, const char*, char*)':
/home/lunn/eCos/anoncvs-clean/packages/infra/current/src/diag.cxx:565: warning: dereferencing type-punned pointer will break strict-aliasing rules
/home/lunn/eCos/anoncvs-clean/packages/kernel/current/src/sync/mbox.cxx: In member function 'void* Cyg_Mbox::get()':
/home/lunn/eCos/anoncvs-clean/packages/kernel/current/src/sync/mbox.cxx:114: warning: 'p' is used uninitialized in this function
/home/lunn/eCos/anoncvs-clean/packages/language/c/libc/stdio/current/src/common/
vsnprintf.cxx: In function 'int vsnprintf(char*, size_t, const char*, char*)':
/home/lunn/eCos/anoncvs-clean/packages/language/c/libc/stdio/current/src/common/
vsnprintf.cxx:106: warning: dereferencing type-punned pointer will break strict-
aliasing rules
cc1: warning: command line option "-Woverloaded-virtual" is valid for C++/ObjC++
 but not for C
cc1: warning: command line option "-fno-rtti" is valid for C++/ObjC++ but not fo
r C
build finished

Now there is a warning....

    Andrew


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