[libdvbpsi-devel] Compilation of libdvbpsi fails on GCC 5.1.0 with --enable-debug

Jean-Paul Saman jpsaman at videolan.org
Wed May 27 09:27:26 CEST 2015


On Tue, May 26, 2015 at 10:35 PM, Daniel Kamil Kozar <dkk089 at gmail.com>
wrote:

> Hello all,
> Compilation of libdvbpsi with GCC 5.1.0 fails due to the following error :
>
> test_dr.c: In function ‘main_vstream_1’:
> test_dr.h:106:39: error: comparison of constant ‘12’ with boolean
> expression is always true [-Werror=bool-compare]
>      } while(!i_err && (s_decoded.name <= 12));                          \
>                                        ^
> test_dr.c:49:3: note: in expansion of macro ‘BOZO_end_boolean’
>    BOZO_end_boolean(b_multiple_frame_rate)
>    ^
>
> I have to admit that I don't fully understand the intention of the
> original code. The macro, when expanded, yields the following result :
>
>   s_decoded.b_multiple_frame_rate += 12;
> } while(!i_err && (s_decoded.b_multiple_frame_rate <= 12));
>
>
Indeed this does not look correct. Question is should b_multiple_frame_rate
be a boolean or is it supposed to be an integer?


> Where 'b_multiple_frame_rate' is a variable of type bool. Compiling
> the code with -Werror disabled causes the code to be compiled into an
> infinite loop.
>
> What is the intention of incrementing a bool value by 12 and then
> comparing that bool with an integer value?
>

It is test code from the early days of libdvbpsi and has had no attention
for a long time.
I guess what happened is that b_multiple_frame_rate was declared as an
integer initially
and that at some point that definition was changed into a boolean (because
of the prefix).
That introduced the mention issue, of course.

Increasing the boolean by 12 suggest it is supposed to be an integer iso an
boolean. If that
is the case then the variable name is misleading. Or the test is wrong and
it should have been
a boolean all along.

Can you look into that?

>
> Kind regards,
> Daniel
> _______________________________________________
> libdvbpsi-devel mailing list
> libdvbpsi-devel at videolan.org
> https://mailman.videolan.org/listinfo/libdvbpsi-devel
>

Kind regards,
Jean-Paul Saman.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/libdvbpsi-devel/attachments/20150527/46f5ae41/attachment.html>


More information about the libdvbpsi-devel mailing list