CalculiX build error using clang

Joshua Root jmr at macports.org
Tue Jul 26 20:19:16 UTC 2022


On 2022-7-27 05:59 , Mark Brethen wrote:
> Only 1 instance found:
> 
> src $ sudo ack moveLineEndPoint
> Password:
> *cgx.h*
> *941*:void moveLineEndPoint(int lineNr, int pntNr, double llength);
> 
> *pickFunktions.c*
> *4583*:void moveLineEndPoint(int lineNr, int pntNr, double llength)
> *4800*: moveLineEndPoint( lineNr, px, pickbuf);
> 
> 
> 
> int createLine( char *apnt, int flag )
> {
>    int i,j=0, nr=-1;
>    static int px, p1, p2, pc=-1, pm=-1, ps[1000], seq=1;
>    double P1[3], P2[3], Pc[3], Pm[3], pbuf[3], u;
>    char name[MAX_LINE_LENGTH], setname[MAX_LINE_LENGTH];
>    double pmp1[3], pmp2[3], pmp1_2[3], pmp2_2[3], nm12[3];
>    double eva[3], evb[3], va[3], vb[3], p0p1_2[3], p0p2_2[3], vr[3];
>>    else if (flag==5)
>    {
>      if(lineNr==-1)
>      {
>        printf("ERROR: select line with key l first\n");
>        return(-1);
>      }
>      px  = getPntNr( apnt );
>      moveLineEndPoint( lineNr, px, pickbuf);
>      for (i=0; i<anzGeo->l; i++) repLine(i);
> 
>      lineNr=-1;
>    }
>    return (nr);
> }
> 
> It looks like the return(-1) is needed?

The createLine function is not attempting to look at a return value for 
moveLineEndPoint. So if this is the only caller (and moveLineEndPoint is 
not a part of a public API), the program's apparent intended behaviour 
will be preserved by removing the incorrect return value from 
moveLineEndPoint. (Whether it's a good idea to have a function handle 
failure in this way is another discussion.)

- Josh


More information about the macports-dev mailing list