From patchwork Fri May 31 13:35:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jonas Jelten X-Patchwork-Id: 1108361 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-502076-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sft.mx Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45Flp53W5sz9s4V for ; Fri, 31 May 2019 23:35:54 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=WSJbzT+PdZrYXSgp qqUcd/reA17Lg1v/WcUweHuVtS19k76Vxkg8i/y2tRQoUhKKrOAQfNhGeJ8p9wWO Zw0dR61xZW8xn/KVLzaY5CGguEwyQDHvhPEPiV2bm1ocPLRv+d1WUHfryjoLtSR1 t5zNyvNKKCtuXOsGJKW8OEbIj3A= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type :content-transfer-encoding; s=default; bh=tr+1oWFCgOun+4p4JDzWvx SqyvY=; b=fPmFYkEGSB7W6Dwbz06/l/gANUCm6HBiNthFcOhuMSumKhATOXF/L5 JVqqrrhk54z6dXnlqiQbarBuLbZoEbdlXx2Mz0EHWRG6Net4fqlsPlFij8/kl9DR d2byk5iwFbnJZGfKf5x0hXdLPzX+Wmt+0lGXrb/RPzcdS4wg7rGxk= Received: (qmail 118294 invoked by alias); 31 May 2019 13:35:47 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 118279 invoked by uid 89); 31 May 2019 13:35:47 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy=H*r:sender, H*r:sk:server-, H*r:Authenticated, H*F:D*mx X-HELO: mailrelay0.sft.mx Received: from blergh.sft.mx (HELO mailrelay0.sft.mx) (37.120.163.187) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 31 May 2019 13:35:45 +0000 Received: from jjserver.sft.mx (unknown [188.192.97.57]) (Authenticated sender: jjservermail@mailrelay0.sft.mx) by mailrelay0.sft.mx (Postfix) with ESMTPSA id 9373220F94; Fri, 31 May 2019 15:35:42 +0200 (CEST) Received: from [131.159.212.140] (w212-3w-v4.eduroam.dynamic.rbg.tum.de [131.159.212.140]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by jjserver.sft.mx (Postfix) with ESMTPSA id 50B8FA4030B; Fri, 31 May 2019 15:35:41 +0200 (CEST) To: gcc-bugs@gcc.gnu.org, gcc-patches@gcc.gnu.org, bkorb@gnu.org From: Jonas Jelten Subject: [PATCH] fixincludes breaks mingw64 build Message-ID: <3eb89802-0cfb-1888-00b6-357d76370894@sft.mx> Date: Fri, 31 May 2019 15:35:25 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 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 Date: Wed May 31 15:10:52 2019 +0200 fixincludes: check for lineending to not break mingw64-build Cheers -- Jonas --- 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