Skip to content

Conversation

l0rinc
Copy link
Contributor

@l0rinc l0rinc commented Dec 20, 2024

Use character literals instead of integer hex values (i.e. '\x5b','\x0a', ... instead of 0x5b, 0x0a, ...) for generated JSON headers for tests.
This avoids C++11 narrowing warnings in a more concise way than using explicit char casts.

Extra whitespace is also removed between elements for brevity.

Split out of #31542 (comment)

Use character literals instead of integer hex values (i.e. `'\x5b','\x0a', ...` instead of `0x5b, 0x0a, ...`) for generated headers.
This avoids C++11 narrowing warnings in a more concise way than using explicit char casts.

Extra whitespace is also removed between elements for brevity.
@DrahtBot
Copy link
Contributor

DrahtBot commented Dec 20, 2024

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage & Benchmarks

For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/31547.

Reviews

See the guideline for information on the review process.
A summary of reviews will appear here.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #31176 (ci: Test cross-built Windows executables on Windows natively by hebasto)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@l0rinc l0rinc changed the title build: Use character literals for generated headers to avoid narrowing build: Use character literals for generated json headers to avoid narrowing Dec 23, 2024
achow101 added a commit that referenced this pull request Jan 3, 2025
faf7eac test: clang-format -i src/univalue/test/unitester.cpp (MarcoFalke)
fafa9cc test: Embed univalue json tests in binary (MarcoFalke)
fa04485 test: Re-enable univalue test fail18.json (MarcoFalke)
63b6b63 build: Use character literals for generated headers to avoid narrowing (Lőrinc)

Pull request description:

  All other benchmarks and tests have their data embedded, except for the univalue json tests.

  This is not only confusing, but also problematic, when the test binary is moved to a different system for testing, because one has to put the test files in the source dir that was used at compile-time.

  Fix all issues by embedding them. Also, re-enable a disabled test. Also, fix an issue in the GenerateHeaderFromJson.cmake.

  Requested in https://github.com/bitcoin/bitcoin/pull/31434/files#r1876000910

ACKs for top commit:
  l0rinc:
    ACK faf7eac
  fjahr:
    tACK faf7eac
  achow101:
    ACK faf7eac
  TheCharlatan:
    Re-ACK faf7eac
  hebasto:
    Re-ACK faf7eac. The commit, which modifies CMake scripts, has been replaced with the one from #31547, and a formatting commit has been added since my recent [review](#31542 (review)).

Tree-SHA512: 72ad202125746f32ccf07411ad3efd2771f27a40525c204cba3c9c83b3ca46d05dd18f6fa5985720c6684bdcbb4c4853fc609ced095ddd1a124832318dd8a55d
@achow101 achow101 merged commit 63b6b63 into bitcoin:master Jan 3, 2025
18 checks passed
@l0rinc l0rinc deleted the l0rinc/GenerateHeaderFromJson-character-literal branch January 3, 2025 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants