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

Major misuse of cyg_bool ?


While trying to compile the latest CVS sources of eCos, I ran into
what I think is a major misunderstanding of the C/C++ type system:

cyg_bool is defined as 'typedef int cyg_bool_t;' in kapi.h. As far
as I understand C/C++ type rules, this does not make cyg_bool_t a valid
synonym for int, yet eCos source code uses it that way, for instance in

/data/erdo/ecos-release/ecos-2.0/packages/io/serial/v2_0/src/common/serial.c:68: warning: a value of type "Cyg_ErrNo (*)(cyg_io_handle_t, cyg_uint32, CYG_ADDRWORD)" cannot be used to initialize an entity of type "cyg_bool (*)(cyg_io_handle_t, cyg_uint32, CYG_ADDRWORD)"
/data/erdo/ecos-release/ecos-2.0/packages/io/serial/v2_0/src/common/serial.c:493: error: declaration is incompatible with "Cyg_ErrNo serial_select(cyg_io_handle_t, cyg_uint32, CYG_ADDRWORD)" (declared at line 64)


Note that the compiler I use for my hardware platform is a vendor-specific compiler that is mostly compatible to gcc (compatible
enough to compile a pre-release version of 2.0 eCos and 2.2 Linux), so
this may just be a warning when compiled with gcc. However, I still
think this is a bug, since any compiler warning is indication of sloppy
programming and should be fixed.


Since the same error occurs with the 2.0 release version of eCos,
I'm wondering if I'm missing something obvious to everyone else or
if this is something that should be fixed ?
--
--------------------------------------------------------------------
|     Eric Doenges              |     DynaPel Laboratories GmbH    |
|     Tel: +49 89 962428 23     |     Fraunhoferstrasse 9/2        |
|     Fax: +49 89 962428 90     |     D - 85737 Ismaning, Germany  |
--------------------------------------------------------------------


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


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