This is the mail archive of the ecos-discuss@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]

Mystifying error with C++ exception specifications


I'm trying to use C++ exceptions with the eCosCentric version of eCos, which
includes support for thread-safe exceptions. Normally, the kernel is still
compiled with -fno-exceptions, and only the application code has
-fexceptions specified. To allow exceptions to propagate from callbacks, I
tried -fexceptions in the kernel, and got a strange error which I can't
figure out. When compiling sprintf.cxx, it barfs, saying:

<blahblah>/packages/language/c/libc/stdio/v2_0_41/src/common/sprintf.cxx: 
   In function `int sprintf(char*, const char*, ...)':
<blahblah>/packages/language/c/libc/stdio/v2_0_41/src/common/sprintf.cxx:69:

   error: declaration of `int sprintf(char*, const char*, ...) throw ()' 
   throws different exceptions
<blahblah>/include/cyg/libc/stdio/stdio.h:177: error: 
   than previous declaration `int sprintf(char*, const char*, ...)'

In the source code, both the declaration in stdio.h and the definition in
sprintf.cxx use the __THROW macro. This is in turn defined in
cyg/infra/cyg_type.h as follows:

#ifdef __cplusplus
# define __THROW throw()
#else
# define __THROW
#endif

What I don't understand is how this could expand to "throw()" when parsing
the top level source file, but expand to nothing when parsing the included
header file.

The immediately preceding file, which compiles successfully, is
snprintf.cxx, which is almost identical. The only difference I see is that
the snprintf declaration in stdio.h follows the __THROW with
CYGBLD_ATTRIB_PRINTF_FORMAT(3, 4). Does this smell like a compiler bug? I'm
using eCosCentric's arm-elf-gdb 3.3.3.

-- 

Ciao,               Paul D. DeRocco
Paul                mailto:pderocco@ix.netcom.com


--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


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