Closed Bug 1156398 Opened 10 years ago Closed 10 years ago

Fix -Wunused-but-set-variable build warnings in widget/gonk/ProcessOrientation.cpp

Categories

(Core :: Hardware Abstraction Layer (HAL), defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla40
Tracking Status
firefox40 --- fixed

People

(Reporter: dholbert, Assigned: dholbert)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Build warning, when compiling an opt b2g build for a device: { widget/gonk/ProcessOrientation.cpp: In member function 'int mozilla::ProcessOrientation::OnSensorChanged(const mozilla::hal::SensorData&, int)': widget/gonk/ProcessOrientation.cpp:210:8: warning: variable 'isAccelerating' set but not used [-Wunused-but-set-variable] bool isAccelerating = false; ^ widget/gonk/ProcessOrientation.cpp:211:8: warning: variable 'isFlat' set but not used [-Wunused-but-set-variable] bool isFlat = false; ^ widget/gonk/ProcessOrientation.cpp:212:8: warning: variable 'isSwinging' set but not used [-Wunused-but-set-variable] bool isSwinging = false; ^ } These bools are only used in a LOGD statement, which is currently #ifdeffed to be a no-op, like so: > 30 #if 0 > 31 #define LOGD(args...) __android_log_print(ANDROID_LOG_DEBUG, "ProcessOrientation" , ## args) > 32 #else > 33 #define LOGD(args...) > 34 #endif > 35 The best way to hack around the build warning is probably just "mozilla::unused", I think. (DebugOnly<> won't work, because these variables aren't even used in debug builds, unless you tweak that "#if 0" check.)
Attached patch fix v1 (deleted) — Splinter Review
Assignee: nobody → dholbert
Status: NEW → ASSIGNED
Attachment #8594877 - Flags: review?(mwu)
You can't quite see it in the patch-context, but I'm adding these "unused <<" statements right after this LOGD statement which actually references these variables: http://mxr.mozilla.org/mozilla-central/source/widget/gonk/ProcessOrientation.cpp?rev=ae78bb875714&mark=303-303,311-312#303
Attachment #8594877 - Flags: review?(mwu) → review+
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: