Re: git no longer builds on SunOS 5.10, a report

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Oct 13, 2024 at 06:50:09PM -0400, Alejandro R. Sedeño wrote:
> On Sun, Oct 13, 2024 at 3:57 PM Patrick Steinhardt <ps@xxxxxx> wrote:
> > diff --git a/t/unit-tests/clar/clar.c b/t/unit-tests/clar/clar.c
> > index cef0f023c2..064ca5c2ea 100644
> > --- a/t/unit-tests/clar/clar.c
> > +++ b/t/unit-tests/clar/clar.c
> > @@ -4,6 +4,10 @@
> >   * This file is part of clar, distributed under the ISC license.
> >   * For full terms see the included COPYING file.
> >   */
> > +
> > +#define _DARWIN_C_SOURCE
> > +#define _POSIX_C_SOURCE=200809L
> 
> token "=" is not valid in preprocessor expressions.

Yeah, typoed this one.

> 2008 postdates my available compiler by many years, so trying to define this
> is not going to get you everything you might expect here.
> 
> Fixing the #define to use a space and not = results in
> 
> /usr/include/sys/feature_tests.h:332:2: #error "Compiler or options
> invalid for pre-UNIX 03 X/Open applications and pre-2001 POSIX
> applications"
> 
> The relevant bits of the header:
> 
> #if defined(_STDC_C99) && (defined(__XOPEN_OR_POSIX) && !defined(_XPG6))
> #error "Compiler or options invalid for pre-UNIX 03 X/Open applications \
>         and pre-2001 POSIX applications"
> #elif !defined(_STDC_C99) && \
>         (defined(__XOPEN_OR_POSIX) && defined(_XPG6))
> #error "Compiler or options invalid; UNIX 03 and POSIX.1-2001 applications \
>         require the use of c99"
> #endif
> 
> Removing `#define _POSIX_C_SOURCE 200809L` results in successful compilation.

Ah, I didn't even know that headers would bail out in case they don't
support the standard, but it makes sense in retrospect. My current
version is:

#define _BSD_SOURCE
#define _DEFAULT_SOURCE
#define _DARWIN_C_SOURCE

I hope that should work fine on all platforms. In any case, I have
created [1] upstream now.

[1]: https://github.com/clar-test/clar/pull/107

> > +
> >  #include <assert.h>
> >  #include <setjmp.h>
> >  #include <stdlib.h>
> > @@ -271,9 +275,7 @@ static double clar_time_diff(clar_time *start, clar_time *end)
> >
> >  static void clar_time_now(clar_time *out)
> >  {
> > -       struct timezone tz;
> > -
> > -       gettimeofday(out, &tz);
> > +       gettimeofday(out, NULL);
> >  }
> >
> >  static double clar_time_diff(clar_time *start, clar_time *end)
> > diff --git a/t/unit-tests/clar/clar/sandbox.h b/t/unit-tests/clar/clar/sandbox.h
> > index e25057b7c4..b499d2e1e6 100644
> > --- a/t/unit-tests/clar/clar/sandbox.h
> > +++ b/t/unit-tests/clar/clar/sandbox.h
> > @@ -122,7 +122,7 @@ static int build_sandbox_path(void)
> >
> >         if (mkdir(_clar_path, 0700) != 0)
> >                 return -1;
> > -#elif defined(__TANDEM)
> > +#elif defined(__sunos) || defined(__TANDEM)
> 
> I think we want __sun here, not __sunos.

And typoed that one, as well :)

Patrick




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux