From: Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
To: Joseph Myers <joseph@codesourcery.com>
Cc: Martin Sebor <msebor@gmail.com>,
gcc Patches <gcc-patches@gcc.gnu.org>,
Marek Polacek <polacek@redhat.com>
Subject: Re: [1/2] PR 78736: New warning -Wenum-conversion
Date: Thu, 17 Aug 2017 12:53:00 -0000 [thread overview]
Message-ID: <CAAgBjMmgTRA8he6wu_sXpj_4-Wt1+wGYuOaTXTROCz+fsrkujg@mail.gmail.com> (raw)
In-Reply-To: <CAAgBjMkJ6oGS+zoQx=OAsNfVitgu9ns-8UY+XG40+08JfFNccw@mail.gmail.com>
On 8 August 2017 at 09:51, Prathamesh Kulkarni
<prathamesh.kulkarni@linaro.org> wrote:
> On 1 August 2017 at 00:10, Prathamesh Kulkarni
> <prathamesh.kulkarni@linaro.org> wrote:
>> On 11 July 2017 at 17:59, Prathamesh Kulkarni
>> <prathamesh.kulkarni@linaro.org> wrote:
>>> On 13 June 2017 at 01:47, Joseph Myers <joseph@codesourcery.com> 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
ping * 3 https://gcc.gnu.org/ml/gcc-patches/2017-07/msg00514.html
Thanks,
Prathamesh
>
> Thanks,
> Prathamesh
>>
>> Thanks,
>> Prathamesh
>>>
>>> Thanks,
>>> Prathamesh
>>>>
>>>> --
>>>> Joseph S. Myers
>>>> joseph@codesourcery.com
next prev parent reply other threads:[~2017-08-17 12:32 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-02 17:13 Prathamesh Kulkarni
2017-05-02 22:10 ` Martin Sebor
2017-05-03 6:10 ` Prathamesh Kulkarni
2017-05-09 13:25 ` Prathamesh Kulkarni
2017-05-09 18:44 ` Martin Sebor
2017-05-09 21:19 ` Pedro Alves
2017-05-10 13:15 ` Prathamesh Kulkarni
2017-05-10 15:18 ` Martin Sebor
2017-06-12 20:17 ` Joseph Myers
2017-07-11 12:29 ` Prathamesh Kulkarni
2017-07-12 15:33 ` Sandra Loosemore
2017-07-31 18:40 ` Prathamesh Kulkarni
2017-08-08 4:21 ` Prathamesh Kulkarni
2017-08-17 12:53 ` Prathamesh Kulkarni [this message]
2017-08-26 19:27 ` Joseph Myers
2017-09-01 2:37 ` Prathamesh Kulkarni
2017-09-01 11:55 ` Joseph Myers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAAgBjMmgTRA8he6wu_sXpj_4-Wt1+wGYuOaTXTROCz+fsrkujg@mail.gmail.com \
--to=prathamesh.kulkarni@linaro.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=joseph@codesourcery.com \
--cc=msebor@gmail.com \
--cc=polacek@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).