Coverity Scan on main_help.c

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Sep 17 14:16:43 UTC 2013


On 2013-09-17 16:05, Joel Sherrill wrote:
> Hi
>
> Take a peek at Issue 1063872 and 1063873. These are in main_help.c
> and I think Scan is not happy with newlib's putchar() macro. It
> increments the buffer pointer but it always ends up one past
> what you use on any given call.
>
> Since the pointer ends up pointing at something which is not
> visibly dereferenced, Scan is not happy.
>
> I think this is another intentional and OK to ignore but a
> double check is also appreciated.
>
>

The macro expansion is

int myputchar(int c)
{
  return (--(((__getreent())->_stdout))->_w < 0 ? 
(((__getreent())->_stdout))->_w >= (((__getreent())->_stdout))->_lbfsize ? 
(*(((__getreent())->_stdout))->_p = (c)), *(((__getreent())->_stdout))->_p != 
'\n' ? (int)*(((__getreent())->_stdout))->_p++ : __swbuf_r((__getreent()), 
'\n', ((__getreent())->_stdout)) : __swbuf_r((__getreent()), (int)(c), 
((__getreent())->_stdout)) : (*(((__getreent())->_stdout))->_p = (c), 
(int)*(((__getreent())->_stdout))->_p++));
}

so I would also complain ;-)

-- 
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.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the devel mailing list