From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28256 invoked by alias); 8 Jun 2012 09:14:31 -0000 Received: (qmail 28244 invoked by uid 22791); 8 Jun 2012 09:14:29 -0000 X-SWARE-Spam-Status: No, hits=-7.1 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 08 Jun 2012 09:14:14 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q589EDWO024777 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 8 Jun 2012 05:14:13 -0400 Received: from zebedee.pink (ovpn-113-24.phx2.redhat.com [10.3.113.24]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q589EA8D008632; Fri, 8 Jun 2012 05:14:11 -0400 Message-ID: <4FD1C262.20907@redhat.com> Date: Fri, 08 Jun 2012 09:14:00 -0000 From: Andrew Haley User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 MIME-Version: 1.0 To: "Bin.Cheng" CC: "gcc-help@gcc.gnu.org" Subject: Re: Is it possible to make gcc detect whether printf prints floating point numbers? References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2012-06/txt/msg00086.txt.bz2 [Redirect to gcc-help] On 06/08/2012 09:54 AM, Bin.Cheng wrote: > In micro-controller applications, code size is critical and the size > problem is worse if library is linked. > For example, most c programs call printf to format output data, that > means floating point code get linked even the program only want to > output non-floating point numbers. Currently, we rely on end-user to > call iprintf if the program does not want floating point. > > I noticed that GCC now can check format string of printf functions, so > I am wondering if it is possible to take advantage of this utility, by > making gcc detect whether printf prints floating point number and then > generate assembly directive in backend to pull in floating point > functions only if necessary. It wouldn't be at all difficult, but you'd have to change gcc. Andrew.