From: Jonas Jelten <jj@sft.mx>
To: gcc-bugs@gcc.gnu.org, gcc-patches@gcc.gnu.org, bkorb@gnu.org
Subject: [PATCH] fixincludes breaks mingw64 build
Date: Fri, 31 May 2019 13:59:00 -0000 [thread overview]
Message-ID: <3eb89802-0cfb-1888-00b6-357d76370894@sft.mx> (raw)
Hi!
I'm trying to build the x86_64-w64-mingw64 crosscompiler on gentoo.
It breaks because a fixincludes-fix is applied at a place where it should not be applied.
This broke the cross-gcc build for gcc-8.3.0 and 9.1.0 with error messages that made it tricky to figure out what was
really going on.
This code snippet of mingw's stdio.h:
#ifdef _WIN64
_CRTIMP FILE *__cdecl __iob_func(void);
#define _iob __iob_func()
#else
[.....]
#if (!defined(NO_OLDNAMES) || defined(__GNUC__))
__MINGW_EXTENSION typedef __int64 fpos_t;
#define _FPOSOFF(fp) ((long)(fp))
============= is modified by fixincludes to be:
#ifdef _WIN64
_CRTIMP FILE *__cdecl __iob_func(void);
#define _iob __iob
# if defined(__STDC__) || defined(__cplusplus)
extern int snprintf(char *, size_t, const char *, ...);
extern int vsnprintf(char *, size_t, const char *, __gnuc_va_list);
# else /* not __STDC__) || __cplusplus */
extern int snprintf();
extern int vsnprintf();
# endif /* __STDC__) || __cplusplus */
_func()
#else
[....]
#if (!defined(NO_OLDNAMES) || defined(__GNUC__))
__MINGW_EXTENSION typedef __int64 fpos_t;
#define _FPOSOFF(fp) ((long)(fp))
which leads to this compiler error:
In file included from /usr/x86_64-w64-mingw64/sys-include/_mingw.h:12,
from /usr/x86_64-w64-mingw64/sys-include/crtdefs.h:10,
from /usr/x86_64-w64-mingw64/sys-include/stddef.h:7,
from /tmp/portage/cross-x86_64-w64-mingw64/gcc-8.3.0-r1/work/build/gcc/include/stddef.h:1,
from /tmp/portage/cross-x86_64-w64-mingw64/gcc-8.3.0-r1/work/gcc-8.3.0/libgcc/../gcc/tsystem.h:44,
from /tmp/portage/cross-x86_64-w64-mingw64/gcc-8.3.0-r1/work/gcc-8.3.0/libgcc/libgcc2.c:27:
/tmp/portage/cross-x86_64-w64-mingw64/gcc-8.3.0-r1/work/build/gcc/include-fixed/stdio.h: In function â_funcâ:
/tmp/portage/cross-x86_64-w64-mingw64/gcc-8.3.0-r1/work/build/gcc/include-fixed/stdio.h:136:3: error: expected
declaration specifiers before â__extension__â
__MINGW_EXTENSION typedef __int64 fpos_t;
^~~~~~~~~~~~~~~~~
and many many more follow-up errors.
A simple fix seems to be to check for a line ending in the select-regex:
Author: Jonas Jelten <jj@sft.mx>
Date: Wed May 31 15:10:52 2019 +0200
fixincludes: check for lineending to not break mingw64-build
--- a/fixincludes/inclhack.def 2019-05-31 15:01:31.841235934 +0200
+++ b/fixincludes/inclhack.def 2019-05-31 15:09:31.068347492 +0200
@@ -2163,7 +2163,7 @@
fix = {
hackname = hpux10_stdio_declarations;
files = stdio.h;
- select = "^#[ \t]*define _iob[ \t]*__iob";
+ select = "^#[ \t]*define _iob[ \t]*__iob[ \t]*\n";
bypass = "^[ \t]*extern[ \t]*int[ \t]*vsnprintf[ \t]*\\(";
c_fix = format;
c_fix_arg = "%0\n\n"
--- a/fixincludes/fixincl.x 2019-05-31 15:13:20.430156243 +0200
+++ b/fixincludes/fixincl.x 2019-05-31 15:13:24.953156662 +0200
@@ -4272,7 +4272,7 @@
* content selection pattern - do fix if pattern found
*/
tSCC zHpux10_Stdio_DeclarationsSelect0[] =
- "^#[ \t]*define _iob[ \t]*__iob";
+ "^#[ \t]*define _iob[ \t]*__iob[ \t]*\n";
/*
* content bypass pattern - skip fix if pattern found
Cheers
-- Jonas
next reply other threads:[~2019-05-31 13:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-31 13:59 Jonas Jelten [this message]
2019-05-31 14:51 ` Jonathan Wakely
2019-05-31 15:35 ` Jonas Jelten
2019-05-31 19:48 ` Jonathan Wakely
2019-06-11 20:38 ` Bruce Korb
2019-08-12 22:09 ` Gerald Pfeifer
2019-06-11 20:32 ` Bruce Korb
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3eb89802-0cfb-1888-00b6-357d76370894@sft.mx \
--to=jj@sft.mx \
--cc=bkorb@gnu.org \
--cc=gcc-bugs@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).