From: mrs@cygnus.com (Mike Stump)
Subject: Re:  Compiler error in "?: " and fprintf.
Organization: GNUs Not Usenet
Distribution: gnu
Date: Tue, 15 Sep 1992 07:43:55 GMT

This problem should not exist in the next release of gcc.

To compile InterViews 3.1 beta2 you might want to grab gcc.xtar.Z in
pub/contrib/g++@interviews.stanford.edu as it is known to compile
InterViews 3.1 beta2 with nominal patches to IV.

> From: ebubra@anah.ericsson.com (Bertil Askelid 6344)
> Date: Tue, 16 Jun 92 17:50:28 PDT
> Message-Id: <9206170050.AA00997@proton.ebu.ericsson.se>
> To: bug-g++@prep.ai.mit.edu
> Reply-To: ebubra@anah.ericsson.com (Bertil Askelid)
> Organization: Ericsson Business Communications, Anaheim, California

>    [this is the first time I send a bug report to you. If you need more
>    information, please let me know.]

>    I am trying to compile InterViews-3.0.1 (with usual patches applied)
>    on a Sparc-IPX running SunOs 4.1.1 using gcc-2.2.2 and libg++-2.1. I
>    get the following errors. The first error can easily be circumvented
>    by using an "if" instead, but the second one looks more tricky. 
>    
> g++    -Dcplusplus_2_1 -Div2_6_compatible   -I../../../.././src/include/InterViews/2.6 -I../../../.././src/include/IV-look/2.6 -I../../../.././src/include -I/home/springfield0/ebubra/Verktyg/X11/include    -c ../catcmds.c
> ./catcmds.c: In method `void  ViewCompCmd::Execute ()':
> ./catcmds.c:271: assignment between incompatible pointer types

>       .../iv/src/lib/Unidraw/catcmds.c:
>          ...
>          void ViewCompCmd::Execute () {
>             ...
>             const char* domain = unidraw->GetCatalog()->GetAttribute("domain");
> -271->      domain = (domain == nil) ? "component" : domain;
>             ...

>    This looks like a COMPILER ERROR to me -- it worked for gcc-2.1 and
>    libg++-2.0 ! 
>       
> g++    -Dcplusplus_2_1 -Div2_6_compatible   -I../../../.././src/include/InterViews/2.6 -I../../../.././src/include/IV-look/2.6 -I../../../.././src/include -I/home/springfield0/ebubra/Verktyg/X11/include    -c ../idcatalog.c
> ./idcatalog.c: In method `class GraphicComp* IdrawCatalog::ReadPostScript (class istream&)':
> ./idcatalog.c:178: warning: implicit declaration of function `fprintf'
> ./idcatalog.c:178: `stderr' undeclared (first use this function)
> ./idcatalog.c:178: (Each undeclared identifier is reported only once
> ./idcatalog.c:178: for each function it appears in.)
> ./idcatalog.c: In method `void  IdrawCatalog::PSReadChildren (class istream&, class GraphicComp*)':
> ./idcatalog.c:266: `stderr' undeclared (first use this function)
> ./idcatalog.c: In method `void  IdrawCatalog::PSReadPattern (class istream&, class Graphic*)':
> ./idcatalog.c:658: warning: implicit declaration of function `sscanf'
> *** Error code 1

>    .../iv/src/bin/idraw/idcatalog.c:
>       ...
>       GraphicComp* IdrawCatalog::ReadPostScript (istream& in) {
>           Skip(in);
>           in >> _buf >> _psversion;

>           if (_psversion > PSV_LATEST) {
> -178->        fprintf(stderr, "warning: drawing version %d ", _psversion);
>               fprintf(stderr, "newer than idraw version %d\n", PSV_LATEST);
>           }
>          ...
>          
>       void IdrawCatalog::PSReadChildren (istream& in, GraphicComp* comp) {
>          ...
> -266->   fprintf(stderr, "unknown graphical object %s, skipping\n", _buf);
>          ...
>          
>       void IdrawCatalog::PSReadPattern (istream& in, Graphic* gs) {
>          ...
>          if (!undefined && !none && graylevel != -1) {
>              if (_psversion >= PSV_FGANDBGCOLOR) {
>             in >> graylevel;
>              } else {
>             in >> data[0];
>             graylevel = CalcGrayLevel(data[0]);
>              }
>          } else if (graylevel == -1) {
>              for (int i = 0; in >> _buf && i < patternHeight; i++) {
> -658->            if (_buf[0] == '>' || sscanf(_buf, "%x", &data[i]) != 1) {
>                 break;
>             }
>              }
>              if (_buf[0] == '>') {
>             size = i;
>              } else {
>             undefined = true;
>              }
>          }
>          ...

Newsgroups: gnu.g++.bug