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