[PATCH v3] score: PR1607: Add and use CPU_SIZEOF_POINTER

Ralf Corsepius ralf.corsepius at rtems.org
Thu Nov 8 10:33:41 UTC 2012


On 11/08/2012 11:02 AM, Sebastian Huber wrote:
> On 11/08/2012 10:33 AM, Ralf Corsepius wrote:
>> On 11/08/2012 09:27 AM, Sebastian Huber wrote:
>>> Add and use new CPU port define CPU_SIZEOF_POINTER.  It must be an
>>> integer literal that can be used by the assembler.  This value will be
>>> used to calculate offsets of structure members.  These offsets will be
>>> used in assembler code.
>>>
>>> The size of a pointer is part of the application binary interface (ABI)
>>> and thus independent of the actual programming language.  The compiler
>>> will provide defines to determine the current ABI.  We use these 
>>> defines
>>> to select the appropriate CPU_SIZEOF_POINTER value.
>>>
>>> Static assertions in the new file "cpukit/score/src/percpuasm.c" will
>>> ensure that the value of CPU_SIZEOF_POINTER is consistent with the
>>> current compiler settings.  Also the offset values used by assembler
>>> code are verfied.
> [...]
>> It's just a random accident it appears to work for some targets.
> [...]
>
> In particular I am interested to know how you justify "random 
> accident" if you look at the static assertions.
>
random accident here means: You didn't notice your design's flaw, 
because your "usual cases" do not exhibit this behavior.

The static_assert is just a naive sillyness - It's just absurd.

Ralf




More information about the devel mailing list