Re: gcc knows about sincos even though NetBSD doesn't

Thomas Klausner <[email protected]>
Newsgroups gmane.os.netbsd.devel.toolchain
Message-ID <[email protected]>
I've filed an upstream bug about this:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106529

 Thomas


On Sun, Aug 14, 2022 at 09:31:13AM +1200, Lloyd Parkes wrote:
> It seems that sincos is now built in to GCC. Also, the suggested header
> location is hard-coded in GCC.
> 
> Sigh
> 
> On 30/07/22 08:25, Thomas Klausner wrote:
> > On Fri, Jul 29, 2022 at 05:46:08PM +0200, Thomas Klausner wrote:
> > > Hi!
> > > 
> > > With -current as of about a week ago (gcc 10.3.0) I see a confusing
> > > warning.
> > 
> > I've just updated and tried - it's the same with gcc 10.4.0.
> >   Thomas
> > 
> > > The following test input:
> > > 
> > > #include <limits.h>
> > > 
> > > int main() {
> > > return sincos();
> > > }
> > > 
> > > when compiled with "gcc -o test test.c" gives:
> > > 
> > > 
> > > test.c: In function ‘main’:
> > > test.c:4:8: warning: implicit declaration of function ‘sincos’ [-Wimplicit-function-declaration]
> > >      4 | return sincos();
> > >        |        ^~~~~~
> > > test.c:4:8: warning: incompatible implicit declaration of built-in function ‘sincos’
> > > test.c:2:1: note: include ‘<math.h>’ or provide a declaration of ‘sincos’
> > >      1 | #include <limits.h>
> > >    +++ |+#include <math.h>
> > >      2 |
> > > test.c:4:8: error: too few arguments to function ‘sincos’
> > >      4 | return sincos();
> > >        |        ^~~~~~
> > > 
> > > 
> > > The first part is fine, but the warning to include math.h is
> > > misguided, since NetBSD does not have sincos at all.
> > > 
> > > (see also https://gitlab.gnome.org/GNOME/gtk/-/issues/5070 )
> > > 
> > >   Thomas
> > >
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.