Closed Bug 1766561 Opened 2 years ago Closed 2 years ago

Enable MOZ_FORMAT_PRINTF in Windows builds

Categories

(Core :: General, task)

task

Tracking

()

RESOLVED FIXED
102 Branch
Tracking Status
firefox102 --- fixed

People

(Reporter: glandium, Assigned: glandium)

References

Details

Attachments

(13 files)

48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
No description provided.
Depends on: 1766568

Using %0p raises the following error when printf annotations are enabled:

error: flag '0' results in undefined behavior with 'p' conversion specifier

Unfortunately, while with MSVC one would use the I modifier to format
LPARAM/LONG_PTR, it doesn't work with clang-cl on 32-bits, because
LONG_PTR there is long, but I expects an int.

With MOZ_FORMAT_PRINTF annotations, the compiler expects a wchar_t*, and
it won't automatically consider char16ptr_t to be compatible with that.

While handling strings, there's one case of formatting that doesn't need
to use %S at all.

  • Missing/Extra formatting directives
  • Typos in formatting directives
  • Non-literal strings used as formatting strings
  • Wrong types passed as argument
  • Swapped arguments
  • Commas between parts of unique formatting strings

clang-cl doesn't define GNUC. Also for some reason, clang-cl doesn't
like the use of MOZ_FORMAT_PRINTF on a function definition (while clang
is apparently happy with it).

Blocks: 1766371
Pushed by mh@glandium.org:
https://hg.mozilla.org/integration/autoland/rev/a6ecfc4bb04e
clang-format the files we're about to touch. r=andi
https://hg.mozilla.org/integration/autoland/rev/d5c6d85c4bac
Adapt formatting to the difference in ProcessId type across platforms. r=nika,necko-reviewers,kershaw
https://hg.mozilla.org/integration/autoland/rev/e8da2626eb78
Replace %0p with %p. r=nika
https://hg.mozilla.org/integration/autoland/rev/9a91f6d0586e
Use %p for pointer types. r=gfx-reviewers,rkraesig,nika,jrmuizel
https://hg.mozilla.org/integration/autoland/rev/7e166ba7f2a8
Use %lu for Windows Error types (DWORD). r=rkraesig,xpcom-reviewers,application-update-reviewers,mhowell,bobowen,necko-reviewers,keeler,media-playback-reviewers,bytesized,barret,alwu,kershaw
https://hg.mozilla.org/integration/autoland/rev/6395d8b4c146
Add missing l modifier for HRESULT formatting. r=media-playback-reviewers,gfx-reviewers,nika,necko-reviewers,rkraesig,alwu,kershaw
https://hg.mozilla.org/integration/autoland/rev/d544976715e1
Use proper formatting directives for LPARAM and WPARAM. r=Jamie,rkraesig
https://hg.mozilla.org/integration/autoland/rev/1f8659bc50a2
Add missing l modifier for long formatting. r=Jamie,media-playback-reviewers,gfx-reviewers,nika,necko-reviewers,mhowell,rkraesig,gerald,application-update-reviewers,bytesized,alwu,kershaw
https://hg.mozilla.org/integration/autoland/rev/ecf8a55ccad1
Add missing z modifier for size_t formatting. r=gfx-reviewers,necko-reviewers,keeler,rkraesig,kershaw
https://hg.mozilla.org/integration/autoland/rev/b8a9e8c33b90
Adjust UTF-16 string formatting. r=nika
https://hg.mozilla.org/integration/autoland/rev/667cc7160e4a
Use proper formatting directives in various places. r=gfx-reviewers,nika,necko-reviewers,mhowell,rkraesig,bytesized,kershaw
https://hg.mozilla.org/integration/autoland/rev/50248597686a
Fix various formatting errors. r=media-playback-reviewers,gfx-reviewers,nika,necko-reviewers,rkraesig,alwu,padenot,kershaw
https://hg.mozilla.org/integration/autoland/rev/803df6c16113
Enable MOZ_FORMAT_PRINTF on all clang builds. r=nika
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: