Skip to content

Baselibs AutoSD Fixes#261

Open
odra wants to merge 3 commits into
eclipse-score:mainfrom
eclipse-score-fork-rh:baselibs-autosd-fix
Open

Baselibs AutoSD Fixes#261
odra wants to merge 3 commits into
eclipse-score:mainfrom
eclipse-score-fork-rh:baselibs-autosd-fix

Conversation

@odra

@odra odra commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Changes

  • Fixes warnings for GCC 14 (used in AutoSD)
  • Explicit usage of -D_GNU_SOURCE for GCC 14 (does not break GCC 12)

@odra odra requested review from 4og and antonkri as code owners June 10, 2026 09:46
@github-project-automation github-project-automation Bot moved this to In Progress in BAS - Baselibs FT Jun 10, 2026
@odra odra temporarily deployed to workflow-approval June 10, 2026 09:46 — with GitHub Actions Inactive
@odra odra temporarily deployed to workflow-approval June 10, 2026 09:46 — with GitHub Actions Inactive
@odra odra changed the title gBaselibs autosd fix Baselibs AutoSD Fixes Jun 10, 2026
@github-actions

Copy link
Copy Markdown

The created documentation from the pull request is available at: docu-html

@4og

4og commented Jun 11, 2026

Copy link
Copy Markdown
Member

@fbaeuerle, can you please have a look?

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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_SOURCE via //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::move on 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.

Comment on lines 41 to 43
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", [])

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's now possible to inject an own openssl lib via a label_flag:

# Allows integrating workspaces to redirect the OpenSSL crypto implementation
# without modifying this file. The default points to the BCR-provided module.
# Override example (in the integrating workspace's .bazelrc):
# build --@score_baselibs//third_party/openssl:openssl_crypto_impl=//my/openssl:target
label_flag(
name = "openssl_crypto_impl",
build_setting_default = "@openssl//:crypto",
visibility = ["//visibility:public"],
)

Would this be a better option than changing compile options in this transition?

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.

Is the idea here to provide an alternative Bazel module / component to manage the openssl build / integration in baselibs?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Correct, it gives an option to substitute openssl from BCR with the openssl provided by the system.

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.

ok, that makes sense. let me remove my openssl change from this pr then.

@odra odra force-pushed the baselibs-autosd-fix branch from 7e395b9 to b9ffc55 Compare June 17, 2026 11:01
@odra odra temporarily deployed to workflow-approval June 17, 2026 11:02 — with GitHub Actions Inactive
@odra odra temporarily deployed to workflow-approval June 17, 2026 11:02 — with GitHub Actions Inactive

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.

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)

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.

The self move warnings can be suppressed like this

    DISABLE_WARNING_PUSH
    DISABLE_WARNING_SELF_MOVE

    scope = std::move(scope);

see

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");

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.

I wonder if just removing the & would also work to get rid of the dangling-reference error. Above it seems to work.

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.

It fixed it for primitive types but it required a little bit for objects and lists.

pypingou and others added 3 commits June 18, 2026 05:30
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>
@odra odra force-pushed the baselibs-autosd-fix branch from b9ffc55 to 1cdb9fc Compare June 18, 2026 09:30
@odra odra temporarily deployed to workflow-approval June 18, 2026 09:31 — with GitHub Actions Inactive
@odra odra temporarily deployed to workflow-approval June 18, 2026 09:31 — with GitHub Actions Inactive
Comment on lines +275 to +276
auto* target_ptr = &target;
target = std::move(*target_ptr);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How does the compiler warning look like?
With the DISABLE_WARNING_PUSH above there shouldn't be the need to change this code.

@4og 4og requested a review from sankurm June 19, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

6 participants