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

Issue 145033013: Update the static_cast style check to check for DEFINE_TYPE_CASTS patterns as well. (Closed)

Created:
6 years, 11 months ago by r.kasibhatla
Modified:
6 years, 10 months ago
CC:
blink-reviews
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Visibility:
Public.

Description

Update the static_cast style check to check for DEFINE_TYPE_CASTS patterns as well. Existing implementation of check-webkit-style warns the user if he uses static_cast<> in the code. This is behind runtime/casting filter which needs to be enabled specifically. As part of 309516, all the toFoo() definitions have been replaced with DEFINE_*_TYPE_CASTS macro, which defines the toFoo functions at compile time. This patch updates the check to include even the macro pattern to identify whether existing toFoo exists or user needs to define the toFoo convienience function (through macro). Since all existing usage of static_cast<Foo*> has been replaced with toFoo() calls, now we are throwing an error if user uses static_cast<> inspite of presence of toFoo(). If toFoo doesn't exist, we still retain a warning behind runtime/casting filter. BUG=309516 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=166491

Patch Set 1 #

Total comments: 19

Patch Set 2 : Corrected the nits! #

Patch Set 3 : Corrected the message! #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+37 lines, -21 lines) Patch
M Tools/Scripts/webkitpy/style/checkers/cpp.py View 1 2 7 chunks +33 lines, -19 lines 1 comment Download
M Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py View 1 2 4 chunks +4 lines, -2 lines 0 comments Download

Messages

Total messages: 24 (0 generated)
r.kasibhatla
PTAL.
6 years, 11 months ago (2014-01-24 15:46:43 UTC) #1
r.kasibhatla
On 2014/01/24 15:46:43, r.kasibhatla wrote: > PTAL. PTAL.
6 years, 11 months ago (2014-01-27 18:14:11 UTC) #2
Dirk Pranke
mostly rubber-stamp LGTM. I wish we had someone who was more of an OWNER for ...
6 years, 11 months ago (2014-01-27 19:38:50 UTC) #3
aarya
lgtm https://codereview.chromium.org/145033013/diff/1/Tools/Scripts/webkitpy/style/checkers/cpp.py File Tools/Scripts/webkitpy/style/checkers/cpp.py (right): https://codereview.chromium.org/145033013/diff/1/Tools/Scripts/webkitpy/style/checkers/cpp.py#newcode3414 Tools/Scripts/webkitpy/style/checkers/cpp.py:3414: def check_for_toFoo_definition(filename, search_func_name, grep_patterns, error): check_for_toFoo_definition -> check_for_cast_definition ...
6 years, 11 months ago (2014-01-27 19:45:56 UTC) #4
aarya
6 years, 10 months ago (2014-01-28 16:38:38 UTC) #5
r.kasibhatla
I will try to put another version of patch which will correct the below FIXME ...
6 years, 10 months ago (2014-02-03 15:29:15 UTC) #6
inferno
lgtm https://codereview.chromium.org/145033013/diff/1/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py File Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py (right): https://codereview.chromium.org/145033013/diff/1/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py#newcode777 Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py:777: self.assertEqual(message, 'static_cast of class objects is not allowed. ...
6 years, 10 months ago (2014-02-03 15:44:23 UTC) #7
r.kasibhatla
The CQ bit was checked by r.kasibhatla@samsung.com
6 years, 10 months ago (2014-02-04 16:22:42 UTC) #8
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/r.kasibhatla@samsung.com/145033013/110001
6 years, 10 months ago (2014-02-04 16:22:52 UTC) #9
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 10 months ago (2014-02-04 18:56:52 UTC) #10
commit-bot: I haz the power
Retried try job too often on linux_blink_rel for step(s) webkit_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=linux_blink_rel&number=20322
6 years, 10 months ago (2014-02-04 18:56:52 UTC) #11
r.kasibhatla
The CQ bit was checked by r.kasibhatla@samsung.com
6 years, 10 months ago (2014-02-05 07:44:55 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/r.kasibhatla@samsung.com/145033013/110001
6 years, 10 months ago (2014-02-05 07:45:07 UTC) #13
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 10 months ago (2014-02-05 08:49:23 UTC) #14
commit-bot: I haz the power
Retried try job too often on linux_blink_rel for step(s) webkit_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=linux_blink_rel&number=20467
6 years, 10 months ago (2014-02-05 08:49:24 UTC) #15
r.kasibhatla
The CQ bit was checked by r.kasibhatla@samsung.com
6 years, 10 months ago (2014-02-05 09:19:39 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/r.kasibhatla@samsung.com/145033013/110001
6 years, 10 months ago (2014-02-05 09:20:37 UTC) #17
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 10 months ago (2014-02-05 10:53:25 UTC) #18
commit-bot: I haz the power
Retried try job too often on linux_blink_rel for step(s) webkit_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=linux_blink_rel&number=20490
6 years, 10 months ago (2014-02-05 10:53:26 UTC) #19
r.kasibhatla
The CQ bit was checked by r.kasibhatla@samsung.com
6 years, 10 months ago (2014-02-05 11:54:49 UTC) #20
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/r.kasibhatla@samsung.com/145033013/110001
6 years, 10 months ago (2014-02-05 11:55:01 UTC) #21
commit-bot: I haz the power
Change committed as 166491
6 years, 10 months ago (2014-02-05 12:24:29 UTC) #22
sof
https://codereview.chromium.org/145033013/diff/110001/Tools/Scripts/webkitpy/style/checkers/cpp.py File Tools/Scripts/webkitpy/style/checkers/cpp.py (right): https://codereview.chromium.org/145033013/diff/110001/Tools/Scripts/webkitpy/style/checkers/cpp.py#newcode3533 Tools/Scripts/webkitpy/style/checkers/cpp.py:3533: _RE_GENERAL_MACRO_PATTERN_STRING = re.compile(r'\s*DEFINE_(\w*)TYPE_CASTS\(%s,(.+)(\);$)' % class_name) Doesn't this need a ...
6 years, 10 months ago (2014-02-05 13:26:46 UTC) #23
r.kasibhatla
6 years, 10 months ago (2014-02-05 13:53:02 UTC) #24
Message was sent while issue was closed.
A revert of this CL has been created in
https://codereview.chromium.org/153953009/ by r.kasibhatla@samsung.com.

The reason for reverting is: The patch will be breaking the style check on the
patch since the regex compiled _RE_GENERAL_MACRO_PATTERN_STRING &
_RE_GENERAL_MACRO_PATTERN_STRING are not correct.

The regex (mentioned above) needs to be set properly. Will be uploading new
patch with correct regex..

Powered by Google App Engine
This is Rietveld 408576698