Hello Pavel,

On 07/09/14 22:34, Pavel Pisa wrote:
Hello Sebastian and Joel,

On Friday 05 of September 2014 16:04:40 Sebastian Huber wrote:
On 05/09/14 15:53, Joel Sherrill wrote:
Why add these?

To be independent of Newlib.  We can also use the one in Newlib
<sys/cdefs.h>, but we should use a common macro for this stuff, since this
documents the intention and you can grep for it.

If there are not some other variants/tricks for these macros
which would be used for GCC/featured compilers, I do not feel
good about them.

They suppress relatively harmless warning which can be filterred
out by GCC options or pragmas for price of hiding serious problems
when pointer to incorrect type is used.

I think we should eventually use -Werror, so it is important to get rid of warnings. I am in favour of macros, since this makes it easier to deal with compiler dependencies.


I fought with these in my projects some years ago and I have
been motivated by actual need of RTEMS to look at my solution again
and I think that I have found solution which should help to catch
most of mistakes and suppress warning about intentional qualifiers
removal. If the solution is not too obscure for your taste, I suggest
to adapt it for RTEMS. My latest changes allow to use qualifiers
removal macro even for global variables initializers even that
there is not produced nice diagnostic message "UL_CAST_UNQX types
differ not only by volatile and const" but "critic initializer is
not constant". Each of macros, UL_CAST_UNQ1, UL_CAST_UNQ2,
or UL_CAST_UNQ3 expects pointer of reference level 1/2/3
and removes const/volatile to given depth. I have been
inspired during my attempts by libHX from Jan Engelhardt
but my solution works even for global initializers
and I think that it is even simpler in the end.

I think it would be very good to make the macros in basedefs.h more bullet proof, but I don't have a spare time budget for this at the moment.


--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to