Opened 6 months ago

Last modified 7 days ago

#68520 new defect

zvbi: need to fix endian macros so that old Xcode gcc recognized them

Reported by: barracuda156 Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.8.1
Keywords: snowleopard, leopard, tiger Cc: mascguy (Christopher Nielsen)
Port: zvbi

Description

Returning to this issue: apparently Xcode gcc do not recognize these macros (which are working for the modern gcc):

/usr/bin/gcc-4.2 -std=gnu99 -DHAVE_CONFIG_H -I. -I..  -I..  -D_REENTRANT -D_GNU_SOURCE -I/opt/local/include -I..  -D_REENTRANT -D_GNU_SOURCE -pipe -Os -arch ppc -MT osc.o -MD -MP -MF .deps/osc.Tpo -c -o osc.o osc.c
caption.c: In function ‘draw_transparent_spaces’:
caption.c:217: error: ‘__BYTE_ORDER__’ undeclared (first use in this function)
caption.c:217: error: (Each undeclared identifier is reported only once
caption.c:217: error: for each function it appears in.)
caption.c:217: error: ‘__ORDER_BIG_ENDIAN__’ undeclared (first use in this function)
make[2]: *** [caption.o] Error 1
make[2]: *** Waiting for unfinished jobs....
mv -f .deps/unicode.Tpo .deps/unicode.Po
mv -f .deps/osc.Tpo .deps/osc.Po
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_multimedia_zvbi/zvbi/work/zvbi-0.2.35/test'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_multimedia_zvbi/zvbi/work/zvbi-0.2.35'
make: *** [all] Error 2

There is no failure with gcc13, but there are a few warnings to take care of, perhaps:

libtool: compile:  /opt/local/bin/gcc-mp-13 -DHAVE_CONFIG_H -I. -I.. -I.. -D_REENTRANT -D_GNU_SOURCE -I/opt/local/include -pipe -Os -arch ppc -MT io-sim.lo -MD -MP -MF .deps/io-sim.Tpo -c io-sim.c  -fno-common -DPIC -o .libs/io-sim.o
io-sim.c: In function 'vbi_raw_add_noise':
io-sim.c:501:9: warning: implicit declaration of function 'sincos' [-Wimplicit-function-declaration]
  501 |         sincos (w0, &sn, &cs);
      |         ^~~~~~
io-sim.c:56:1: note: include '<math.h>' or provide a declaration of 'sincos'
   55 | #include "io-sim.h"
  +++ |+#include <math.h>
   56 | 
io-sim.c:501:9: warning: incompatible implicit declaration of built-in function 'sincos' [-Wbuiltin-declaration-mismatch]
  501 |         sincos (w0, &sn, &cs);
      |         ^~~~~~
io-sim.c:501:9: note: include '<math.h>' or provide a declaration of 'sincos'
. . .
xds_demux.c: In function 'vbi_xds_demux_reset':
xds_demux.c:829:43: warning: iteration 24 invokes undefined behavior [-Waggressive-loop-optimizations]
  829 |                 xd->subpacket[0][i].count = 0;
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
xds_demux.c:828:23: note: within this loop
  828 |         for (i = 0; i < n; ++i)
      |                     ~~^~~
. . .
ntsc-cc.c: In function 'xds_filter_option':
ntsc-cc.c:1164:45: warning: iteration 25 invokes undefined behavior [-Waggressive-loop-optimizations]
 1164 |                         info[0][0][i].print = TRUE;
ntsc-cc.c:1162:31: note: within this loop
 1162 |                 for (i = 0; i < (N_ELEMENTS (info[0])
      |                             ~~^~~~~~~~~~~~~~~~~~~~~~~
 1163 |                                  * N_ELEMENTS (info[0][0])); ++i) {
      |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~

}}}

Attachments (2)

zvbi.log (117.4 KB) - added by barracuda156 6 months ago.
zvbi failure with gcc-4.2 on ppc
zvbi_10.5.8.log (94.9 KB) - added by barracuda156 6 months ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 6 months ago by mascguy (Christopher Nielsen)

Again, please attach the full main.log when creating tickets. Thanks!

Changed 6 months ago by barracuda156

Attachment: zvbi.log added

zvbi failure with gcc-4.2 on ppc

comment:2 Changed 6 months ago by barracuda156

Okay, I can confirm the issue affects Leopard too (unsurprisingly so, since it is gcc-related, not SDK-related). Modern gcc builds it fine, gcc-4.2 fails.

Changed 6 months ago by barracuda156

Attachment: zvbi_10.5.8.log added

comment:3 Changed 6 months ago by kencu (Ken)

older gcc compilers (which are the default on Apple PPC) do not define __BYTE_ORDER__

a useful snippet to see the compiler defines from a given compiler is:

echo | /usr/bin/gcc-4.2 -dM -E -

these can change with arguments to the compiler, eg -arch

$ echo | /usr/bin/gcc-4.2 -arch ppc -dM -E - | grep ENDIAN
#define __BIG_ENDIAN__ 1
#define _BIG_ENDIAN 1

comment:4 Changed 7 days ago by ryandesign (Ryan Carsten Schmidt)

Has duplicate #69828.

Note: See TracTickets for help on using tickets.