Opened 4 months ago

Last modified 4 months ago

#70351 new defect

legacy-support implementation of sincos does not work correctly: implicit declaration of function 'sincos'

Reported by: barracuda156 Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.9.3
Keywords: Cc: mascguy (Christopher Nielsen), fhgwright (Fred Wright)
Port: legacy-support

Description

It appeared working earlier apparently due to a compiler being fine with implicit function declarations. With gcc14 it just errs out, with gcc13 it only complains.

This is from gtk3 build, which now fails with gcc14, despite we patch math.h in (gcc still advises it, because our header did not work):

../gtk+-3.24.42/tests/gtkgears.c: In function 'create_gear':
../gtk+-3.24.42/tests/gtkgears.c:309:5: warning: implicit declaration of function 'sincos' [-Wimplicit-function-declaration]
  309 |     sincos(i * 2.0 * G_PI / teeth + da * 0, &s[0], &c[0]);
      |     ^~~~~~
../gtk+-3.24.42/tests/gtkgears.c:46:1: note: include '<math.h>' or provide a declaration of 'sincos'
   45 | #include "gtkgears.h"
  +++ |+#include <math.h>
   46 | 
../gtk+-3.24.42/tests/gtkgears.c:309:5: warning: incompatible implicit declaration of built-in function 'sincos' [-Wbuiltin-declaration-mismatch]
  309 |     sincos(i * 2.0 * G_PI / teeth + da * 0, &s[0], &c[0]);
      |     ^~~~~~

Maybe because it is declared as extern in legacy-support, but there is no external provision for it?

Change History (6)

comment:1 Changed 4 months ago by barracuda156

  1. S. Issue #70352 is unrelated: sincos problem is not solved by ensuring that legacy-support flag is passed.

comment:2 Changed 4 months ago by kencu (Ken)

it is declared in the math.h header:

https://github.com/macports/macports-legacy-support/blob/ed58217dc3cfcf267843c9ee395219826c805393/include/math.h#L88

and implemented in the library here:

https://github.com/macports/macports-legacy-support/blob/master/src/sincos.c

comment:3 Changed 4 months ago by fhgwright (Fred Wright)

I recently made two fixes to sincos in legacy-support, which are in the current legacy-support-devel but not the current release version. See:

MacPro:macports-legacy-support fw$ git log1 v1.2.3.. | grep sincos
fa92ff2 sincos: Implement sincos[f]_stret
1849c3a sincos: Add missing include.

I suspect that the lack of 1849c3a is your problem.

comment:4 Changed 4 months ago by fhgwright (Fred Wright)

BTW, the link that Ken posted is to the current master version, which already has the 1849c3a fix applied.

comment:5 in reply to:  4 ; Changed 4 months ago by barracuda156

Replying to fhgwright:

BTW, the link that Ken posted is to the current master version, which already has the 1849c3a fix applied.

I have the latest version installed already:

legacy-support-devel @20240630_0 (active) requested_variants='' platform='darwin 10' archs='ppc' date='2024-07-01T18:51:36+0800'

comment:6 in reply to:  5 Changed 4 months ago by fhgwright (Fred Wright)

Replying to barracuda156:

Replying to fhgwright:

BTW, the link that Ken posted is to the current master version, which already has the 1849c3a fix applied.

I have the latest version installed already:

legacy-support-devel @20240630_0 (active) requested_variants='' platform='darwin 10' archs='ppc' date='2024-07-01T18:51:36+0800'

In that case it's not the known missing-include bug. The next thing I'd check is that the legacy-support includes are happening before the OS includes. In the other order, the OS headers would shadow the legacy-support headers, rendering them inoperative.

In the particular case of math.h, there might be an additional complication regarding headers supplied by the compiler.

When all else fails, try cc -E.

Note: See TracTickets for help on using tickets.