Explicitly define kMaxBurst#522
Merged
Merged
Conversation
This is required for proper linking. Previously we were able to get away with not declaring kMaxBurst, because a compiler optimization ignores this issue when kMaxBurst is used for array sizing.
Codecov Report
@@ Coverage Diff @@
## master #522 +/- ##
==========================================
- Coverage 67.48% 64.57% -2.92%
==========================================
Files 198 198
Lines 12245 12246 +1
==========================================
- Hits 8264 7908 -356
- Misses 3981 4338 +357
Continue to review full report at Codecov.
|
changlan
approved these changes
Jun 15, 2017
Member
natexornate
added a commit
to natexornate/bess
that referenced
this pull request
Feb 7, 2022
kMaxBurst was declared and assigned a value, but not explicitly defined. This can cause issues when linking in cases where a reference may be taken of kMaxBurst (say, passing it to std::min()) and the constant can't be fully optimized out. This was actually fixed years ago in NetSys#522 but ended up being reverted accidentally during a refactor in NetSys#820. With C++17 now, we don't have to put the definition in a source file, we can just add inline and that takes care of it.
gab-arrobo
referenced
this pull request
in omec-project/bess
Jan 9, 2024
* Ensure that kMaxBurst is explicitly defined kMaxBurst was declared and assigned a value, but not explicitly defined. This can cause issues when linking in cases where a reference may be taken of kMaxBurst (say, passing it to std::min()) and the constant can't be fully optimized out. This was actually fixed years ago in #522 but ended up being reverted accidentally during a refactor in #820. With C++17 now, we don't have to put the definition in a source file, we can just add inline and that takes care of it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This is required for proper linking. Previously we were able to get away only with declaration (but without definition) of kMaxBurst, because a compiler optimization ignores this issue when kMaxBurst is used for array sizing.