From patchwork Wed May 16 00:23:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 914093 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-477733-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="ZScVUqaq"; 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 40lwDr5q88z9s1d for ; Wed, 16 May 2018 10:24:59 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=I1KsxsgDcQQwaPduIdMfdShtix23IFKsyqmNftDvyNTACp MQh3h6PZ+HS1z00MpCsPrL5w2rEBgkA0Mz6o/vZ5pOpVZ3DoyodnX/szAtu6+jmv aAC/ivI0JuiTu5CLBTCgiG+Cn7tbRIMkPIBSohiCFXosZMfvLtnJ5PKI+4dDQ= 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 :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=0kO9MjzdVJKmjgL9c5j1rftHfLA=; b=ZScVUqaqYMdaZkG8Kj6x AbYOE4FuKjK2AyKEJRn8O1m4/qhYrUpqCsycZ6CizXlCYNoANtfNEBARuHHVWDKE P5yJdkZp8HdVuiwDHSpd6NJOdgVUqz4iMR7g4ei/lTZqeuloDMIR5cF6JYcC59In RmaodK2FWDJGzIJLTfBs0pM= Received: (qmail 11822 invoked by alias); 16 May 2018 00:24:49 -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 11764 invoked by uid 89); 16 May 2018 00:24:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, TIME_LIMIT_EXCEEDED autolearn=unavailable version=3.3.2 spammy= X-HELO: mail-oi0-f43.google.com Received: from mail-oi0-f43.google.com (HELO mail-oi0-f43.google.com) (209.85.218.43) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 16 May 2018 00:24:20 +0000 Received: by mail-oi0-f43.google.com with SMTP id k17-v6so1878806oih.5 for ; Tue, 15 May 2018 17:24:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=B5Nv3UDeF+L9vmRDNUKExxc2IAk5+zZZtQ85JlzoL3Q=; b=tEGYOlJxoCXKlInjFB8767uoJnR4j0FXBMp7Nlc9oofyBnOEHgYyVIcz5UOrHPsXne d/TRdMwA7c6+yzn7VHXy0OhaElQvSC2ibbw6bCkHo+u7CWgTBK0nbeHkoGQzojgrq4cc 0XcZ5EUhi2/zTlo91VMRGEP+o8EqOwr4rqC2u+/sNXhdwCLTROMdslLpAV3vi77Opg88 zPww4G0UXiz8uDipDjesR3mQp/ChWPiaXJRwESVZBDLXS4pepoUzgoUGJT5FpS2e1Phn VHd/FplQRrF1ykGOA3nCdtS0bninZ2wQzBsMCvOIUqRbVt+3M4EuII5A8JAV4dYg/LA2 TzUA== X-Gm-Message-State: ALKqPwfk/EwnJuhAs8yZ/AqmZBBuaxnnoIGceDQ37WsXRE5f8VN0JlXI RKfDnu3wfNxywQ88rmuNHhFJ0RpizCU91rXdFkMnRovD X-Google-Smtp-Source: AB8JxZqA7L78cQvez+Ey/bNAjDU+9te+P0sIqrxnw33DJSiNmZq4PlZSppjcorR1RnjQj+8KN2AfXWCfBAPhk81lIak= X-Received: by 2002:aca:5885:: with SMTP id m127-v6mr10352723oib.352.1526430252442; Tue, 15 May 2018 17:24:12 -0700 (PDT) MIME-Version: 1.0 Received: by 10.201.13.229 with HTTP; Tue, 15 May 2018 17:23:51 -0700 (PDT) From: Jason Merrill Date: Tue, 15 May 2018 20:23:51 -0400 Message-ID: Subject: C++ PATCH to make cxx_eval_vec_init_1 respect the quiet flag To: gcc-patches List X-IsSubscribed: yes While working on something else I noticed that this function was generating warnings when it's supposed to be quiet. Tested x86_64-pc-linux-gnu, applied to trunk. commit ea990203b6a7562e399c22ffd70e7391106d6dc5 Author: Jason Merrill Date: Tue May 15 15:30:43 2018 -0400 * constexpr.c (cxx_eval_vec_init_1): Pass tf_none if ctx->quiet. diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index 9ee37de88d3..8c6ec555ca9 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -2936,6 +2936,7 @@ cxx_eval_vec_init_1 (const constexpr_ctx *ctx, tree atype, tree init, vec **p = &CONSTRUCTOR_ELTS (ctx->ctor); bool pre_init = false; unsigned HOST_WIDE_INT i; + tsubst_flags_t complain = ctx->quiet ? tf_none : tf_warning_or_error; /* For the default constructor, build up a call to the default constructor of the element type. We only need to handle class types @@ -2946,7 +2947,7 @@ cxx_eval_vec_init_1 (const constexpr_ctx *ctx, tree atype, tree init, /* We only do this at the lowest level. */; else if (value_init) { - init = build_value_init (elttype, tf_warning_or_error); + init = build_value_init (elttype, complain); pre_init = true; } else if (!init) @@ -2954,7 +2955,7 @@ cxx_eval_vec_init_1 (const constexpr_ctx *ctx, tree atype, tree init, vec *argvec = make_tree_vector (); init = build_special_member_call (NULL_TREE, complete_ctor_identifier, &argvec, elttype, LOOKUP_NORMAL, - tf_warning_or_error); + complain); release_tree_vector (argvec); init = build_aggr_init_expr (TREE_TYPE (init), init); pre_init = true; @@ -2981,8 +2982,7 @@ cxx_eval_vec_init_1 (const constexpr_ctx *ctx, tree atype, tree init, reuse = i == 0; } else - eltinit = cp_build_array_ref (input_location, init, idx, - tf_warning_or_error); + eltinit = cp_build_array_ref (input_location, init, idx, complain); eltinit = cxx_eval_vec_init_1 (&new_ctx, elttype, eltinit, value_init, lval, non_constant_p, overflow_p); @@ -3000,11 +3000,10 @@ cxx_eval_vec_init_1 (const constexpr_ctx *ctx, tree atype, tree init, /* Copying an element. */ gcc_assert (same_type_ignoring_top_level_qualifiers_p (atype, TREE_TYPE (init))); - eltinit = cp_build_array_ref (input_location, init, idx, - tf_warning_or_error); + eltinit = cp_build_array_ref (input_location, init, idx, complain); if (!lvalue_p (init)) eltinit = move (eltinit); - eltinit = force_rvalue (eltinit, tf_warning_or_error); + eltinit = force_rvalue (eltinit, complain); eltinit = cxx_eval_constant_expression (&new_ctx, eltinit, lval, non_constant_p, overflow_p); }