From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 64281 invoked by alias); 8 Aug 2017 04:21:49 -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 63730 invoked by uid 89); 8 Aug 2017 04:21:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS,URIBL_RED autolearn=ham version=3.3.2 spammy=HX-Gm-Message-State:AHYfb5g X-HELO: mail-wr0-f178.google.com Received: from mail-wr0-f178.google.com (HELO mail-wr0-f178.google.com) (209.85.128.178) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 08 Aug 2017 04:21:09 +0000 Received: by mail-wr0-f178.google.com with SMTP id k71so8269526wrc.2 for ; Mon, 07 Aug 2017 21:21:08 -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:in-reply-to:references:from:date :message-id:subject:to:cc; bh=+IJby05B5yCTd5m8tNJFbVgnvHOBEaQpVxds+ulnlf0=; b=HoFROvFdRVck4hyA4wM4ZK7/m4FAwjznozaU3MMAfBOoF2jOf6WYAFxKJ9vVHWbz+y HhKChBnFbNGs5atmkWwfHyUmQn+/8U/UuSABCskS13qede968LsoZ48ycJ+qZAejf5WM 270jQXS0trr+OH0KU2b43EbDCkM2hNHS7murGzQOafXH+TIVDIM3dQhEcFPmuRWArH3S inBwAKBcwOuSAQTaYixYpcw8O3CAcz4ccM45dEA4TpiBHcpipTb9WMt5W1gcNaGlGhHN K8IrOnNgcKR33t4HvAef3DV4FRz0xlx3PPh61G0za6QaWODJ6Bka1RzJleyzZeA/dpp1 CaBg== X-Gm-Message-State: AHYfb5g+r4NdQr4u+w9okoC4WMX+ccA5gmdfosBOOrd6Ltkmu7G/O1po 89fLGXk10Xfq/4VyrMHnRAvtJDl0j/w1 X-Received: by 10.223.152.47 with SMTP id v44mr1790596wrb.60.1502166067277; Mon, 07 Aug 2017 21:21:07 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.134.103 with HTTP; Mon, 7 Aug 2017 21:21:06 -0700 (PDT) In-Reply-To: References: <2b846ba2-2ac0-e387-9928-891bcc8d79af@gmail.com> <4bf960f7-440a-1305-e1ac-c744c53a50f9@gmail.com> From: Prathamesh Kulkarni Date: Tue, 08 Aug 2017 04:21:00 -0000 Message-ID: Subject: Re: [1/2] PR 78736: New warning -Wenum-conversion To: Joseph Myers Cc: Martin Sebor , gcc Patches , Marek Polacek Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2017-08/txt/msg00565.txt.bz2 On 1 August 2017 at 00:10, Prathamesh Kulkarni wrote: > On 11 July 2017 at 17:59, Prathamesh Kulkarni > wrote: >> On 13 June 2017 at 01:47, Joseph Myers wrote: >>> This is OK with one fix: >>> >>>> +C ObjC Var(warn_enum_conversion) Init(0) Warning LangEnabledBy(C Objc,Wall) >>> >>> I believe the LangEnabledBy arguments are case-sensitive, so you need to >>> have ObjC not Objc there for it to work correctly. (*.opt parsing isn't >>> very good at detecting typos and giving errors rather than silently >>> ignoring things.) >> Hi, >> Sorry for the late response, I was on a vacation. >> The attached patch is rebased and bootstrap+tested on x86_64-unknown-linux-gnu. >> I have modified it slightly to not warn for enums with different names >> but having same value ranges. >> For eg: >> enum e1 { e1_1, e1_2 }; >> enum e2 { e2_1, e2_2 }; >> >> enum e1 x = e2_1; >> With this version, there would be no warning for the above assignment >> since both e1 and e2 have >> same value ranges. Is that OK ? >> >> The patch has following fallouts in the testsuite: >> >> a) libgomp: >> I initially assume it was a false positive because I thought enum >> gomp_schedule_type >> and enum omp_sched_t have same value-ranges but it looks like omp_sched_t >> has range [1, 4] while gomp_schedule_type has range [0, 4] with one >> extra element. >> Is the warning then correct for this case ? >> >> b) libgfortran: >> i) Implicit conversion from unit_mode to file_mode >> ii) Implicit conversion from unit_sign_s to unit_sign. >> I suppose the warning is OK for these cases since unit_mode, file_mode >> have different value-ranges and similarly for unit_sign_s, unit_sign ? >> >> Also I tested the warning by compiling the kernel for x86_64 with >> allmodconifg (attached), and there >> have been quite few instances of the warning (attached). I have been >> through few cases which I don't think are false positives >> but I wonder then whether we should relegate the warning to Wextra instead ? > ping: https://gcc.gnu.org/ml/gcc-patches/2017-07/msg00514.html ping * 2 https://gcc.gnu.org/ml/gcc-patches/2017-07/msg00514.html Thanks, Prathamesh > > Thanks, > Prathamesh >> >> Thanks, >> Prathamesh >>> >>> -- >>> Joseph S. Myers >>> joseph@codesourcery.com