WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
146103
Refactor CheckedArithmeticOperations.cpp to use templates instead of macros
https://bugs.webkit.org/show_bug.cgi?id=146103
Summary
Refactor CheckedArithmeticOperations.cpp to use templates instead of macros
Mark Lam
Reported
2015-06-18 01:43:58 PDT
Presently, the tests in CheckedArithmeticOperations.cpp are all implemented as part of a large macro. This makes them harder to: 1. write: no editor help with indentations, have to add trailing '\'s, inconvenient to add line breaks and comments. 2. read: no chroma coding / syntax highlighting 3. debug: compile time errors are reported as being on the single line where the macro is used. Refactoring the tests to use C++ templates solves all these issues.
Attachments
patch for review.
(6.50 KB, patch)
2015-06-18 01:51 PDT
,
Mark Lam
andersca
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Mark Lam
Comment 1
2015-06-18 01:51:04 PDT
Created
attachment 255102
[details]
patch for review. Note: this patch contains unwanted artifacts that left in for the sole purpose of minimizing the diff so that the patch will be easier to review. The artifacts are documented in with comments in the patch, and will be removed before landing.
Basile Clement
Comment 2
2015-06-18 10:51:52 PDT
Comment on
attachment 255102
[details]
patch for review. View in context:
https://bugs.webkit.org/attachment.cgi?id=255102&action=review
Not a reviewer, but I think Coerser should be Coercer throughout the patch.
> Tools/TestWebKitAPI/Tests/WTF/CheckedArithmeticOperations.cpp:36 > + CheckedArithmeticTester<type, CoercerType, MixedSignednessTesterType>(); \
Shouldn't this be CheckedArithmeticTester<type, CoercerType, MixedSignednessTesterType>::run() ?
Mark Lam
Comment 3
2015-06-18 11:02:11 PDT
(In reply to
comment #2
)
> Comment on
attachment 255102
[details]
> patch for review. > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=255102&action=review
> > Not a reviewer, but I think Coerser should be Coercer throughout the patch. > > > Tools/TestWebKitAPI/Tests/WTF/CheckedArithmeticOperations.cpp:36 > > + CheckedArithmeticTester<type, CoercerType, MixedSignednessTesterType>(); \ > > Shouldn't this be CheckedArithmeticTester<type, CoercerType, > MixedSignednessTesterType>::run() ?
Eek, you are right. Fixing immediately.
Mark Lam
Comment 4
2015-06-18 11:10:00 PDT
(In reply to
comment #3
)
> (In reply to
comment #2
) > > Shouldn't this be CheckedArithmeticTester<type, CoercerType, > > MixedSignednessTesterType>::run() ? > > Eek, you are right. Fixing immediately.
For the record, I had tested it with CheckedArithmeticTester<type, CoercerType, MixedSignednessTesterType>::run(). However, I had tried to change the patch to use a function template instead of a class template (hence the error you saw), but that turned out to be less readable. So, I changed it back, but missed that one line. It is not fixed. Patch landed in
r185708
: <
http://trac.webkit.org/r185708
>. Followup fix landed in
r185711
: <
http://trac.webkit.org/r185711
>.
Mark Lam
Comment 5
2015-06-18 11:10:51 PDT
(In reply to
comment #4
)
> changed it back, but missed that one line. It is not fixed.
typo: I meant it is *now* fixed.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug