Skip to content

Fix GCC 14 Compilation Warnings#107

Open
pypingou wants to merge 3 commits intoeclipse-score:mainfrom
pypingou:fix/compilation-warnings-gcc
Open

Fix GCC 14 Compilation Warnings#107
pypingou wants to merge 3 commits intoeclipse-score:mainfrom
pypingou:fix/compilation-warnings-gcc

Conversation

@pypingou
Copy link
Copy Markdown
Contributor

@pypingou pypingou commented May 6, 2026

This PR resolves two compilation errors encountered when building with GCC 14 and -Werror enabled.

Changes

  1. Fix ignored-attributes warning in unique_ptr deleter (persistentlogging_config.cpp)
  • Replaced decltype(&fclose) with a lambda deleter for std::unique_ptr<FILE>
  • GCC 14 raises -Werror=ignored-attributes because function attributes cannot be preserved through decltype in template arguments
  • The lambda wrapper provides identical functionality without triggering the warning
  1. Suppress use-after-free warning in disabled test (test_dltprotocol.cpp)
  • Added GCC diagnostic pragmas around intentional use-after-free in DISABLED_PackageFileDataShallReturnsNulloptIfItWorkedOnAlreadyClosedFile
  • This test is already disabled and deliberately passes a closed FILE* to verify error handling
  • The pragmas allow compilation with -Werror=use-after-free while preserving the test's original intent

Context

These warnings were discovered during compilation with GCC 14, which has stricter checks compared to previous versions. Both fixes maintain the existing behavior while satisfying the compiler's requirements.

Notes for Reviewer

Pre-Review Checklist for the PR Author

  • PR title is short, expressive and meaningful
  • Commits are properly organized
  • Relevant issues are linked in the References section
  • Tests are conducted
  • Unit tests are added

Checklist for the PR Reviewer

  • Commits are properly organized and messages are according to the guideline
  • Unit tests have been written for new behavior
  • Public API is documented
  • PR title describes the changes

Post-review Checklist for the PR Author

  • All open points are addressed and tracked via issues

References

Closes #

pypingou and others added 2 commits May 5, 2026 21:52
Wraps the intentional use-after-free in DISABLED_PackageFileDataShallReturnsNulloptIfItWorkedOnAlreadyClosedFile
with GCC diagnostic pragmas to suppress -Wuse-after-free warning.

This test is already disabled and intentionally passes a closed FILE*
to test error handling in PackageFileData. The pragmas allow compilation
with -Werror=use-after-free while preserving the test's intent.

Fixes compilation error:
error: pointer 'file' may be used after 'int fclose(FILE*)' [-Werror=use-after-free]

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Replaces decltype(&fclose) with a lambda deleter to avoid GCC warning
about function attributes being ignored in template argument.

Using decltype(&fclose) as a template argument for std::unique_ptr
triggers -Werror=ignored-attributes because GCC cannot preserve all
function attributes through decltype in this context. The lambda wrapper
provides identical functionality without triggering the warning.

Fixes compilation error:
error: ignoring attributes on template argument 'int (*)(FILE*)' [-Werror=ignored-attributes]

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@pypingou pypingou requested a deployment to workflow-approval May 6, 2026 07:20 — with GitHub Actions Waiting
@pypingou pypingou requested a deployment to workflow-approval May 6, 2026 07:20 — with GitHub Actions Waiting
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

License Check Results

🚀 The license check job ran with the Bazel command:

bazel run --lockfile_mode=error //:license-check

Status: ⚠️ Needs Review

Click to expand output
[License Check Output]
Extracting Bazel installation...
Starting local Bazel server (8.3.0) and connecting to it...
INFO: Invocation ID: c6f29cb3-56dc-4c45-b88e-60e78b8a7623
Computing main repo mapping: 
WARNING: For repository 'rules_python', the root module requires module version rules_python@1.4.1, but got rules_python@1.8.3 in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
WARNING: For repository 'bazel_skylib', the root module requires module version bazel_skylib@1.7.1, but got bazel_skylib@1.9.0 in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
WARNING: For repository 'rules_cc', the root module requires module version rules_cc@0.1.1, but got rules_cc@0.2.17 in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
WARNING: For repository 'aspect_rules_lint', the root module requires module version aspect_rules_lint@1.0.3, but got aspect_rules_lint@2.3.0 in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
WARNING: For repository 'buildifier_prebuilt', the root module requires module version buildifier_prebuilt@7.3.1, but got buildifier_prebuilt@8.5.1 in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
WARNING: For repository 'score_tooling', the root module requires module version score_tooling@1.1.2, but got score_tooling@1.2.0 in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
WARNING: For repository 'score_rust_policies', the root module requires module version score_rust_policies@0.0.3, but got score_rust_policies@0.0.5 in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
WARNING: For repository 'score_crates', the root module requires module version score_crates@0.0.6, but got score_crates@0.0.9 in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
WARNING: For repository 'googletest', the root module requires module version googletest@1.17.0.bcr.1, but got googletest@1.17.0.bcr.2 in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
WARNING: For repository 'rapidjson', the root module requires module version rapidjson@1.1.0, but got rapidjson@1.1.0.bcr.20241007 in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
Computing main repo mapping: 
Loading: 
Loading: 4 packages loaded
WARNING: Target pattern parsing failed.
ERROR: Skipping '//:license-check': no such target '//:license-check': target 'license-check' not declared in package '' defined by /home/runner/work/logging/logging/BUILD
Analyzing: 0 targets (5 packages loaded)
ERROR: no such target '//:license-check': target 'license-check' not declared in package '' defined by /home/runner/work/logging/logging/BUILD
INFO: Elapsed time: 7.266s
INFO: 0 processes.
ERROR: Build did NOT complete successfully
ERROR: Build failed. Not running target

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

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

@pypingou pypingou requested a review from pawelrutkaq as a code owner May 6, 2026 08:45
@pypingou pypingou requested a deployment to workflow-approval May 6, 2026 08:45 — with GitHub Actions Waiting
@pypingou pypingou requested a deployment to workflow-approval May 6, 2026 08:45 — with GitHub Actions Waiting
@pypingou
Copy link
Copy Markdown
Contributor Author

pypingou commented May 6, 2026

Note, I've added 1 commit to this PR which (almost*) fixes building logging on aarch64 natively

Add configuration and feature flags to support aarch64-linux builds
for the score_log_bridge Rust/C++ FFI interface.

Changes:
- Add aarch64-linux config_setting to BUILD file
- Include aarch64_linux in preprocessor checks (adapter.cpp, ffi.rs)
- Replace unstable Rust features with stable equivalents:
  * Use explicit array sizes instead of `[T; _]` placeholder
  * Use `core::str::from_utf8_unchecked` instead of inherent method

These changes enable the Rust bridge to compile on aarch64 platforms
using stable Ferrocene toolchain without nightly features.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@pypingou pypingou force-pushed the fix/compilation-warnings-gcc branch from abdadd1 to 276e999 Compare May 6, 2026 09:04
@pypingou pypingou requested a deployment to workflow-approval May 6, 2026 09:04 — with GitHub Actions Waiting
@pypingou pypingou requested a deployment to workflow-approval May 6, 2026 09:04 — with GitHub Actions Waiting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant