Skip to content

fix: avoid warnings with MSVC#12762

Closed
coryan wants to merge 2 commits intoprotocolbuffers:mainfrom
coryan:fix-avoid-warnings-with-MSVC
Closed

fix: avoid warnings with MSVC#12762
coryan wants to merge 2 commits intoprotocolbuffers:mainfrom
coryan:fix-avoid-warnings-with-MSVC

Conversation

@coryan
Copy link
Copy Markdown
Contributor

@coryan coryan commented May 11, 2023

In both cases a size_t was being converted to a uint32_t. These headers are used from application code, or at least from generated code, and the application may be compiling with more warnings enabled than normal.

In both cases a `size_t` was being converted to a `uint32_t`. These
headers are used from application code, or at least from generated code,
and the application may be compiling with more warnings enabled than
normal.
@coryan coryan requested a review from a team as a code owner May 11, 2023 11:01
@coryan coryan requested review from ericsalo and removed request for a team May 11, 2023 11:01
@@ -145,7 +145,8 @@ inline StringBlock* StringBlock::Emplace(void* p, size_t n, StringBlock* next) {
ABSL_DCHECK_EQ(n, NextSize(next));
uint32_t doubled = static_cast<uint32_t>(n) * 2;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rather than having the static_cast twice in this function, can you pull a local?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed that, done. Do you still want the doubled temporary?

@fowles fowles added the 🅰️ safe for tests Mark a commit as safe to run presubmits over label May 11, 2023
@github-actions github-actions bot removed the 🅰️ safe for tests Mark a commit as safe to run presubmits over label May 11, 2023
@fowles fowles added the 🅰️ safe for tests Mark a commit as safe to run presubmits over label May 11, 2023
@github-actions github-actions bot removed the 🅰️ safe for tests Mark a commit as safe to run presubmits over label May 11, 2023
@coryan coryan deleted the fix-avoid-warnings-with-MSVC branch May 12, 2023 15:25
fowles added a commit that referenced this pull request May 12, 2023
fix: avoid warnings with MSVC (#12762)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants