summaryrefslogtreecommitdiff
path: root/CMake
diff options
context:
space:
mode:
authorGravatar Greg Falcon <gfalcon@google.com>2023-06-12 08:25:06 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2023-06-12 08:26:01 -0700
commita3d9a943253f596bd88538f18cc6b07aaba6d3c0 (patch)
tree168cc3be0abfaaf12e646a8279f0183663f7e18a /CMake
parent4500c2fada4e952037c59bd65e8be1ba0b29f21e (diff)
Fix behaviors of StrCat() and StrFormat() regarding char types and enum types.
This is a conservative change, in that it only contains bugfixes and allows new patterns that used to be compile errors. There are other changes we would like to make (as reflected in the comments in char_formatting_test.cc), but we are being careful about the implications of such behavior changes. The two implementation changes are: * Apply integral promotions to enums before printing them, so they are always treated as integers (and not chars) by StrCat and StrFormat. * Classify `unsigned char` and `signed char` as integer-like rather than char-like, so that `StrFormat("%v", v)` accepts those types as integers (consistent with `StrCat()`.) The behavior changes are: * StrCat() now accepts char-backed enums (rather than failing to compile). * StrFormat("%v") now accepts `signed char` and `unsigned char` as integral (rather than failing to compile). * StrFormat("%v") now correctly formats 8-bit enums as integers (rather than failing internally and emitting nothing). Tested: Modified the char_formatting_test.cc case to reflect changes. Re-ran all other tests. PiperOrigin-RevId: 539659674 Change-Id: Ief56335f5a57e4582af396d00eaa9e7b6be4ddc6
Diffstat (limited to 'CMake')
0 files changed, 0 insertions, 0 deletions