Commit 2ac5410d authored by thakis@chromium.org's avatar thakis@chromium.org

clang: Turn on -Wabsolute-value.

BUG=351479
TBR=hans@chromium.org
NOTRY=true

Review URL: https://codereview.chromium.org/274533004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271732 0039d316-1c4b-4281-b951-d872f2087c98
parent e4be88bd
...@@ -201,25 +201,25 @@ class ShelfDragCallback { ...@@ -201,25 +201,25 @@ class ShelfDragCallback {
// If dragging inwards from the visible state, then the shelf should // If dragging inwards from the visible state, then the shelf should
// increase in size, but not more than the scroll delta. // increase in size, but not more than the scroll delta.
EXPECT_LE(visible_bounds_size, shelf_size); EXPECT_LE(visible_bounds_size, shelf_size);
EXPECT_LE(abs(shelf_size - visible_bounds_size), EXPECT_LE(std::abs(shelf_size - visible_bounds_size),
abs(scroll_delta)); std::abs(scroll_delta));
} else { } else {
if (shelf_size > not_visible_bounds_size) { if (shelf_size > not_visible_bounds_size) {
// If dragging outwards from the visible state, then the shelf // If dragging outwards from the visible state, then the shelf
// should decrease in size, until it reaches the minimum size. // should decrease in size, until it reaches the minimum size.
EXPECT_EQ(shelf_size, visible_bounds_size - abs(scroll_delta)); EXPECT_EQ(shelf_size, visible_bounds_size - std::abs(scroll_delta));
} }
} }
} else { } else {
if (fabs(scroll_delta) < if (std::abs(scroll_delta) <
visible_bounds_size - not_visible_bounds_size) { visible_bounds_size - not_visible_bounds_size) {
// Tests that the shelf sticks with the touch point during the drag // Tests that the shelf sticks with the touch point during the drag
// until the shelf is completely visible. // until the shelf is completely visible.
EXPECT_EQ(shelf_size, not_visible_bounds_size + abs(scroll_delta)); EXPECT_EQ(shelf_size, not_visible_bounds_size + std::abs(scroll_delta));
} else { } else {
// Tests that after the shelf is completely visible, the shelf starts // Tests that after the shelf is completely visible, the shelf starts
// resisting the drag. // resisting the drag.
EXPECT_LT(shelf_size, not_visible_bounds_size + abs(scroll_delta)); EXPECT_LT(shelf_size, not_visible_bounds_size + std::abs(scroll_delta));
} }
} }
} }
......
...@@ -1583,8 +1583,8 @@ void ShelfView::PointerDraggedOnButton(views::View* view, ...@@ -1583,8 +1583,8 @@ void ShelfView::PointerDraggedOnButton(views::View* view,
// To prepare all drag types (moving an item in the shelf and dragging off), // To prepare all drag types (moving an item in the shelf and dragging off),
// we should check the x-axis and y-axis offset. // we should check the x-axis and y-axis offset.
if (!dragging() && drag_view_ && if (!dragging() && drag_view_ &&
((abs(event.x() - drag_offset_) >= kMinimumDragDistance) || ((std::abs(event.x() - drag_offset_) >= kMinimumDragDistance) ||
(abs(event.y() - drag_offset_) >= kMinimumDragDistance))) { (std::abs(event.y() - drag_offset_) >= kMinimumDragDistance))) {
PrepareForDrag(pointer, event); PrepareForDrag(pointer, event);
} }
if (drag_pointer_ == pointer) if (drag_pointer_ == pointer)
......
...@@ -343,7 +343,8 @@ void TouchUMA::RecordTouchEvent(aura::Window* target, ...@@ -343,7 +343,8 @@ void TouchUMA::RecordTouchEvent(aura::Window* target,
int distance = 0; int distance = 0;
if (details->last_touch_position_.count(event.touch_id())) { if (details->last_touch_position_.count(event.touch_id())) {
gfx::Point lastpos = details->last_touch_position_[event.touch_id()]; gfx::Point lastpos = details->last_touch_position_[event.touch_id()];
distance = abs(lastpos.x() - event.x()) + abs(lastpos.y() - event.y()); distance =
std::abs(lastpos.x() - event.x()) + std::abs(lastpos.y() - event.y());
} }
if (details->last_move_time_.count(event.touch_id())) { if (details->last_move_time_.count(event.touch_id())) {
......
...@@ -870,8 +870,8 @@ ImmersiveFullscreenController::GetSwipeType(ui::GestureEvent* event) const { ...@@ -870,8 +870,8 @@ ImmersiveFullscreenController::GetSwipeType(ui::GestureEvent* event) const {
if (event->type() != ui::ET_GESTURE_SCROLL_UPDATE) if (event->type() != ui::ET_GESTURE_SCROLL_UPDATE)
return SWIPE_NONE; return SWIPE_NONE;
// Make sure that it is a clear vertical gesture. // Make sure that it is a clear vertical gesture.
if (abs(event->details().scroll_y()) <= if (std::abs(event->details().scroll_y()) <=
kSwipeVerticalThresholdMultiplier * abs(event->details().scroll_x())) kSwipeVerticalThresholdMultiplier * std::abs(event->details().scroll_x()))
return SWIPE_NONE; return SWIPE_NONE;
if (event->details().scroll_y() < 0) if (event->details().scroll_y() < 0)
return SWIPE_CLOSE; return SWIPE_CLOSE;
......
...@@ -3672,9 +3672,6 @@ ...@@ -3672,9 +3672,6 @@
# code generated by flex (used in angle) contains that keyword. # code generated by flex (used in angle) contains that keyword.
# http://crbug.com/255186 # http://crbug.com/255186
'-Wno-deprecated-register', '-Wno-deprecated-register',
# TODO(thakis): Remove, http://crbug.com/341352
'-Wno-absolute-value',
], ],
'cflags!': [ 'cflags!': [
# Clang doesn't seem to know know this flag. # Clang doesn't seem to know know this flag.
...@@ -4422,9 +4419,6 @@ ...@@ -4422,9 +4419,6 @@
# keyword. http://crbug.com/255186 # keyword. http://crbug.com/255186
'-Wno-deprecated-register', '-Wno-deprecated-register',
# TODO(thakis): Remove, http://crbug.com/341352
'-Wno-absolute-value',
# This warns on selectors from Cocoa headers (-length, -set). # This warns on selectors from Cocoa headers (-length, -set).
# cfe-dev is currently discussing the merits of this warning. # cfe-dev is currently discussing the merits of this warning.
# TODO(thakis): Reevaluate what to do with this, based one # TODO(thakis): Reevaluate what to do with this, based one
...@@ -5065,7 +5059,6 @@ ...@@ -5065,7 +5059,6 @@
'-Wno-missing-braces', '-Wno-missing-braces',
'-Wno-missing-declarations', '-Wno-missing-declarations',
'-Wno-msvc-include', '-Wno-msvc-include',
'-Wno-absolute-value',
'-Wno-null-dereference', '-Wno-null-dereference',
'-Wno-overloaded-virtual', '-Wno-overloaded-virtual',
'-Wno-parentheses', '-Wno-parentheses',
......
...@@ -123,8 +123,8 @@ class AudioEncoderTest : public ::testing::TestWithParam<TestScenario> { ...@@ -123,8 +123,8 @@ class AudioEncoderTest : public ::testing::TestWithParam<TestScenario> {
for (size_t i = 0; i < scenario.num_durations; ++i) { for (size_t i = 0; i < scenario.num_durations; ++i) {
const bool simulate_missing_data = scenario.durations_in_ms[i] < 0; const bool simulate_missing_data = scenario.durations_in_ms[i] < 0;
const base::TimeDelta duration = const base::TimeDelta duration = base::TimeDelta::FromMilliseconds(
base::TimeDelta::FromMilliseconds(abs(scenario.durations_in_ms[i])); std::abs(scenario.durations_in_ms[i]));
receiver_->SetCaptureTimeBounds( receiver_->SetCaptureTimeBounds(
testing_clock_->NowTicks() - frame_duration, testing_clock_->NowTicks() - frame_duration,
testing_clock_->NowTicks() + duration); testing_clock_->NowTicks() + duration);
......
...@@ -56,13 +56,17 @@ ...@@ -56,13 +56,17 @@
['clang==1', { ['clang==1', {
'cflags': [ 'cflags': [
'-Wno-enum-conversion', '-Wno-enum-conversion',
'-Wno-switch' '-Wno-switch',
# libexif uses fabs(int) to cast to float.
'-Wno-absolute-value',
], ],
'xcode_settings': { 'xcode_settings': {
'WARNING_CFLAGS': [ 'WARNING_CFLAGS': [
'-Wno-enum-conversion', '-Wno-enum-conversion',
'-Wno-switch', '-Wno-switch',
'-Wno-format', '-Wno-format',
# libexif uses fabs(int) to cast to float.
'-Wno-absolute-value',
], ],
}, },
}], }],
......
...@@ -731,6 +731,7 @@ ...@@ -731,6 +731,7 @@
'xcode_settings': { 'xcode_settings': {
'WARNING_CFLAGS': [ 'WARNING_CFLAGS': [
'-Wno-tautological-constant-out-of-range-compare', '-Wno-tautological-constant-out-of-range-compare',
'-Wno-absolute-value', # Fires on st_atom_array.c, might be a bug
], ],
'WARNING_CFLAGS!': [ 'WARNING_CFLAGS!': [
# Don't warn about string->bool used in asserts. # Don't warn about string->bool used in asserts.
...@@ -739,6 +740,7 @@ ...@@ -739,6 +740,7 @@
}, },
'cflags': [ 'cflags': [
'-Wno-tautological-constant-out-of-range-compare', '-Wno-tautological-constant-out-of-range-compare',
'-Wno-absolute-value',
], ],
'cflags!': [ 'cflags!': [
'-Wstring-conversion', '-Wstring-conversion',
......
...@@ -303,12 +303,12 @@ void ContentsView::OnScrollEvent(ui::ScrollEvent* event) { ...@@ -303,12 +303,12 @@ void ContentsView::OnScrollEvent(ui::ScrollEvent* event) {
} }
float offset; float offset;
if (abs(event->x_offset()) > abs(event->y_offset())) if (std::abs(event->x_offset()) > std::abs(event->y_offset()))
offset = event->x_offset(); offset = event->x_offset();
else else
offset = event->y_offset(); offset = event->y_offset();
if (abs(offset) > kMinScrollToSwitchPage) { if (std::abs(offset) > kMinScrollToSwitchPage) {
if (!pagination_model_->has_transition()) { if (!pagination_model_->has_transition()) {
pagination_model_->SelectPageRelative(offset > 0 ? -1 : 1, pagination_model_->SelectPageRelative(offset > 0 ? -1 : 1,
true); true);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment