Closed Bug 1239539 Opened 4 years ago Closed 4 years ago

Enable clang's -Wclass-varargs warnings

Categories

(Firefox Build System :: General, defect)

defect
Not set

Tracking

(firefox46 fixed)

RESOLVED FIXED
mozilla46
Tracking Status
firefox46 --- fixed

People

(Reporter: cpeterson, Assigned: cpeterson)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

-Wclass-varargs catches objects passed by value to variadic functions. -Wclass-varargs was enabled for C++ in js/src in bug 1235185.

This clang commit message is the closet thing to documentation about -Wclass-varargs:

https://github.com/llvm-mirror/clang/commit/93fe566800e0a636442b4b61247c57b08de952c5

Here is a green Try build with -Wclass-varargs enabled:

https://treeherder.mozilla.org/#/jobs?repo=try&revision=b1033040c96d
Attachment #8707708 - Flags: review?(mh+mozilla)
The most common variadic function in mozilla-central is MOZ_LOG(), which is technically a macro calling mozilla::detail::log_print().

Follow-up work could include annotating log_print() as a MOZ_FORMAT_PRINTF() function (like printf_stderr) so -Wformat warnings can type check MOZ_LOG()'s format string parameters.
Attachment #8707708 - Flags: review?(mh+mozilla) → review+
https://hg.mozilla.org/mozilla-central/rev/fe0896c1584a
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.