change log for rtems (2010-11-04)

Joel Sherrill joel.sherrill at OARcorp.com
Fri Nov 5 13:49:06 UTC 2010


On 11/05/2010 02:27 AM, Sebastian Huber wrote:
> On 11/05/2010 12:11 AM, rtems-vc at rtems.org wrote:
> [...]
>> diff -u rtems/cpukit/ChangeLog:1.2641 rtems/cpukit/ChangeLog:1.2642
>> --- rtems/cpukit/ChangeLog:1.2641	Thu Nov  4 17:22:48 2010
>> +++ rtems/cpukit/ChangeLog	Thu Nov  4 18:00:04 2010
>> @@ -1,5 +1,11 @@
>>   2010-11-04	Joel Sherrill<joel.sherrill at oarcorp.com>
>>
>> +	* libmisc/stackchk/check.c: Make compile again.
>> +	* sapi/src/io.c, score/src/heap.c: Address dead assignment
>> +	issues found by clang.
>> +
> [...]
>> diff -u rtems/cpukit/score/src/heap.c:1.39 rtems/cpukit/score/src/heap.c:1.40
>> --- rtems/cpukit/score/src/heap.c:1.39	Wed Aug 25 07:35:52 2010
>> +++ rtems/cpukit/score/src/heap.c	Thu Nov  4 18:00:04 2010
>> @@ -416,7 +416,6 @@
>>       uintptr_t const prev_block_size = _Heap_Block_size( prev_block );
>>
>>       block = prev_block;
>> -    block_begin = (uintptr_t) block;
>>       block_size += prev_block_size;
>>     }
> Yes, this assignment has no effect on the generated code.  It was provided for
> consistency.  The three variables belong to one entity (which clang cannot
> know).  After these three assignment the three variables are in a consistent
> state.  If you omit the block_begin assignment this is not the case.  Its a
> style question which variant you prefer.
>
Hmmm.. then you deliberately wrote dead code.  :D

Dead code is not allowed for various validation standards.  How about
I re-add the line, comment it out, and add your comment above the
code?

FWIW clang and coverity see memory leaks where something is malloc'ed
then put on a chain.  I have been adding comments to indicate that the
malloc'ed memory is placed on the chain and will be freed later.  I think
this type of comment is important so someone in the future reading the
code will know what the intent was.

--joel


-- 
Joel Sherrill, Ph.D.             Director of Research&  Development
joel.sherrill at OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
    Support Available             (256) 722-9985





More information about the vc mailing list