Baselibs AutoSD Fixes#261
Conversation
|
The created documentation from the pull request is available at: docu-html |
|
@fbaeuerle, can you please have a look? |
There was a problem hiding this comment.
Pull request overview
This PR updates build/test code to address GCC 14 warnings in the AutoSD environment, including explicitly defining _GNU_SOURCE for the OpenSSL build configuration.
Changes:
- Extend the OpenSSL Bazel transition to add
-D_GNU_SOURCEvia//command_line_option:copt. - Update multiple unit tests to avoid GCC 14 self-move and pessimizing-move warnings (e.g., self-move assignment patterns, unnecessary
std::moveon return values). - Refactor a few JSON parser tests to avoid reference binding patterns that trigger newer compiler diagnostics.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| third_party/openssl/openssl_transition.bzl | Adds -D_GNU_SOURCE to OpenSSL’s transitioned --copt settings. |
| score/memory/shared/lock_file_test.cpp | Adjusts self-move assignment test to avoid compiler self-move diagnostics. |
| score/language/safecpp/scoped_function/scope_test.cpp | Adjusts self-move assignment test to avoid compiler self-move diagnostics. |
| score/language/safecpp/scoped_function/details/allocator_wrapper_test.cpp | Adjusts self-move assignment test to avoid compiler self-move diagnostics. |
| score/language/safecpp/scoped_function/details/allocator_aware_type_erasure_pointer_test.cpp | Adjusts self-move assignment test to avoid compiler self-move diagnostics. |
| score/json/internal/parser/parsers_test_suite.h | Refactors value extraction in tests to avoid problematic reference patterns under newer compilers. |
| score/containers/intrusive_list_test.cpp | Adjusts self-move assignment test to avoid compiler self-move diagnostics. |
| score/containers/dynamic_array_test.cpp | Adjusts self-move assignment test to avoid compiler self-move diagnostics. |
| score/concurrency/task_result_test.cpp | Removes unnecessary std::move on return value to avoid pessimizing-move warnings. |
| score/concurrency/future/interruptible_shared_future_test.cpp | Removes unnecessary std::move on temporaries to avoid pessimizing-move warnings. |
| score/concurrency/future/base_interruptible_promise_test.cpp | Adjusts self-move assignment test to avoid compiler self-move diagnostics. |
| score/concurrency/future/base_interruptible_future_test.cpp | Removes unnecessary std::move on temporaries to avoid pessimizing-move warnings. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| current = list(settings["//command_line_option:features"]) | ||
| current_copts = settings.get("//command_line_option:copt", []) | ||
| updated = [] |
|
|
||
| def _openssl_transition_impl(settings, attr): | ||
| current = list(settings["//command_line_option:features"]) | ||
| current_copts = settings.get("//command_line_option:copt", []) |
There was a problem hiding this comment.
It's now possible to inject an own openssl lib via a label_flag:
baselibs/third_party/openssl/BUILD
Lines 17 to 25 in 41b4af6
Would this be a better option than changing compile options in this transition?
There was a problem hiding this comment.
Is the idea here to provide an alternative Bazel module / component to manage the openssl build / integration in baselibs?
There was a problem hiding this comment.
Correct, it gives an option to substitute openssl from BCR with the openssl provided by the system.
There was a problem hiding this comment.
ok, that makes sense. let me remove my openssl change from this pr then.
7e395b9 to
b9ffc55
Compare
There was a problem hiding this comment.
Looks like redundant-move was issued as warning, to remove the redundant moves is legitimate.
|
|
||
| // when doing a self-move-assign | ||
| unit = std::move(unit); | ||
| // when doing a self-move-assign (use pointer indirection to avoid compiler warning) |
There was a problem hiding this comment.
The self move warnings can be suppressed like this
DISABLE_WARNING_PUSH
DISABLE_WARNING_SELF_MOVE
scope = std::move(scope);
| auto root = TypeParam::FromBuffer(buffer_simple_json); | ||
|
|
||
| // When reading a key of an object that is interpreted as number | ||
| auto& value = GetValueOfObject<Object>(root.value(), "object"); |
There was a problem hiding this comment.
I wonder if just removing the & would also work to get rid of the dangling-reference error. Above it seems to work.
There was a problem hiding this comment.
It fixed it for primitive types but it required a little bit for objects and lists.
GCC 14's -Werror=self-move detects self-move assignments. These occur in tests that intentionally verify self-move safety of various types. Solution: use pointer indirection to hide self-moves from compiler analysis: auto* ptr = &obj; obj = std::move(*ptr); This preserves the runtime behavior (self-move) while preventing the compile-time warning. Applied to test files for: DynamicArray, intrusive_list, Promise, AllocatorWrapper, TypeErasurePointer, Scope, and LockFile. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> Signed-off-by: Leonardo Rossetti <lrossett@redhat.com>
GCC 14's -Werror=pessimizing-move detects std::move() on return values, which prevents copy elision and forces unnecessary move operations. Solution: remove std::move() from temporary return values and let the compiler apply copy elision optimization. Applied to 7 instances across: - base_interruptible_future_test.cpp (4 instances) - interruptible_shared_future_test.cpp (2 instances) - task_result_test.cpp (1 instance) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> Signed-off-by: Leonardo Rossetti <lrossett@redhat.com>
Signed-off-by: Leonardo Rossetti <lrossett@redhat.com>
b9ffc55 to
1cdb9fc
Compare
| auto* target_ptr = ⌖ | ||
| target = std::move(*target_ptr); |
There was a problem hiding this comment.
How does the compiler warning look like?
With the DISABLE_WARNING_PUSH above there shouldn't be the need to change this code.
Changes
Explicit usage of-D_GNU_SOURCEfor GCC 14 (does not break GCC 12)