CalculiX build error using clang

Blair Zajac blair at orcaware.com
Tue Jul 26 17:28:05 UTC 2022


Yes, that would fix it.

> On Jul 26, 2022, at 10:27 AM, Mark Brethen <mark.brethen at gmail.com> wrote:
> 
> would a ‘return;’ instead of ‘return(-1);’ suffice>?
> 
> Mark Brethen
> mark.brethen at gmail.com <mailto:mark.brethen at gmail.com>
> 
> 
> 
>> On Jul 26, 2022, at 11:51 AM, Christopher Jones <jonesc at hep.phy.cam.ac.uk <mailto:jonesc at hep.phy.cam.ac.uk>> wrote:
>> 
>> 
>> clang is correct in this case, gcc is being sloppy. 
>> 
>> Basically you cannot return a value, from a function declared as void… fairly basic stuff really..
>> 
>>> On 26 Jul 2022, at 5:34 pm, Mark Brethen <mark.brethen at gmail.com <mailto:mark.brethen at gmail.com>> wrote:
>>> 
>>> I’m seeing this build error when using clang (gcc doesn’t complain):
>>> 
>>> info:build /opt/local/bin/clang-mp-14 -O2 -Wall -Wno-narrowing -I./ -I/opt/local/include -I/opt/local/include/GL -I../../libSNL/src -I../../glut-3.5/src    -c -o pickFunktions.o pickFunktions.c
>>> :info:build pickFunktions.c:4599:7: error: void function 'moveLineEndPoint' should not return a value [-Wreturn-type]
>>> :info:build       return(-1);
>>> :info:build       ^     ~~~~
>>> 
>>> code snippet below:
>>> 
>>>  void moveLineEndPoint(int lineNr, int pntNr, double llength)
>>> {
>>>   int p1,p2, flag=0;
>>>   double P1[3], P2[3], u, eva[3], va[3], p0p1_2[3];
>>> 
>>>     p1=line[lineNr].p1;
>>>     p2=line[lineNr].p2;
>>> 
>>>     /* determine which side of the line has to be moved */
>>>     if(pntNr==p1) flag=-1;
>>>     else if(pntNr==p2) flag=1;
>>>     else
>>>     {
>>>       printf("ERROR: selected point:%s is no line endpoint\n", point[pntNr].name);
>>>       return(-1);
>>>     }
>>>     u=flag*llength;
>>>     u/=scale->w;
>>> 
>>>     /* calc direction */
>>>     if(line[lineNr].typ=='s')
>>>     {
>>>       if(flag==-1) p2=set[line[lineNr].trk].pnt[1];
>>>       else  p1=set[line[lineNr].trk].pnt[set[line[lineNr].trk].anz_p-2];
>>>     }
>>>     P1[0]=point[p1].px;
>>>     P1[1]=point[p1].py;
>>>     P1[2]=point[p1].pz;
>>>     P2[0]=point[p2].px;
>>>     P2[1]=point[p2].py;
>>>     P2[2]=point[p2].pz;
>>>     v_result( P1, P2, p0p1_2);
>>>     v_norm(p0p1_2,eva);
>>>     v_scal(&u,eva, va);
>>>     point[pntNr].px+=va[0];
>>>     point[pntNr].py+=va[1];
>>>     point[pntNr].pz+=va[2];
>>>     printf("moved by dxyz= %lf %lf %lf\n",
>>>       (va[0]* scale->w),
>>>       (va[1]* scale->w),
>>>       (va[2]* scale->w));
>>> }
>>> 
>>> I do not code in C, so I’ll pass this up to the developer. How should this be patched?
>>> 
>>> Thanks,
>>> Mark
>>> 
>>> 
>>> 
>> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-dev/attachments/20220726/8dca4247/attachment-0001.htm>


More information about the macports-dev mailing list