From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24481 invoked by alias); 26 Apr 2011 22:23:25 -0000 Received: (qmail 24466 invoked by uid 22791); 26 Apr 2011 22:23:24 -0000 X-SWARE-Spam-Status: No, hits=-0.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_NEUTRAL,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp21.services.sfr.fr (HELO smtp21.services.sfr.fr) (93.17.128.4) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 26 Apr 2011 22:23:08 +0000 Received: from filter.sfr.fr (localhost [127.0.0.1]) by msfrf2114.sfr.fr (SMTP Server) with ESMTP id F0B347000087; Wed, 27 Apr 2011 00:23:06 +0200 (CEST) Received: from gimli.local (33.123.193-77.rev.gaoland.net [77.193.123.33]) by msfrf2114.sfr.fr (SMTP Server) with ESMTP id C00A37000084; Wed, 27 Apr 2011 00:23:06 +0200 (CEST) X-SFR-UUID: 20110426222306786.C00A37000084@msfrf2114.sfr.fr From: Mikael Morin To: fortran@gcc.gnu.org Subject: Re: [PATCH,Fortran] Handle 'q' exponent-letter in real-literal-constant Date: Tue, 26 Apr 2011 22:33:00 -0000 User-Agent: KMail/1.13.5 (FreeBSD/8.2-PRERELEASE; KDE/4.5.5; amd64; ; ) Cc: Steve Kargl , Janne Blomqvist , gcc-patches@gcc.gnu.org References: <20110425184207.GA7936@troutmask.apl.washington.edu> <20110426165258.GA5025@troutmask.apl.washington.edu> In-Reply-To: <20110426165258.GA5025@troutmask.apl.washington.edu> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201104270023.04566.mikael.morin@sfr.fr> X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-04/txt/msg02074.txt.bz2 On Tuesday 26 April 2011 18:52:58 Steve Kargl wrote: > On Mon, Apr 25, 2011 at 11:15:35PM +0300, Janne Blomqvist wrote: > > On Mon, Apr 25, 2011 at 22:45, Steve Kargl > > > > wrote: > > > On Mon, Apr 25, 2011 at 10:26:20PM +0300, Janne Blomqvist wrote: > > >> Hmm, I'd prefer if the warning was issued only with -Wsomething which > > >> would be included in -Wall. But I suppose this can be done as a > > >> follow-up patch. > > > > > > I thought about adding a -freal-q-constant option. > > > > -Wreal-q-constant, presumably? > > Yes. I've implemented in the revised patch, and I've > updated the docs. > > 2011-04-26 Steven G. Kargl > > PR fortran/48720 > * gfortran.texi: Document the 'Q' exponent-letter extension. > * invoke.texi: Document -Wreal-q-constant. > * lang.opt: Add -Wreal-q-constant option. > * gfortran.h: Add warn_real_q_constant to option struct. > * primary.c (match_real_constant): Use it. Accept 'Q' as > exponent-letter for REAL(16) real-literal-constant with a > fallback to REAL(10) or error if REAL(10) is not available. > * options.c (gfc_init_options, set_Wall) Set it. > (gfc_handle_option): Handle new option. > > OK? Sorry to jump late on this. > Index: primary.c > =================================================================== > --- primary.c (revision 172974) > +++ primary.c (working copy) > @@ -541,6 +541,17 @@ match_real_constant (gfc_expr **result, > goto done; > exp_char = c; > > + > + if (c == 'q') > + { > + if (gfc_notify_std (GFC_STD_GNU, "Extension: exponent-letter 'q' in " > + "real-literal-constant at %C") == FAILURE) > + return MATCH_ERROR; > + else if (gfc_option.warn_real_q_constant) > + gfc_warning("Extension: exponent-letter 'q' in real-literal-constant " > + "at %C"); > + } I think the above could generate double warnings. With -pedantic for example (but I didn't check). By the way testcases are missing :-p. > @@ -616,6 +627,29 @@ done: > kind = gfc_default_double_kind; > break; > > + case 'q': > + if (kind != -2) > + { > + gfc_error ("Real number at %C has a 'q' exponent and an explicit " > + "kind"); > + goto cleanup; > + } > + > + /* The maximum possible real kind type parameter is 16. First, try > + that for the kind, then fallback to trying kind=10 (Intel 80 bit) > + extended precision. If neither value works, just given up. */ > + kind = 16; > + if (gfc_validate_kind (BT_REAL, kind, true) < 0) > + { > + kind = 10; > + if (gfc_validate_kind (BT_REAL, kind, true) < 0) > + { > + gfc_error ("Invalid real kind %d at %C", kind); > + goto cleanup; > + } Here kind is guaranteed to be 10 in the error. As the user didn't specify kind=10 explicitely, I suggest a more informative message like (for example): Use of 'q' exponent requires REAL(16) or REAL(10) support at %C I only glanced at the rest, but Jane OK'ed it anyway :-). Mikael