Skip to content

Cherry pick various portability fixes from mainline#12703

Merged
fowles merged 4 commits intoprotocolbuffers:22.xfrom
fowles:22.x
May 8, 2023
Merged

Cherry pick various portability fixes from mainline#12703
fowles merged 4 commits intoprotocolbuffers:22.xfrom
fowles:22.x

Conversation

@fowles
Copy link
Copy Markdown
Contributor

@fowles fowles commented May 7, 2023

No description provided.

coryan added 4 commits May 7, 2023 16:38
When the protobuf libraries have been compiled as shared libraries the users of the library need to add `-DPROTOBUF_USE_DLLS` to their build line. Otherwise some symbols are missing.

Fixes #12699

FWIW, I am not sure this is an ideal fix.  It may be better to fix the headers such that no macros change the ABI.

Closes #12700

COPYBARA_INTEGRATE_REVIEW=#12700 from coryan:fix-define-protobuf-use-dlls-in-pkg-config-file 13c792e
PiperOrigin-RevId: 530116678
My sketch to fix #12672 was wrong.  This works for realsies.

Closes #12698

COPYBARA_INTEGRATE_REVIEW=#12698 from coryan:fix-cmake-typo-in-string-join-workaround 182d2e2
PiperOrigin-RevId: 530116824
On Wndows, `size_t` is 64-bits, and `int` is 32-bits. That makes conversions from `size_t` to `int` potentially lossy, and they generate warnings.  In this case an `int` variable was assigned to `size_t` and then passed to functions consuming `int`. Seems simpler to use `auto` and avoid these problems altogether.

Closes #12701

COPYBARA_INTEGRATE_REVIEW=#12701 from coryan:fix-warnings-repeated-field-warnings-in-msvc b1ec34d
PiperOrigin-RevId: 530134611
Warnings in header files can be a problem for consumers that enable `/WX` (or `-Werror`).  In this case, using `... & -align` produces a warning (C4146) with MSVC. The fix is to use equivalent expression `...  & ~(align - 1)`, which was already used in the same file.

Fixes #12675

Closes #12697

COPYBARA_INTEGRATE_REVIEW=#12697 from coryan:fix-msvc-warnings-in-arena-align 835f3b4
PiperOrigin-RevId: 530137165
@fowles fowles added 🅰️ safe for tests Mark a commit as safe to run presubmits over back-port Cherrypick PRs to release branches labels May 7, 2023
@fowles fowles marked this pull request as ready for review May 7, 2023 20:41
@github-actions github-actions bot removed the 🅰️ safe for tests Mark a commit as safe to run presubmits over label May 7, 2023
@mkruskal-google mkruskal-google added the 🅰️ safe for tests Mark a commit as safe to run presubmits over label May 8, 2023
@github-actions github-actions bot removed the 🅰️ safe for tests Mark a commit as safe to run presubmits over label May 8, 2023
@fowles fowles merged commit 040a7cf into protocolbuffers:22.x May 8, 2023
@fowles fowles deleted the 22.x branch May 8, 2023 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

back-port Cherrypick PRs to release branches

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants