From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 90731 invoked by alias); 19 Jun 2017 16:20:51 -0000 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 Received: (qmail 90335 invoked by uid 89); 19 Jun 2017 16:20:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=HTo:D*xidian.edu.cn, HTo:D*cn, HTo:D*edu.cn, intentional X-HELO: mail-qt0-f196.google.com Received: from mail-qt0-f196.google.com (HELO mail-qt0-f196.google.com) (209.85.216.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 19 Jun 2017 16:20:45 +0000 Received: by mail-qt0-f196.google.com with SMTP id w1so19858911qtg.0 for ; Mon, 19 Jun 2017 09:20:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=gD0IvcIKMTQWFz6ysWQB8OTtRl3SD314vAHYnlT/QVo=; b=Md8kjCS0eX92/XQFs2JJbGQbYRSrplnKtVJNpqtRrpxdi04r12ioQP70rBcIFukyf9 lu0EsWzxTouwud+tNUL4D1oTMFmMSfpbRABSVkG1qrq4GfxoPY9+U4qtRkvftdWZ/bbi GqjKevp/m6u2WLnhKrkGzG2QeMAViYRvQo1g714a7qyQsbPfGzVofoQQ4cI9+JaerdO4 ID3G2x0FLOYj3YO8Dy7TTD7I5lxTsL7AW99PF6ZLah1pcYeztU/TSZRMlOBKP03LV6kT uLfEBTkiBX3l2kYW9mTHuVQWWqqFmNVNMxN8LA/Usp3I3qf/bBHaKhXl++z39kUweZFy N0gw== X-Gm-Message-State: AKS2vOy6Ads697gav9tC5xFyp10TtJcL2lBnpqVd+VSli9KNp1M6P8Qz E6jjyFO2gAbmTB2J X-Received: by 10.237.32.202 with SMTP id 68mr30423719qtb.128.1497889248251; Mon, 19 Jun 2017 09:20:48 -0700 (PDT) Received: from localhost.localdomain (184-96-144-212.hlrn.qwest.net. [184.96.144.212]) by smtp.gmail.com with ESMTPSA id c145sm6790980qke.54.2017.06.19.09.20.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Jun 2017 09:20:47 -0700 (PDT) Subject: Re: [PATCH 0/6] New warnings -Wstring-plus-{char, int} (PR c++/62181) To: Xi Ruoyao , gcc-patches@gcc.gnu.org References: <1497230800.27153.4.camel@stu.xidian.edu.cn> From: Martin Sebor Message-ID: <04261310-ac0a-fb4a-7b59-ce4f61236a4b@gmail.com> Date: Mon, 19 Jun 2017 16:20:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <1497230800.27153.4.camel@stu.xidian.edu.cn> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2017-06/txt/msg01337.txt.bz2 On 06/11/2017 07:26 PM, Xi Ruoyao wrote: > Hi, > > I've implemented -Wstring-plus-int and -Wstring-plus-char (like their > counterpart in Clang) for GCC. From the Clang patch(*) it only "warns when a character literal is added (using '+') to a variable with type 'char *' (or any other pointer to character type). Based on the tests in this patch, GCC will warn for non-literal operands as well. Is that intentional, and if so, what is your rationale for the difference? Martin [*] http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20131021/091671.html