[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [platform-testers] groff 1.23.0.rc3 on native Windows
From: |
G. Branden Robinson |
Subject: |
Re: [platform-testers] groff 1.23.0.rc3 on native Windows |
Date: |
Mon, 6 Mar 2023 09:08:18 -0600 |
Hi Bruno,
These Windows issues seem trickier to deal with.
At 2023-03-06T01:46:49+0100, Bruno Haible wrote:
> On native Windows, I attempted a build with mingw and with MSVC 14.
>
> * With mingw (in 64-bit mode), the build failed here:
>
> ../src/include/symbol.h: In member function ‘long unsigned int symbol::hash()
> const’:
> ../src/include/symbol.h:61:25: error: cast from ‘const char*’ to ‘long
> unsigned int’ loses precision [-fpermissive]
> return (unsigned long)s;
>
> The integral type that is as wide as a pointer is 'uintptr_t' (from
> <inttypes.h> or <stdint.h>), not 'unsigned long'.
Right. You found an attempt at a value-preserving type cast from groff
1.07, in 1993. :)
It looks like I cannot assume the existence of a uintptr_t type on C++
systems?
https://en.cppreference.com/w/cpp/types/integer
It (and intptr_t) are "optional", apparently. What do you suggest?
uint_fast64_t?
That will blow up on us when IP128 systems start showing up...but maybe
we can kick that can down the road.
> * With MSVC, there was an internal compiler error.
C:\cygwin64\home\bruno\groff-1.23.0.rc3\src\libs\libgroff\getopt.c(251): error
C2143: syntax error: missing ')' before '('
C:\cygwin64\home\bruno\groff-1.23.0.rc3\src\libs\libgroff\getopt.c(251): error
C2091: function returns function
C:\cygwin64\home\bruno\groff-1.23.0.rc3\src\libs\libgroff\getopt.c(251): error
C2059: syntax error: ')'
C:\cygwin64\home\bruno\groff-1.23.0.rc3\src\libs\libgroff\getopt.c(251): error
C2143: syntax error: missing ')' before 'type'
C:\cygwin64\home\bruno\groff-1.23.0.rc3\src\libs\libgroff\getopt.c(251): error
C2085: 'argc': not in formal parameter list
Given the line numbers, I surmise that this is compiler anger due to
the GNU extension form of attribute application.
248 /* Initialize the internal data when the first call is made. */
249
250 static const char *
251 _getopt_initialize (__attribute__((__unused__)) int argc,
252 __attribute__((__unused__)) char **argv,
253 const char *optstring, int posixly_correct,
254 struct _getopt_data *d)
Unusually in groff this is pure C code, and standard attributes are in
the draft for the C23 standard but still, IIRC, drawing some resistance
from national bodies reviewing it. (Some of them don't want trigraphs
killed off, either.) In any case, groff's portability horizon makes C23
irrelevant.
In looking around the web, I see several competing recommendations for
how to preprocess one's way out of the problem. What's your suggestion?
I'm happy to experiment myself if a shell account on this (or a similar)
Windows system is something you're able to provide. It looks like this
getopt.c file and src/libs/libgroff/new.cpp are the only places in the
code base that use __unused__ at all, and the latter only in a
non-default configuration ("--enable-groff-allocator").
Bracketing the functions at issue with appropriately conditionalized
#define/#undefs may be the lowest-impact solution.
Regards,
Branden
signature.asc
Description: PGP signature