From patchwork Thu Oct 24 14:07:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 1183103 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-511671-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="Z41udOo2"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.b="ExsLFxqT"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46zTbh3X4rz9sPp for ; Fri, 25 Oct 2019 01:07:58 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=bhje5cppXVV4ZXTfGxzgJWHge/U2MUK2g6zx78HSWUzXBBqfcV M67UevYZ57sILpN8rzC7RsvHU/75DHikY1Dl37JPOdKhj8yIF+QSe/SPBPReED/s s+o+J5kAt4sin+YZQGaRUdXLEGAZisIk7wGFSndkqz5v5UsYhGglinFKM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=umBAxOZqa9mzaxdqPoKEipS5kkY=; b=Z41udOo2e3NgyG57m6dt 2r5Q/vQRViQjNsj9erJcZeXkikmHhje3k+hXHN7u4jneZWAQEbhK/AyBco41Pbs9 mGAT+4NXxdujlMerWYg9xjhfYhCDO9FE4BlYmRIF7oI/tAv0kzvgTp7v7ceRbZIK U83eltf3VkfXegBqR0xB1O8= Received: (qmail 53288 invoked by alias); 24 Oct 2019 14:07:51 -0000 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 Received: (qmail 53278 invoked by uid 89); 24 Oct 2019 14:07:50 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-9.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 spammy=1520, *p9, p10, HX-Spam-Relays-External:192.168.1.4 X-HELO: userp2130.oracle.com Received: from userp2130.oracle.com (HELO userp2130.oracle.com) (156.151.31.86) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 24 Oct 2019 14:07:49 +0000 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x9ODvYC8168314; Thu, 24 Oct 2019 14:07:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=to : cc : from : subject : message-id : date : mime-version : content-type; s=corp-2019-08-05; bh=AXOSrUjOg0U8PqyWghYvZvEMiFxu+e8Bn55zkVFQ4A4=; b=ExsLFxqTUUgHvykZhYsvsV/0GxmlZl1MiNxBXIX2QB7FNWDNwE5pMRLKkq+6TibsxzyG 0CZ0h2T00rO9iMvYB7nP5rbxqbYPlwYMH214iQFh8u5EdPGLknBg/8ZDLgl9fmHyT0L4 sYxf+O1IvHjZSDPLnNAshiizimlchYmxFNeKDuqfiFjtKJ6NEWYmZbj4Afq7ieXDO4So dUulVg6phR52+ieONbCJs5wBNJf7zcVIb4T4SWhNZ+Hxrsg+SUxr3qFr/Gh60Yr1b3nq 8PGa6N07JGFTdip+t5KB2BOS15E2wcbSuYTbQOAnvkvIDEjLnyoA4/c2n7R7lMPInB+e uA== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 2vqswtv10s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 24 Oct 2019 14:07:47 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x9ODs1Ib149559; Thu, 24 Oct 2019 14:07:46 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3020.oracle.com with ESMTP id 2vu0fpbyuc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 24 Oct 2019 14:07:46 +0000 Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x9OE7iRp029324; Thu, 24 Oct 2019 14:07:44 GMT Received: from [192.168.1.4] (/82.55.223.173) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 24 Oct 2019 07:07:44 -0700 To: "gcc-patches@gcc.gnu.org" Cc: Jason Merrill From: Paolo Carlini Subject: [C++ Patch] Prefer error + inform in four typeck.c places Message-ID: <9d98fc75-6c13-3530-ca02-c7317243061a@oracle.com> Date: Thu, 24 Oct 2019 16:07:41 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 X-IsSubscribed: yes Hi, some additional straightforward bits in typeck.c, which I noticed when I went through the cp_build_binary_op callers. Tested x86_64-linux. Thanks, Paolo. ////////////////////// /cp 2019-10-24 Paolo Carlini * typeck.c (cp_build_modify_expr): Prefer error + inform to error + error in one place. (get_delta_difference_1): Likewise. (get_delta_difference): Likewise, in two places. /testsuite 2019-10-24 Paolo Carlini * g++.dg/conversion/ptrmem2.C: Adjust for error + inform. * g++.dg/gomp/tpl-atomic-2.C: Likewise. Index: cp/typeck.c =================================================================== --- cp/typeck.c (revision 277366) +++ cp/typeck.c (working copy) @@ -8358,8 +8358,8 @@ cp_build_modify_expr (location_t loc, tree lhs, en if (newrhs == error_mark_node) { if (complain & tf_error) - error (" in evaluation of %<%Q(%#T, %#T)%>", modifycode, - TREE_TYPE (lhs), TREE_TYPE (rhs)); + inform (loc, " in evaluation of %<%Q(%#T, %#T)%>", + modifycode, TREE_TYPE (lhs), TREE_TYPE (rhs)); return error_mark_node; } @@ -8594,7 +8594,7 @@ get_delta_difference_1 (tree from, tree to, bool c if (!(complain & tf_error)) return error_mark_node; - error (" in pointer to member function conversion"); + inform (input_location, " in pointer to member function conversion"); return size_zero_node; } else if (binfo) @@ -8655,7 +8655,7 @@ get_delta_difference (tree from, tree to, return error_mark_node; error_not_base_type (from, to); - error (" in pointer to member conversion"); + inform (input_location, " in pointer to member conversion"); result = size_zero_node; } else @@ -8674,7 +8674,7 @@ get_delta_difference (tree from, tree to, return error_mark_node; error_not_base_type (from, to); - error (" in pointer to member conversion"); + inform (input_location, " in pointer to member conversion"); result = size_zero_node; } } Index: testsuite/g++.dg/conversion/ptrmem2.C =================================================================== --- testsuite/g++.dg/conversion/ptrmem2.C (revision 277366) +++ testsuite/g++.dg/conversion/ptrmem2.C (working copy) @@ -15,16 +15,20 @@ int B::*p1 = static_cast(&D::x); int D::*p2 = static_cast(&B::x); // Virtual base class. -int V::*p3 = static_cast(&D::x); // { dg-error "" } -int D::*p4 = static_cast(&V::x); // { dg-error "" } +int V::*p3 = static_cast(&D::x); // { dg-error "virtual base" } +int D::*p4 = static_cast(&V::x); // { dg-error "virtual base" } // Inaccessible base class. -int P::*p5 = static_cast(&D::x); // { dg-error "" } -int D::*p6 = static_cast(&P::x); // { dg-error "" } +int P::*p5 = static_cast(&D::x); // { dg-error "inaccessible base" } +// { dg-message "pointer to member function" "" { target *-*-* } .-1 } +int D::*p6 = static_cast(&P::x); // { dg-error "inaccessible base" } +// { dg-message "pointer to member function" "" { target *-*-* } .-1 } // Ambiguous base class. -int A::*p7 = static_cast(&D::x); // { dg-error "" } -int D::*p8 = static_cast(&A::x); // { dg-error "" } +int A::*p7 = static_cast(&D::x); // { dg-error "ambiguous base" } +// { dg-message "pointer to member function" "" { target *-*-* } .-1 } +int D::*p8 = static_cast(&A::x); // { dg-error "ambiguous base" } +// { dg-message "pointer to member function" "" { target *-*-* } .-1 } // Valid conversions which increase cv-qualification. const int B::*p9 = static_cast(&D::x); @@ -35,5 +39,5 @@ int B::*p11 = static_cast(p10); // { dg- int D::*p12 = static_cast(p9); // { dg-error "casts away qualifiers" } // Attempts to change member type. -float B::*p13 = static_cast(&D::x); // { dg-error "" } -float D::*p14 = static_cast(&B::x); // { dg-error "" } +float B::*p13 = static_cast(&D::x); // { dg-error "invalid .static_cast." } +float D::*p14 = static_cast(&B::x); // { dg-error "invalid .static_cast." } Index: testsuite/g++.dg/gomp/tpl-atomic-2.C =================================================================== --- testsuite/g++.dg/gomp/tpl-atomic-2.C (revision 277374) +++ testsuite/g++.dg/gomp/tpl-atomic-2.C (working copy) @@ -13,7 +13,7 @@ template void f1() template void f2(float *f) { #pragma omp atomic // { dg-error "invalid" } - *f |= 1; // { dg-error "evaluation" } + *f |= 1; // { dg-message "evaluation" "" { target *-*-* } .-1 } } // Here the rhs is dependent, but not type dependent. @@ -20,7 +20,7 @@ template void f2(float *f) template void f3(float *f) { #pragma omp atomic // { dg-error "invalid" } - *f |= sizeof (T); // { dg-error "evaluation" } + *f |= sizeof (T); // { dg-message "evaluation" "" { target *-*-* } .-1 } } // And the converse, no error here because we're never fed a T.