vdr-2.2.0 compilation fails with gcc7

Message ID trinity-bd9be062-a689-49d3-8165-f9e84e2804d0-1488458393595@3capp-gmx-bs15
State New
Headers

Commit Message

Martin Gansser March 2, 2017, 12:39 p.m. UTC
  Thanks for your patch, but then there are further error messages:

g++ -O3 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -fPIC -Werror=overloaded-virtual -Wno-parentheses -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -fPIC -c -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -DREMOTE_KBD -DVDR_USER=\"vdr\" -DSDNOTIFY -DLIRC_DEVICE=\"/var/run/lirc/lircd\" -DVIDEODIR=\"/var/lib/vdr/video\" -DCONFDIR=\"/etc/vdr\" -DARGSDIR=\"/etc/vdr/conf.d\" -DCACHEDIR=\"/var/cache/vdr\" -DRESDIR=\"/usr/share/vdr\" -DPLUGINDIR=\"/usr/lib64/vdr\" -DLOCDIR=\"/usr/share/locale\" -I/usr/include/freetype2 -I/usr/include/libpng16    -o osdbase.o osdbase.c
osdbase.c: In member function 'eOSState cOsdMenu::HotKey(eKeys)':
osdbase.c:513:38: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
       if (s && (s = skipspace(s)) != '\0' && '0' <= s[i] && s[i] <= '9') {
                                      ^~~~
make: *** [Makefile:126: osdbase.o] Error 1

I fixed this with this patch:


it compiles fine, but I am not shure if this is correct ?
 
 

Gesendet: Donnerstag, 02. März 2017 um 11:35 Uhr
Von: "Klaus Schmidinger" <Klaus.Schmidinger@tvdr.de>
An: "VDR Mailing List" <vdr@linuxtv.org>
Betreff: Re: [vdr] vdr-2.2.0 compilation fails with gcc7
On 02.03.2017 11:25, Martin Gansser wrote:
> vdr-2.2.0 compilation fails with gcc7 on Fedora26.
> ...

This will be fixed in version 2.3.3, where I have changed "unsigned"
to "signed" in several places to avoid these problems.
Attached are the respective changes, it still applies to version 2.2.0.

Klaus
  

Comments

Klaus Schmidinger March 2, 2017, 12:44 p.m. UTC | #1
On 02.03.2017 13:39, Martin Gansser wrote:
> Thanks for your patch, but then there are further error messages:
>
> g++ -O3 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -fPIC -Werror=overloaded-virtual -Wno-parentheses -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -fPIC -c -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -DREMOTE_KBD -DVDR_USER=\"vdr\" -DSDNOTIFY -DLIRC_DEVICE=\"/var/run/lirc/lircd\" -DVIDEODIR=\"/var/lib/vdr/video\" -DCONFDIR=\"/etc/vdr\" -DARGSDIR=\"/etc/vdr/conf.d\" -DCACHEDIR=\"/var/cache/vdr\" -DRESDIR=\"/usr/share/vdr\" -DPLUGINDIR=\"/usr/lib64/vdr\" -DLOCDIR=\"/usr/share/locale\" -I/usr/include/freetype2 -I/usr/include/libpng16    -o osdbase.o osdbase.c
> osdbase.c: In member function 'eOSState cOsdMenu::HotKey(eKeys)':
> osdbase.c:513:38: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
>        if (s && (s = skipspace(s)) != '\0' && '0' <= s[i] && s[i] <= '9') {
>                                       ^~~~
> make: *** [Makefile:126: osdbase.o] Error 1
>
> I fixed this with this patch:
>
> --- a/osdbase.c.orig    2017-02-15 15:55:34.555128665 +0100
> +++ b/osdbase.c 2017-02-15 15:56:30.898068614 +0100
> @@ -510,7 +510,7 @@
>        const char *s = item->Text();
>        i = 0;
>        item_nr = 0;
> -      if (s && (s = skipspace(s)) != '\0' && '0' <= s[i] && s[i] <= '9') {
> +      if (s && (s = skipspace(s)) != NULL && '0' <= s[i] && s[i] <= '9') {
>           do {
>              item_nr = item_nr * 10 + (s[i] - '0');
>              }
>
> it compiles fine, but I am not shure if this is correct ?

 From the code itself your patch appears to be correct.
However, this is not part of plain vanilla VDR. Must have been introduced
by some other patch...

Klaus
  

Patch

--- a/osdbase.c.orig    2017-02-15 15:55:34.555128665 +0100
+++ b/osdbase.c 2017-02-15 15:56:30.898068614 +0100
@@ -510,7 +510,7 @@ 
       const char *s = item->Text();
       i = 0;
       item_nr = 0;
-      if (s && (s = skipspace(s)) != '\0' && '0' <= s[i] && s[i] <= '9') {
+      if (s && (s = skipspace(s)) != NULL && '0' <= s[i] && s[i] <= '9') {
          do {
             item_nr = item_nr * 10 + (s[i] - '0');
             }