Feature #466

Beware with sincos

Added by Eduardo about 4 years ago. Updated about 4 years ago.

Status:ClosedStart date:2013-12-22
Priority:LowDue date:
Assignee:-% Done:


Target version:Candidate for next minor release


Compiling GMT I got this warning:

/root/software/gmt/GMTdev/gmt5/trunk/src/pscontour.c: In function 'sort_and_plot_ticks':
/root/software/gmt/GMTdev/gmt5/trunk/src/pscontour.c:356:5: warning: implicit declaration of function 'sincos' [-Wimplicit-function-declaration]
sincos (a, &sa, &ca);
/root/software/gmt/GMTdev/gmt5/trunk/src/pscontour.c:356:5: warning: incompatible implicit declaration of built-in function 'sincos' [enabled by default]

man sincos says

SINCOS Linux Programmer's Manual SINCOS

sincos, sincosf, sincosl - calculate sin and cos simultaneously

#define _GNU_SOURCE /* See feature_test_macros(7) */
#include <math.h>

void sincos(double x, double *sin, double *cos);
void sincosf(float x, float *sin, float *cos);
void sincosl(long double x, long double *sin, long double *cos);
Link with -lm.


#1 Updated by Eduardo about 4 years ago

Ah, to expose the sincos declaration you need to define _GNU_SOURCE.

In /usr/include/[i386-linux-gnu|x86_64-linux-gnu]/bits/mathcalls.h

#ifdef __USE_GNU
/* Cosine and sine of X. */
__MATHDECL (void,sincos,,
(_Mdouble_ __x, _Mdouble_ *__sinx, _Mdouble_ *__cosx));

#2 Updated by Paul about 4 years ago

It has to do with trying to eliminate configured #ifdefs in the include files involved in gmt_dev.h. Should be fixed in r12670. Let me know though.

#3 Updated by Paul about 4 years ago

  • Status changed from New to Resolved

Rolled back to r12662 so now moot.

#4 Updated by Paul about 4 years ago

  • Status changed from Resolved to Closed

Closing this one as moot.

Also available in: Atom PDF