From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 44109 invoked by alias); 17 Nov 2015 15:27:55 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 44097 invoked by uid 89); 17 Nov 2015 15:27:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 17 Nov 2015 15:27:54 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id DC6F5693 for ; Tue, 17 Nov 2015 15:27:52 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tAHFRpE2001594 for ; Tue, 17 Nov 2015 10:27:52 -0500 Message-ID: <564B4777.2020203@redhat.com> Date: Tue, 17 Nov 2015 15:27:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: Re: [PATCH] MinGW and attribute format(printf/gnu_printf) References: <1446164397-12493-1-git-send-email-palves@redhat.com> In-Reply-To: <1446164397-12493-1-git-send-email-palves@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2015-11/txt/msg00344.txt.bz2 On 10/30/2015 12:19 AM, Pedro Alves wrote: > Cross building gdbserver for --host=x86_64-w64-mingw32 with gcc 4.8.4 > 20141219 (Fedora MinGW 4.8.4-1.fc20), I get: > > src/gdb/gdbserver/tracepoint.c: In function 'cmd_qtdp': > src/gdb/gdbserver/tracepoint.c:2577:7: error: unknown conversion type character 'l' in format [-Werror=format=] > trace_debug ("Defined %stracepoint %d at 0x%s, " > ^ > src/gdb/gdbserver/tracepoint.c:2577:7: error: unknown conversion type character 'l' in format [-Werror=format=] > src/gdb/gdbserver/tracepoint.c:2577:7: error: too many arguments for format [-Werror=format-extra-args] > src/gdb/gdbserver/tracepoint.c: In function 'stop_tracing': > src/gdb/gdbserver/tracepoint.c:3447:7: error: unknown conversion type character 'l' in format [-Werror=format=] > trace_debug ("Stopping the trace because " > ^ > src/gdb/gdbserver/tracepoint.c:3447:7: error: too many arguments for format [-Werror=format-extra-args] > src/gdb/gdbserver/tracepoint.c: In function 'collect_data_at_tracepoint': > src/gdb/gdbserver/tracepoint.c:4651:3: error: unknown conversion type character 'l' in format [-Werror=format=] > trace_debug ("Making new traceframe for tracepoint %d at 0x%s, hit %" PRIu64, > ^ > src/gdb/gdbserver/tracepoint.c:4651:3: error: too many arguments for format [-Werror=format-extra-args] > src/gdb/gdbserver/tracepoint.c: In function 'collect_data_at_step': > src/gdb/gdbserver/tracepoint.c:4687:3: error: unknown conversion type character 'l' in format [-Werror=format=] > trace_debug ("Making new step traceframe for " > ^ > > trace_debug is a macro that calls: > > static void trace_vdebug (const char *, ...) ATTRIBUTE_PRINTF (1, 2); > > The calls that fail checking use PRIu64, etc., like: > > trace_debug ("Defined %stracepoint %d at 0x%s, " > "enabled %d step %" PRIu64 " pass %" PRIu64, > tpoint->type == fast_tracepoint ? "fast " > : tpoint->type == static_tracepoint ? "static " : "", > tpoint->number, paddress (tpoint->address), tpoint->enabled, > tpoint->step_count, tpoint->pass_count); > > gnulib's stdio/printf module replacements may make %llu, etc. work on > mingw, instead of the MS-specific %I64u, and thus may make PRIu64 > expand to %llu. However, gcc isn't aware of that, because libiberty's > ansidecl.h defines ATTRIBUTE_PRINTF as using attribute format(printf). > But, with that format, gcc checks for MS-style format strings (%I64u). > In order to have gcc expect gnu/standard formats, we need to use > gnu_printf format instead. Which version to use (printf/gnu_printf) > depends on msvcrt and mingw version, and so gnulib has a > configure-time check, and defines _GL_ATTRIBUTE_FORMAT_PRINTF > accordingly. > > Since _GL_ATTRIBUTE_FORMAT_PRINTF is compatible with ATTRIBUTE_PRINTF, > the fix is simply to make use of the former. > > gdb/ChangeLog: > 2015-10-29 Pedro Alves > > * common/common-defs.h (ATTRIBUTE_PRINTF): Redefine in terms of > _GL_ATTRIBUTE_FORMAT_PRINTF after including ansidecl.h. I've pushed this in. Thanks, Pedro Alves