Skip to content

[clang-format 21.0.0] There should be a way to handle long strings with printk #127383

@andr2000

Description

@andr2000

Tested on/with:

  1. clang-format 21.0.0git (https://github.com/llvm/llvm-project.git 8260528)
  2. .clang-format used: https://github.com/andr2000/xen/blob/clang_cmnty_drivers_v001/xen/.clang-format
  3. File in question: https://github.com/andr2000/xen/blob/clang_cmnty_drivers_v001/xen/drivers/acpi/tables.c

What I see:

@@ -629,12 +628,14 @@ acpi_parse_one_rmrr(struct acpi_dmar_header *header)
-           printk(XENLOG_ERR VTDPREFIX
-                  "Overlapping RMRRs [%"PRIx64",%"PRIx64"] and [%"PRIx64",%"PRIx64"]\n",
-                  rmrru->base_address, rmrru->end_address,
-                  base_addr, end_addr);
+            printk(XENLOG_ERR VTDPREFIX "Overlapping RMRRs [%" PRIx64
+                                        ",%" PRIx64 "] and [%" PRIx64
+                                        ",%" PRIx64 "]\n",
+                   rmrru->base_address, rmrru->end_address, base_addr,
+                   end_addr);

What is expected:
printk format string left untouched

Linux and Xen both have in their coding style a requirement that the user visible
strings (e.g., printk() messages) should not be split so they can be searched
for more easily.

There is no way currently to set such a rule and define a list of functions
that should follow that, e.g. {printf|printk|some other function}.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions