From patchwork Tue Jul 17 08:14:08 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 171356 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id CC0022C01BB for ; Tue, 17 Jul 2012 18:15:29 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1343117730; h=Comment: DomainKey-Signature:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=UNmTzB4 dIxu+JTvZ54pceMWI3mo=; b=bGbO6ETLdD0kqHmorj+M6PoegFTVZM405IOAZap GcTEknoSH/sQGsTkGQqFojy8/3hqBwy9qEU4qKyBVyGUhTWMnHWdLW6iNDoMhbTz e3JZSjQiG3qvztgqPnY2AOSH1VA6Sqv3Z1WLQfv/B0OQ+DAm+4E7uIjC6cybo6v3 TOwk= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=QGu7fivq0EEOyD7anaN4Q580duSUXWrFkTs/j92OmBN/24Wnm1tpaJzTqAez1J 0sz1tat3bndozWZPj9M39LLz/02jOVIf+okyCvGwx1cK+mGzH9eC1tMqa6B6H6SW rpNkDpZS3l5psLXNq5/tGkUhZI15GV/knV0J9XLkvdeWE=; Received: (qmail 26786 invoked by alias); 17 Jul 2012 08:14:53 -0000 Received: (qmail 26664 invoked by uid 22791); 17 Jul 2012 08:14:50 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_HOSTKARMA_NO X-Spam-Check-By: sourceware.org Received: from mx02.qsc.de (HELO mx02.qsc.de) (213.148.130.14) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 17 Jul 2012 08:14:37 +0000 Received: from [192.168.178.22] (port-92-204-53-225.dynamic.qsc.de [92.204.53.225]) by mx02.qsc.de (Postfix) with ESMTP id 1D2B227A48; Tue, 17 Jul 2012 10:14:16 +0200 (CEST) Message-ID: <50051ED0.30407@net-b.de> Date: Tue, 17 Jul 2012 10:14:08 +0200 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 MIME-Version: 1.0 To: gcc patches , gfortran Subject: [Patch, Fortran] PR52101 Fix obsolescent warning 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 gfortran warns (with -std=) for the obsolescence of character*5 ... which is correct. However, it also warns when using character name*5 which is not (yet) obsolescent. Fixed by the attached patch. In comment 5 you find Steve's version of the patch, which I only saw after writing my patch. The only difference seems to be the name of the parameter. Steve uses "entity_decl". Build and regtested on x86-64-gnu-linux. OK for the trunk? Tobias 2012-07-17 Tobias Burnus PR fortran/52101 * decl.c (match_char_length): Extra argument, show obsolenscent warning only if *length is used after the typename. (variable_decl, gfc_match_char_spec): Update call 2012-07-17 Tobias Burnus PR fortran/52101 * gfortran.dg/oldstyle_4.f90: New. diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index c3644b6..c6ba43e 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -723,7 +727,7 @@ syntax: char_len_param_value in parenthesis. */ static match -match_char_length (gfc_expr **expr, bool *deferred) +match_char_length (gfc_expr **expr, bool *deferred, bool obsolenscent_check) { int length; match m; @@ -739,8 +743,9 @@ match_char_length (gfc_expr **expr, bool *deferred) if (m == MATCH_YES) { - if (gfc_notify_std (GFC_STD_F95_OBS, "Obsolescent feature: " - "Old-style character length at %C") == FAILURE) + if (obsolenscent_check + && gfc_notify_std (GFC_STD_F95_OBS, "Obsolescent feature: " + "Old-style character length at %C") == FAILURE) return MATCH_ERROR; *expr = gfc_get_int_expr (gfc_default_integer_kind, NULL, length); return m; @@ -1849,7 +1854,7 @@ variable_decl (int elem) if (current_ts.type == BT_CHARACTER) { - switch (match_char_length (&char_len, &cl_deferred)) + switch (match_char_length (&char_len, &cl_deferred, false)) { case MATCH_YES: cl = gfc_new_charlen (gfc_current_ns, NULL); @@ -2411,7 +2416,7 @@ gfc_match_char_spec (gfc_typespec *ts) /* Try the old-style specification first. */ old_char_selector = 0; - m = match_char_length (&len, &deferred); + m = match_char_length (&len, &deferred, true); if (m != MATCH_NO) { if (m == MATCH_YES) --- /dev/null 2012-07-17 07:28:04.995717470 +0200 +++ gcc/gcc/testsuite/gfortran.dg/oldstyle_4.f90 2012-07-17 08:49:00.000000000 +0200 @@ -0,0 +1,13 @@ +! { dg-do compile } +! { dg-options "-std=f95" } +! +! PR fortran/52101 +! +! Contributed by John Harper +! +program foo + character*10 s ! { dg-warning "Obsolescent feature: Old-style character length" } + character t*10 ! Still okay + s = 'foo' + t = 'bar' +end program foo