[llvm-bugs] [Bug 45126] New: clang-format doesn't document --style=GNU

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Mar 5 12:08:09 PST 2020


https://bugs.llvm.org/show_bug.cgi?id=45126

            Bug ID: 45126
           Summary: clang-format doesn't document --style=GNU
           Product: clang
           Version: 9.0
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: husseydevin at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

clang-format's frontend supports GNU as one of the --style options:

$ cat hello.c
#include <stdio.h>

int main(int argc, char *argv[])
{
    FILE *f;

    if (argc != 2) {
       printf("usage: %s file\n", argv[0]);
       return 1;
    }
    f = fopen(argv[1], "w");
    if (f == NULL) {
       printf("couldn't open %s\n", argv[1]);
       return 1;
    }
    fprintf(f, "Hello world!\n");
    fclose(f);
    return 0;
}

$ clang-format --style=GNU hello.c
#include <stdio.h>

int
main (int argc, char *argv[])
{
  FILE *f;

  if (argc != 2)
    {
      printf ("usage: %s file\n", argv[0]);
      return 1;
    }
  f = fopen (argv[1], "w");
  if (f == NULL)
    {
      printf ("couldn't open %s\n", argv[1]);
      return 1;
    }
  fprintf (f, "Hello world!\n");
  fclose (f);
  return 0;
}

but the help message does not indicate it:

--style=<string>           - Coding style, currently supports:
                               LLVM, Google, Chromium, Mozilla, WebKit

This should be added to the help message and documentation.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200305/39b58c71/attachment.html>


More information about the llvm-bugs mailing list