gcc/libgm2
Rainer Orth efc71fd575 libgm2: Fix libm2iso/wraptime.cc compilation on Solaris
As it turned out, my patch to complete the libgm2 autoconf macros works
on both Linux/sparc64 and Linux/x86_64, but breaks Solaris bootstrap:

/vol/gcc/src/hg/master/local/libgm2/libm2iso/wraptime.cc: In function 'int
m2iso_wraptime_gettimeofday(void*, timezone*)':
/vol/gcc/src/hg/master/local/libgm2/libm2iso/wraptime.cc:148:24: error:
invalid conversion from 'void*' to 'timeval*' [-fpermissive]
  148 |   return gettimeofday (tv, tz);
      |                        ^~
      |                        |
      |                        void*
In file included from /usr/include/sys/select.h:27,
                 from /usr/include/sys/types.h:665,
                 from /vol/gcc/src/hg/master/local/libgm2/libm2iso/wraptime.cc:35:
/usr/include/sys/time.h:444:18: note:   initializing argument 1 of 'int gettimeofday(timeval*, void*)'
  444 | int gettimeofday(struct timeval *_RESTRICT_KYWD, void *_RESTRICT_KYWD);
      |                  ^
/vol/gcc/src/hg/master/local/libgm2/libm2iso/wraptime.cc: In function 'int
m2iso_wraptime_settimeofday(void*, timezone*)':
/vol/gcc/src/hg/master/local/libgm2/libm2iso/wraptime.cc:165:24: error:
invalid conversion from 'void*' to 'timeval*' [-fpermissive]
  165 |   return settimeofday (tv, tz);
      |                        ^~
      |                        |
      |                        void*
/usr/include/sys/time.h:431:18: note: initializing argument 1 of 'int
settimeofday(timeval*, void*)'
  431 | int settimeofday(struct timeval *, void *);
      |                  ^~~~~~~~~~~~~~~~

This happens because on Linux only HAVE_[GS]ETTIMEOFDAY is defined,
while Solaris has both that and HAVE_STRUCT_TIMEZONE, selecting
different implementations.

Fixed by casting tv to struct timeval *.

I thought about changing the signatures instead to take a struct timeval
* instead, but that seemed risky given that there's a
HAVE_STRUCT_TIMEVAL, so would probably break other targets.

Bootstrapped without regressions on i386-pc-solaris2.11,
sparc-sun-solaris2.11, and x86_64-pc-linux-gnu.

2024-02-13  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	libgm2:
	* libm2iso/wraptime.cc [HAVE_STRUCT_TIMEZONE && HAVE_GETTIMEOFDAY]
	(EXPORT(gettimeofday)): Cast tv to struct timeval *.
	[HAVE_STRUCT_TIMEZONE && HAVE_SETTIMEOFDAY]
	(EXPORT(settimeofday)): Likewise.
2024-02-13 13:24:43 +01:00
..
libm2cor PR modula2/111956 Many powerpc platforms do _not_ have support for IEEE754 2024-01-18 13:06:30 +00:00
libm2iso libgm2: Fix libm2iso/wraptime.cc compilation on Solaris 2024-02-13 13:24:43 +01:00
libm2log PR modula2/111956 Many powerpc platforms do _not_ have support for IEEE754 2024-01-18 13:06:30 +00:00
libm2min PR modula2/111956 Many powerpc platforms do _not_ have support for IEEE754 2024-01-18 13:06:30 +00:00
libm2pim libgm2: Define missing configure macros [PR113888] 2024-02-12 14:01:41 +01:00
acinclude.m4 PR modula2/110779: Add reduced acinclude.m4 to allow interrogation of time features 2023-11-13 15:11:50 +00:00
aclocal.m4 PR modula2/110779: Add reduced acinclude.m4 to allow interrogation of time features 2023-11-13 15:11:50 +00:00
ChangeLog Daily bump. 2024-02-13 00:17:51 +00:00
config.h.in libgm2: Define missing configure macros [PR113888] 2024-02-12 14:01:41 +01:00
configure libgm2: Define missing configure macros [PR113888] 2024-02-12 14:01:41 +01:00
configure.ac libgm2: Define missing configure macros [PR113888] 2024-02-12 14:01:41 +01:00
configure.host PR modula2/110779: Add reduced acinclude.m4 to allow interrogation of time features 2023-11-13 15:11:50 +00:00
Makefile.am PR modula2/111956 Many powerpc platforms do _not_ have support for IEEE754 2024-01-18 13:06:30 +00:00
Makefile.in PR modula2/111956 Many powerpc platforms do _not_ have support for IEEE754 2024-01-18 13:06:30 +00:00