Closed Bug 1334286 Opened 7 years ago Closed 7 years ago

use MOZ_FORMAT_PRINTF in DMD

Categories

(Core :: DMD, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: tromey, Assigned: tromey)

References

Details

Attachments

(1 file)

Auditing printf-likes in bug 1060419 revealed that DMD could use
MOZ_FORMAT_PRINTF in a few spots, namely the various implementations
of StatusMsg.
Assignee: nobody → ttromey
IIUC to run this in try I have to also add a patch to update some moz config files.
Comment on attachment 8862053 [details]
Bug 1334286 - use MOZ_FORMAT_PRINTF in DMD;

https://reviewboard.mozilla.org/r/134006/#review137014

::: memory/replace/dmd/DMD.h:53
(Diff revision 1)
>  
>    virtual void Analyze(UniquePtr<JSONWriteFunc>);
>  
>    virtual void SizeOf(Sizes*);
>  
> -  virtual void StatusMsg(const char*, va_list);
> +  virtual void StatusMsg(const char*, va_list) MOZ_FORMAT_PRINTF(2, 0);

Is 0 the second arg here because it takes a va_list instead of ...? The docs in mfbt/Attributes.h don't mention that case.
Attachment #8862053 - Flags: review?(n.nethercote) → review+
(In reply to Tom Tromey :tromey from comment #2)
> IIUC to run this in try I have to also add a patch to update some moz config
> files.

You're in luck. DMD is enabled for debug builds on TreeHerder -- there is even an xpcshelltest -- so you won't have to do that.
(In reply to Nicholas Nethercote [:njn] from comment #3)

> > +  virtual void StatusMsg(const char*, va_list) MOZ_FORMAT_PRINTF(2, 0);
> 
> Is 0 the second arg here because it takes a va_list instead of ...?

Yes.  See also bug 1334279.
This is part of GCC's definition of the attribute.
Pushed by ttromey@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/9c090ad2183e
use MOZ_FORMAT_PRINTF in DMD; r=njn
https://hg.mozilla.org/mozilla-central/rev/9c090ad2183e
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: