[Bug] Can't build gtags-cscope on Windows due to the type casting of spawnvp
<[email protected]> Sat, 20 Jul 2024 09:27:39 +0800
| Newsgroups | gmane.comp.gnu.global.bugs |
|---|---|
| Message-ID | <[email protected]> |
This is a multipart message in MIME format.
------=_NextPart_000_0030_01DADA87.11A64380
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
Hello GNU Global,
What is your environment (OS)?
Environment: Windows 11
Which version of Global are you using?
6.6.13
What did you do? (command line)
1. cd /path/to/gtags-cscope
2. make
What did you expect from it?
Building a gtags-cscope binary.
What was occurred? (as is)
exec.c: In function 'execute':
exec.c:92:39: error: passing argument 3 of 'spawnvp' from incompatible
pointer type [-Wincompatible-pointer-types]
92 | exitcode = spawnvp(P_WAIT, a, (const char* const*)argv);
| ^~~~~~~~~~~~~~~~~~~~~~~~
| |
| const char * const*
I use GNU Global and I've found a bug of compilaton error on Windows. It
seems that latest mingw toolchain
has updated the declaration of spawnvp function in process.h like this:
_CRTIMP intptr_t __cdecl spawnve(int,const char *_Filename,char *const
_ArgList[],char *const _Env[]) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
I've changed the type casting from (const char* const*) to (char* const*) to
successfully build it. Another solution is to use the safer one:
_CRTIMP intptr_t __cdecl _spawnvp(int _Mode,const char *_Filename,const
char *const *_ArgList);
If using this one, just call _spawnvp and the type casting won't be changed.
Would you help update it? Thanks a lot!
Lambert,
Regards
------=_NextPart_000_0030_01DADA87.11A64380
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
<html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" =
xmlns=3D"http://www.w3.org/TR/REC-html40"><head><META =
HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii"><meta name=3DGenerator content=3D"Microsoft Word 15 =
(filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:\65B0\7D30\660E\9AD4;
panose-1:2 2 5 0 0 0 0 0 0 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Aptos;}
@font-face
{font-family:"\@\65B0\7D30\660E\9AD4";
panose-1:2 1 6 1 0 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:12.0pt;
font-family:"Aptos",sans-serif;
mso-ligatures:standardcontextual;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Aptos",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;}
/* Page Definitions */
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]--></head><body lang=3DZH-TW =
link=3D"#467886" vlink=3D"#96607D" =
style=3D'word-wrap:break-word;text-justify-trim:punctuation'><div =
class=3DWordSection1><p class=3DMsoNormal><span lang=3DEN-US>Hello GNU =
Global,<o:p></o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US><o:p> </o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US>What is your environment (OS)?<o:p></o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US>Environment: Windows =
11<o:p></o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US><o:p> </o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US>Which version of Global are you =
using?<o:p></o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US>6.6.13<o:p></o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US><o:p> </o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US>What did you do? (command line)<o:p></o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US>1. cd =
/path/to/gtags-cscope<o:p></o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US>2. make<o:p></o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US><o:p> </o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US>What did you expect from it?<o:p></o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US>Building a gtags-cscope =
binary.<o:p></o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US><o:p> </o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US>What was occurred? (as is)<o:p></o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US><o:p> </o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US>exec.c: In function =
'execute':<o:p></o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US>exec.c:92:39: error: passing argument 3 of 'spawnvp' from =
incompatible pointer type =
[-Wincompatible-pointer-types]<o:p></o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US> 92 =
| exitcode =3D =
spawnvp(P_WAIT, a, (const char* const*)argv);<o:p></o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US> =
| =
&=
nbsp; &n=
bsp; ^~~~~~~~~~~~~~~~~~~~~~~~<o:p></o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US> =
| =
&=
nbsp; &n=
bsp; |<o:p></o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US> =
| =
&=
nbsp; &n=
bsp; const char * const*<o:p></o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US><o:p> </o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US><o:p> </o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US><o:p> </o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US><o:p> </o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US>I use GNU Global and I've found a =
bug of compilaton error on Windows. It seems that latest mingw =
toolchain<o:p></o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US>has updated the declaration of spawnvp function in =
process.h like this:<o:p></o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US><o:p> </o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US> _CRTIMP intptr_t __cdecl spawnve(int,const char =
*_Filename,char *const _ArgList[],char *const _Env[]) =
__MINGW_ATTRIB_DEPRECATED_MSVC2005;<o:p></o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US><o:p> </o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US>I've changed the type casting from =
(const char* const*) to (char* const*) to successfully build it. Another =
solution is to use the safer one:<o:p></o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US><o:p> </o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US> _CRTIMP intptr_t __cdecl =
_spawnvp(int _Mode,const char *_Filename,const char *const =
*_ArgList);<o:p></o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US><o:p> </o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US>If using this one, just call _spawnvp and the type casting =
won't be changed.<o:p></o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US><o:p> </o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US><o:p> </o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US>Would you help update it? Thanks a =
lot!<o:p></o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US><o:p> </o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US><o:p> </o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US>Lambert,<o:p></o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US>Regards<o:p></o:p></span></p></div></body></html>
------=_NextPart_000_0030_01DADA87.11A64380--