clang-format returns error #29214

issue mzumsande openend this issue on January 9, 2024
  1. mzumsande commented at 11:15 pm on January 9, 2024: contributor

    Is there an existing issue for this?

    • I have searched the existing issues

    Current behaviour

    clang-format is curently broken for me (possibly related to #29056, fyi @maflcko ) I’m using Ubuntu clang-format version 14.0.0-1ubuntu1.1

    Expected behaviour

    no error

    Steps to reproduce

    Add a newline anywhere in e.g. addrman.cpp, commit, then git diff -U0 HEAD~1.. | ./contrib/devtools/clang-format-diff.py -p1 -i -v as described in contrib/README.md

    Relevant log output

    0Formatting src/addrman.cpp
    1/home/martin/bitcoin/28956_adjusted/src/.clang-format:46:33: error: invalid boolean
    2BreakBeforeConceptDeclarations: Always
    

    How did you obtain Bitcoin Core

    Compiled from source

    What version of Bitcoin Core are you using?

    master

    Operating system and version

    Ubuntu 22.04.3 LTS

    Machine specifications

    No response

  2. maflcko commented at 11:29 pm on January 9, 2024: member

    Not sure why that happens, maybe the setting was a boolean before? You could try upgrading your OS or clang-format: https://packages.ubuntu.com/jammy/clang-format-15

    Also, it should be fine to remove this line in your config.

    Finally, it can also be removed from the config in this repo, if needed.

  3. mzumsande commented at 11:41 pm on January 9, 2024: contributor

    Not sure why that happens, maybe the setting was a boolean before?

    Yes, that’s the case, 14.0.0 doc

    The other added option, RequiresExpressionIndentation, also leads to an error since it was only added in clang-format 16 (https://clang.llvm.org/docs/ClangFormatStyleOptions.html) so I would need to upgrade to that. Happy to upgrade if this not a problem for anyone else.

  4. maflcko added the label Utils/log/libs on Jan 11, 2024
  5. maflcko removed the label Utils/log/libs on Jan 11, 2024
  6. maflcko added the label Scripts and tools on Jan 11, 2024
  7. fanquake commented at 11:12 am on June 3, 2024: member
    @mzumsande I’m guessing you switched to using a newer Clang here? Note that our minimum required Clang is also now 15, which would “solve” the original issue, however not the RequiresExpressionIndentation issue, but my suggestion would be to use clang-16+ if possible.
  8. TheCharlatan commented at 1:08 pm on June 3, 2024: contributor
    Might be good to note that since #29251 it is also possible to manually specify a clang format binary with the -binary option. It should be trivial to install a newer clang format on ubuntu, so I think this can be closed?
  9. mzumsande commented at 2:13 pm on June 3, 2024: contributor

    I’m guessing you switched to using a newer Clang here?

    Well, lets’s say I could have switched to a newer Clang if I wasn’t so lazy about these kind of things and if I used clang-format more often… But that’s on me, and since there are multiple workarounds like the one by @TheCharlatan , I’ll close.

  10. mzumsande closed this on Jun 3, 2024


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-09-29 01:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me