Feature #466

Beware with sincos

Added by Eduardo over 3 years ago. Updated over 3 years ago.

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

0%

Category:-
Target version:Candidate for next minor release
Platform:Linux

Description

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

NAME
sincos, sincosf, sincosl - calculate sin and cos simultaneously

SYNOPSIS
#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.

History

#1 Updated by Eduardo over 3 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));
#endif
...

#2 Updated by Paul over 3 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 over 3 years ago

  • Status changed from New to Resolved

Rolled back to r12662 so now moot.

#4 Updated by Paul over 3 years ago

  • Status changed from Resolved to Closed

Closing this one as moot.

Also available in: Atom PDF