Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Issue 213403010: Re-enable the clang check for enum constants. (Closed)

Created:
6 years, 9 months ago by Tom Sepez
Modified:
5 years, 7 months ago
Reviewers:
Mark Mentovai, Nico
CC:
chromium-reviews, Elliot Glaysher, Robert Sesek
Visibility:
Public.

Description

Re-enable the clang check for enum constants. The patch adds a flag to disable the feature, so as to avoid future reverts. There is also a check to avoid mixed signed comparisons, as can arise with enums from C files. We need not bother checking these. BUG=356816 R=mark@chromium.org R=thakis@chromium.org Re-enable flag. patch from issue 150943005 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=260249

Patch Set 1 #

Patch Set 2 : Add tests. #

Patch Set 3 : Fix copyright line. #

Total comments: 2

Patch Set 4 : Default to "off", add C-style enum test. #

Total comments: 2

Patch Set 5 : Change "dont" to "don't". #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+172 lines, -1 line) Patch
M tools/clang/plugins/ChromeClassTester.h View 1 chunk +6 lines, -0 lines 0 comments Download
M tools/clang/plugins/ChromeClassTester.cpp View 3 chunks +16 lines, -0 lines 0 comments Download
M tools/clang/plugins/FindBadConstructs.cpp View 1 2 3 7 chunks +54 lines, -1 line 1 comment Download
A tools/clang/plugins/tests/enum_last_value.cpp View 1 2 3 4 1 chunk +39 lines, -0 lines 0 comments Download
A tools/clang/plugins/tests/enum_last_value.flags View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
A tools/clang/plugins/tests/enum_last_value.txt View 1 1 chunk +7 lines, -0 lines 0 comments Download
A tools/clang/plugins/tests/enum_last_value_from_c.c View 1 2 3 4 1 chunk +40 lines, -0 lines 0 comments Download
A tools/clang/plugins/tests/enum_last_value_from_c.flags View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
A tools/clang/plugins/tests/enum_last_value_from_c.txt View 1 2 3 1 chunk +4 lines, -0 lines 0 comments Download
M tools/clang/plugins/tests/test.sh View 1 2 3 1 chunk +4 lines, -0 lines 0 comments Download

Messages

Total messages: 15 (0 generated)
Tom Sepez
Mark, Nico, please review.
6 years, 9 months ago (2014-03-27 21:22:44 UTC) #1
Nico
Please also add tests. See the other tests in that folder for examples.
6 years, 9 months ago (2014-03-27 21:32:33 UTC) #2
Tom Sepez
> Please also add tests. See the other tests in that folder for examples. Tests ...
6 years, 9 months ago (2014-03-27 21:59:19 UTC) #3
Nico
mostly lgtm, thanks! https://codereview.chromium.org/213403010/diff/40001/tools/clang/plugins/ChromeClassTester.cpp File tools/clang/plugins/ChromeClassTester.cpp (right): https://codereview.chromium.org/213403010/diff/40001/tools/clang/plugins/ChromeClassTester.cpp#newcode209 tools/clang/plugins/ChromeClassTester.cpp:209: ignored_record_names_.insert("ServerFieldType"); Hm, maybe the warning should ...
6 years, 9 months ago (2014-03-27 22:53:45 UTC) #4
Nico
Oh, and since that was a problem, consider having a .c test file maybe
6 years, 9 months ago (2014-03-27 22:56:49 UTC) #5
Tom Sepez
On 2014/03/27 22:56:49, Nico wrote: > Oh, and since that was a problem, consider having ...
6 years, 9 months ago (2014-03-27 23:06:33 UTC) #6
Tom Sepez
> Hm, maybe the warning should only fire if all enum values have a common ...
6 years, 9 months ago (2014-03-27 23:09:38 UTC) #7
Tom Sepez
Nico, please take a final look. Thanks.
6 years, 9 months ago (2014-03-28 01:08:11 UTC) #8
Nico
lgtm! https://codereview.chromium.org/213403010/diff/60001/tools/clang/plugins/tests/enum_last_value_from_c.c File tools/clang/plugins/tests/enum_last_value_from_c.c (right): https://codereview.chromium.org/213403010/diff/60001/tools/clang/plugins/tests/enum_last_value_from_c.c#newcode24 tools/clang/plugins/tests/enum_last_value_from_c.c:24: // We dont warn when xxxLAST constants are ...
6 years, 9 months ago (2014-03-28 03:31:50 UTC) #9
Tom Sepez
The CQ bit was checked by tsepez@chromium.org
6 years, 9 months ago (2014-03-28 17:39:35 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/tsepez@chromium.org/213403010/80001
6 years, 9 months ago (2014-03-28 17:41:56 UTC) #11
commit-bot: I haz the power
Change committed as 260249
6 years, 9 months ago (2014-03-28 20:05:16 UTC) #12
Nico
https://codereview.chromium.org/213403010/diff/80001/tools/clang/plugins/FindBadConstructs.cpp File tools/clang/plugins/FindBadConstructs.cpp (right): https://codereview.chromium.org/213403010/diff/80001/tools/clang/plugins/FindBadConstructs.cpp#newcode762 tools/clang/plugins/FindBadConstructs.cpp:762: options_.check_enum_last_value = true; It looks like this check is ...
5 years, 7 months ago (2015-05-10 18:48:42 UTC) #13
Tom Sepez
> It looks like this check is off by default and the flag isn't set. ...
5 years, 7 months ago (2015-05-11 18:02:25 UTC) #14
Nico
5 years, 7 months ago (2015-05-11 18:04:59 UTC) #15
Message was sent while issue was closed.
Should this code be deleted from the plugin then?

On Mon, May 11, 2015 at 11:02 AM, <tsepez@chromium.org> wrote:

> Reviewers: Mark Mentovai, Nico,
>
> Message:
>
>> It looks like this check is off by default and the flag isn't set. Should
>> be
>>
> bug
>
>> for this really be marked fixed? Or am I missing something?
>>
> Bug should probably be marked wontfix, as we found this was undesirable in
> general.
>
>
> Description:
> Re-enable the clang check for enum constants.
>
> The patch adds a flag to disable the feature, so as to avoid future
> reverts.
> There is also a check to avoid mixed signed comparisons, as can
> arise with enums from C files.  We need not bother checking these.
>
> BUG=356816
> R=mark@chromium.org
> R=thakis@chromium.org
>
> Re-enable flag.
>
>
> patch from issue 150943005
>
> Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=260249
>
> Please review this at https://codereview.chromium.org/213403010/
>
> Base URL: svn://svn.chromium.org/chrome/trunk/src
>
> Affected files (+172, -1 lines):
>   M tools/clang/plugins/ChromeClassTester.h
>   M tools/clang/plugins/ChromeClassTester.cpp
>   M tools/clang/plugins/FindBadConstructs.cpp
>   A tools/clang/plugins/tests/enum_last_value.cpp
>   A tools/clang/plugins/tests/enum_last_value.flags
>   A tools/clang/plugins/tests/enum_last_value.txt
>   A tools/clang/plugins/tests/enum_last_value_from_c.c
>   A tools/clang/plugins/tests/enum_last_value_from_c.flags
>   A tools/clang/plugins/tests/enum_last_value_from_c.txt
>   M tools/clang/plugins/tests/test.sh
>
>
>

To unsubscribe from this group and stop receiving emails from it, send an email
to chromium-reviews+unsubscribe@chromium.org.

Powered by Google App Engine
This is Rietveld 408576698