Closed Bug 1202965 Opened 4 years ago Closed 4 years ago

Add MOZ_UNUSED

Categories

(Core :: MFBT, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla43
Tracking Status
firefox43 --- fixed

People

(Reporter: njn, Assigned: njn)

Details

Attachments

(2 files)

mozilla::unused is nice but can't be used in (a) C code, and (b) C++ code where linking with unused.o is tricky.

Therefore a fallback macro MOZ_UNUSED will be useful. I already have several places where it will be useful.
Attachment #8658508 - Flags: review?(nfroyd)
Attachment #8658509 - Flags: review?(mh+mozilla)
Attachment #8658509 - Flags: review?(mh+mozilla) → review+
With all the back and forth on that file, we might as well have fixed it to use write's return value.
Comment on attachment 8658508 [details] [diff] [review]
(part 1) - Add MOZ_UNUSED

Review of attachment 8658508 [details] [diff] [review]:
-----------------------------------------------------------------

::: mfbt/unused.h
@@ +34,5 @@
> +#endif // __cplusplus
> +
> +// An alternative to mozilla::unused for use in (a) C code and (b) code where
> +// linking with unused.o is difficult.
> +#define MOZ_UNUSED(expr) \

I almost want to hide this thusly:

#ifdef MOZ_MOZILLA_UNUSED_DOESNT_WORK_HERE
#define MOZ_UNUSED(expr) ...
#undef MOZ_MOZILLA_UNUSED_DOESNT_WORK_HERE
#endif

(only half joking here).
Attachment #8658508 - Flags: review?(nfroyd) → review+
https://hg.mozilla.org/mozilla-central/rev/4805fa9a89fe
https://hg.mozilla.org/mozilla-central/rev/7a715b603ac0
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla43
You need to log in before you can comment on or make changes to this bug.