[Mingw-users] Problems with compiling Windows system calls with MinGW gcc 6.3.0

アーカイブの一覧に戻る

Keith Marshall keith****@users*****
Thu Aug 2 05:53:10 JST 2018


On 01/08/18 17:52, Eli Zaretskii wrote:
>> [**] There's actually a third option: ignore the testsuite failure!
>> The issue isn't even apparent, unless compiling with
>> -Wsystem-headers, (as the testsuite does), and even then it only
>> raises warnings, (unless -Werror is also enabled).
> 
> If a C++ program invoking one of these functions compiles without
> errors, then maybe the third option is the best.  I assumed, perhaps
> incorrectly, that the test suite failure means C++ programs using
> these functions (or even including <process.h>?) will fail to compile
> or link.

Just including <process.h> is sufficient to raise warnings, but only
when -Wsystem-headers is specified; they seem to be benign, but autotest
sees them as a test failure, (because the stderr output isn't as expected).

$ cat t-process.cpp
#include <cstdlib>
#include <process.h>

int main()
{ char foo[] = "foo";
  char *foo_argv[] = { foo, NULL };
  execv( *foo_argv, foo_argv );
  return 0;
}
$ mingw32-g++ -Wall -c -fsyntax-only t-process.cpp
$ mingw32-g++ -Wall -c -fsyntax-only t-process.cpp -Wsystem-headers
In file included from t-process.cpp:2:0:
/home/keith/mingw32-gcc-7.3.0/include/process.h:193:10: warning:
declaration of 'intptr_t execv(const char*, const char* const*)'
conflicts with built-in declaration 'int execv(const char*, char*
const*)' [-Wbuiltin-declaration-mismatch]
 intptr_t execv (const char *, const char * const *);
          ^~~~~
/home/keith/mingw32-gcc-7.3.0/include/process.h:196:10: warning:
declaration of 'intptr_t execve(const char*, const char* const*, const
char* const*)' conflicts with built-in declaration 'int execve(const
char*, char* const*, char* const*)' [-Wbuiltin-declaration-mismatch]
 intptr_t execve (const char *, const char * const *, const char * const *);
          ^~~~~~
/home/keith/mingw32-gcc-7.3.0/include/process.h:199:10: warning:
declaration of 'intptr_t execvp(const char*, const char* const*)'
conflicts with built-in declaration 'int execvp(const char*, char*
const*)' [-Wbuiltin-declaration-mismatch]
 intptr_t execvp (const char *, const char * const *);
          ^~~~~~

Note that the above compiles without complaint, until -Wsystem-headers
is specified, (and then it only emits warnings).  It also links fine.
(I didn't try to run it, because it wouldn't do -- or show -- anything
useful).

-- 
Regards,
Keith.

Public key available from keys.gnupg.net
Key fingerprint: C19E C018 1547 DE50 E1D4 8F53 C0AD 36C6 347E 5A3F

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
Url : https://lists.osdn.me/mailman/archives/mingw-users/attachments/20180801/c19510e6/attachment.pgp 



More information about the MinGW-Users mailing list
アーカイブの一覧に戻る