https://bugs.kde.org/show_bug.cgi?id=468401

            Bug ID: 468401
           Summary: [PATCH] Add a style file for clang-format
    Classification: Developer tools
           Product: valgrind
           Version: unspecified
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: minor
          Priority: NOR
         Component: general
          Assignee: jsew...@acm.org
          Reporter: se...@dagobah.cz
  Target Milestone: ---

Created attachment 158020
  --> https://bugs.kde.org/attachment.cgi?id=158020&action=edit
0001-Add-a-style-file-for-clang-format.patch

clang-format [1] is a tool for formatting C/C++ code. It is in use by a number
of projects to help to keep their code style consistent.

I've been using this tool with a customized style to format code of the
Valgrind port for RISC-V [2]. My experience is that it generally produces good
results and keeps the code nicely formatted, certainly better than I would be
able to do manually myself.

The customized configuration tries to match what appears to be a dominant
style used by the Valgrind codebase.

Examples:
* coregrind/m_sigframe/sigframe-riscv64-linux.c [3]: Coregrind code to show
  that the VG_() and ML_() specific macros used by Valgrind get sensibly
  handled.
* VEX/priv/guest_riscv64_toIR.c [4]: Lengthier VEX code.

The proposed patch adds this configuration file as I think having an option to
use clang-format to format Valgrind code could be useful for others too. For
instance, using the tool can make one-off contributions easier and could save
some discussions about code style during code reviews.

[1] https://clang.llvm.org/docs/ClangFormat.html
[2] https://github.com/petrpavlu/valgrind-riscv64
[3]
https://github.com/petrpavlu/valgrind-riscv64/blob/71272b252977fe52f03ea4fa8306b457b098cca5/coregrind/m_sigframe/sigframe-riscv64-linux.c
[4]
https://github.com/petrpavlu/valgrind-riscv64/blob/71272b252977fe52f03ea4fa8306b457b098cca5/VEX/priv/guest_riscv64_toIR.c

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to