Cleaning up or removing base/format_macros.h

15 views
Skip to first unread message

Lei Zhang

unread,
Mar 2, 2022, 3:19:51 PMMar 2
to cxx
This header dates back from around 2009 when Chromium's build
environment was very different. Does anyone have concerns about
getting rid of some of the #defines there? In particular:

1) Use %zu instead of PRIuS everywhere.
2) WidePRId64 and friends are not used anywhere.

I didn't look at the Mac-specific #defines, but if those can go away
too, then there would be nothing left in the header.

Avi Drissman

unread,
Mar 2, 2022, 3:51:52 PMMar 2
to Lei Zhang, cxx
I would be in favor of this cleanup.

--
You received this message because you are subscribed to the Google Groups "cxx" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cxx+uns...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/cxx/CACSHbcR_gnJhWyJ7Pt37%3DRGPYP%3D7j-U8snFmB1_eV6g641xA%3Dw%40mail.gmail.com.

Daniel Cheng

unread,
Mar 2, 2022, 3:58:37 PMMar 2
to Avi Drissman, Lei Zhang, cxx
+1 if we don't need these format macros, it makes sense to remove this header.

Daniel

Sylvain Defresne

unread,
Mar 3, 2022, 4:50:48 AMMar 3
to Daniel Cheng, Avi Drissman, Lei Zhang, cxx
Please don't remove PRIuNS, PRIdNS and PRIxNS as they are used on iOS to support both 32-bit and 64-bit builds (32-bit builds are still used from cronet iirc). Thus the header cannot go away yet (at least not until cronet removes support for 32-bit build).
-- Sulvain

dan...@chromium.org

unread,
Mar 3, 2022, 9:19:40 AMMar 3
to Sylvain Defresne, Daniel Cheng, Avi Drissman, Lei Zhang, cxx
Would it make sense to move the header to cronet?

Sylvain Defresne

unread,
Mar 3, 2022, 9:43:13 AMMar 3
to dan...@chromium.org, Daniel Cheng, Avi Drissman, Lei Zhang, cxx
It looks like the macro is used in ios/chrome, but we could convert all those uses to the 64-bit version of the macro, and then move the header to components/cronet/ios. So, yes after converting ios/chrome.
-- Sylvain

Mark Mentovai

unread,
Mar 3, 2022, 10:38:12 AMMar 3
to Sylvain Defresne, Dana Jansens, Daniel Cheng, Avi Drissman, Lei Zhang, cxx
I suggest moving the Apple-specific macros to live in an Apple-only file in base/mac. It’s true that their only utility at present is to support cronet, but cronet depends on base and those macros are lightly used in base, in tests at least.

In general, for formatting NSInteger and NSUInteger, I do prefer the macros to other alternatives.

Mark

Lei Zhang

unread,
Mar 9, 2022, 8:22:34 PMMar 9
to Mark Mentovai, Sylvain Defresne, Dana Jansens, Daniel Cheng, Avi Drissman, cxx
If there are no objections, I'll remove the non-Apple macros. When
only Apple-specific macros remain, we can move the file into base/mac.
Reply all
Reply to author
Forward
0 new messages