Skip to content

Conversation

dotnwat
Copy link
Contributor

@dotnwat dotnwat commented Aug 20, 2024

this needs to be explicitly captured to avoid the warning.

@dotnwat dotnwat requested a review from a team as a code owner August 20, 2024 20:32
@dotnwat dotnwat requested review from sbenzaquen and removed request for a team August 20, 2024 20:32
@acozzette acozzette added the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Aug 28, 2024
@github-actions github-actions bot removed the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Aug 28, 2024
@acozzette
Copy link
Contributor

This seems to cause some compiler errors like this one:

src/google/protobuf/map.cc:123:30: error: capture default must be first
  123 |     const auto loop = [this, =](auto destroy_node) ***
      |                              ^

`this` needs to be explicitly captured to avoid the warning.
@dotnwat
Copy link
Contributor Author

dotnwat commented Aug 29, 2024

This seems to cause some compiler errors like this one:

🤦 thanks. fixed

@tonyliaoss tonyliaoss added the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Sep 18, 2024
@github-actions github-actions bot removed the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Sep 18, 2024
@JasonLunn JasonLunn added the c++ label Oct 9, 2024
copybara-service bot pushed a commit that referenced this pull request Oct 9, 2024
`this` needs to be explicitly captured to avoid the warning.

Closes #17882

COPYBARA_INTEGRATE_REVIEW=#17882 from dotnwat:patch-1 348ce1b
FUTURE_COPYBARA_INTEGRATE_REVIEW=#17882 from dotnwat:patch-1 348ce1b
PiperOrigin-RevId: 684130417
copybara-service bot pushed a commit that referenced this pull request Oct 9, 2024
`this` needs to be explicitly captured to avoid the warning.

Closes #17882

COPYBARA_INTEGRATE_REVIEW=#17882 from dotnwat:patch-1 348ce1b
FUTURE_COPYBARA_INTEGRATE_REVIEW=#17882 from dotnwat:patch-1 348ce1b
PiperOrigin-RevId: 684130417
copybara-service bot pushed a commit that referenced this pull request Oct 9, 2024
`this` needs to be explicitly captured to avoid the warning.

Closes #17882

COPYBARA_INTEGRATE_REVIEW=#17882 from dotnwat:patch-1 348ce1b
FUTURE_COPYBARA_INTEGRATE_REVIEW=#17882 from dotnwat:patch-1 348ce1b
PiperOrigin-RevId: 684130417
copybara-service bot pushed a commit that referenced this pull request Oct 10, 2024
`this` needs to be explicitly captured to avoid the warning.

Closes #17882

COPYBARA_INTEGRATE_REVIEW=#17882 from dotnwat:patch-1 348ce1b
FUTURE_COPYBARA_INTEGRATE_REVIEW=#17882 from dotnwat:patch-1 348ce1b
PiperOrigin-RevId: 683267693
copybara-service bot pushed a commit that referenced this pull request Oct 10, 2024
See actions/runner-images#10721.

#test-continuous

COPYBARA_INTEGRATE_REVIEW=#17882 from dotnwat:patch-1 348ce1b
FUTURE_COPYBARA_INTEGRATE_REVIEW=#17882 from dotnwat:patch-1 348ce1b
PiperOrigin-RevId: 683309141
copybara-service bot pushed a commit that referenced this pull request Oct 10, 2024
COPYBARA_INTEGRATE_REVIEW=#17882 from dotnwat:patch-1 348ce1b
FUTURE_COPYBARA_INTEGRATE_REVIEW=#17882 from dotnwat:patch-1 348ce1b
PiperOrigin-RevId: 683711248
copybara-service bot pushed a commit that referenced this pull request Oct 10, 2024
…string.

As an optimization, we maintain a default instance of a string in memory, and
messages with uninitialized fields will be constructed with a pointer to this
default string object. The destructor should clear the field only when it is
"set" to a nondefault object.

We additionally maintain the invariant that, if hasbit exists for the field,
that the hasbit is only set when the string is nondefault. In other words,
hasbit is set iff string field points to a "real" string object instead of the
default one.

This invariant allows us to deallocate the string directly if hasbit is set,
without an additional branch to check that the string is nondefault.

If `ClearNonDefaultToEmpty()` is ever called on a default string...
- it's ok in the sense that you're just overwriting an object in memory with a
  bunch of zeros.
- but it's quite bad for a number of reasons:
  1. It can confuse TSAN.
  2. It blocks us from moving the default instance of the string into the
     `.data` section. Having the default instance of the string live in
     read-only memory would be beneficial for memory safety. It would play well
     with hugepages. It would also eliminate some runtime cost of instantiating
     the default instance of the string.

This change adds a debug-fail so that users don't call this function "unsafely".

COPYBARA_INTEGRATE_REVIEW=#17882 from dotnwat:patch-1 348ce1b
FUTURE_COPYBARA_INTEGRATE_REVIEW=#17882 from dotnwat:patch-1 348ce1b
PiperOrigin-RevId: 683766870
copybara-service bot pushed a commit that referenced this pull request Oct 10, 2024
…2024.

COPYBARA_INTEGRATE_REVIEW=#17882 from dotnwat:patch-1 348ce1b
FUTURE_COPYBARA_INTEGRATE_REVIEW=#17882 from dotnwat:patch-1 348ce1b
PiperOrigin-RevId: 683720816
copybara-service bot pushed a commit that referenced this pull request Oct 10, 2024
COPYBARA_INTEGRATE_REVIEW=#17882 from dotnwat:patch-1 348ce1b
FUTURE_COPYBARA_INTEGRATE_REVIEW=#17882 from dotnwat:patch-1 348ce1b
PiperOrigin-RevId: 684172160
copybara-service bot pushed a commit that referenced this pull request Oct 10, 2024
COPYBARA_INTEGRATE_REVIEW=#17882 from dotnwat:patch-1 348ce1b
FUTURE_COPYBARA_INTEGRATE_REVIEW=#17882 from dotnwat:patch-1 348ce1b
PiperOrigin-RevId: 684410218
@copybara-service copybara-service bot mentioned this pull request Oct 10, 2024
copybara-service bot pushed a commit that referenced this pull request Oct 10, 2024
COPYBARA_INTEGRATE_REVIEW=#17882 from dotnwat:patch-1 348ce1b
FUTURE_COPYBARA_INTEGRATE_REVIEW=#17882 from dotnwat:patch-1 348ce1b
PiperOrigin-RevId: 684021028
@copybara-service copybara-service bot mentioned this pull request Oct 10, 2024
copybara-service bot pushed a commit that referenced this pull request Oct 10, 2024
Remove runtime methods that support the Objective-C gencode from before the 3.22.x release.

COPYBARA_INTEGRATE_REVIEW=#17882 from dotnwat:patch-1 348ce1b
FUTURE_COPYBARA_INTEGRATE_REVIEW=#17882 from dotnwat:patch-1 348ce1b
PiperOrigin-RevId: 684168538
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants