From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19110 invoked by alias); 22 Apr 2008 18:02:41 -0000 Received: (qmail 19100 invoked by uid 22791); 22 Apr 2008 18:02:41 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 22 Apr 2008 18:02:07 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id C2764983DB; Tue, 22 Apr 2008 18:02:05 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id 8F1D798060; Tue, 22 Apr 2008 18:02:05 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.69) (envelope-from ) id 1JoMoe-0005Zn-N7; Tue, 22 Apr 2008 14:02:04 -0400 Date: Tue, 22 Apr 2008 19:41:00 -0000 From: Daniel Jacobowitz To: Andrew STUBBS Cc: GDB Patches Subject: Re: [PATCH] long long for printf on MinGW Message-ID: <20080422180204.GA20664@caradoc.them.org> Mail-Followup-To: Andrew STUBBS , GDB Patches References: <452CCE2D.8070806@st.com> <20061011130330.GA24187@nevyn.them.org> <452D09E8.5090005@st.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <452D09E8.5090005@st.com> User-Agent: Mutt/1.5.17 (2007-12-11) X-IsSubscribed: yes 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 X-SW-Source: 2008-04/txt/msg00479.txt.bz2 On Wed, Oct 11, 2006 at 04:12:40PM +0100, Andrew STUBBS wrote: > 2006-10-11 Andrew Stubbs > > * printcmd.c: Define USE_PRINTF_I64 and PRINTF_HAS_LONG_LONG on MinGW. > (printf_command): Convert %lld to %I64d when USE_PRINTF_I64 set. I'm somewhat willing to approve this patch. Note this is the revised one from http://sourceware.org/ml/gdb-patches/2006-10/msg00117.html I had ambitious plans involving making printf work on target types. But they aren't going to come through any time soon. However, for host types we could import the printf (vsprintf-posix) module from gnulib, then always assume PRINTF_HAS_LONG_LONG as long as HAVE_LONG_LONG_INT. I did the work of adding gnulib modules already. So maybe this is a better option. What do you think? > + /* Windows' printf does support long long, but not the usual way. > + Convert %lld to %I64d. */ > + int length_before_ll = f - last_arg - 1 - lcount; > + strncpy (current_substring, last_arg, length_before_ll); > + strcpy (current_substring + length_before_ll, "I64"); > + current_substring[length_before_ll + 3] = > + last_arg[length_before_ll + lcount]; > + current_substring += length_before_ll + 4; You've got enough buffer space to do this but I had to think about it a couple times to work out why :-) -- Daniel Jacobowitz CodeSourcery