Skip to content
  • Evan Hunt's avatar
    revise .clang-format and add a C formatting script in util · 0255a974
    Evan Hunt authored
    - add util/cformat.sh, which runs clang-format on all C files with
      the default .clang-format, and on all header files with a slightly
      modified version.
    - use correct bracing after multi-line control statements
    - stop aligning variable declarations to avoid problems with pointer
      alignment, but retain aligned declarations in header files so that
      struct definitions look cleaner.
    - static function prototypes in C files can skip the line break after
      the return type, but function prototypes in header files still have
      the line break.
    - don't break-before-brace in function definitions. ISC style calls
      for braces on the same line when function parameters fit on a single
      line, and a line break if they don't, but clang-format doesn't yet
      support that distinction. one-line function definitions are about
      four times more common than multi-line, so let's use the option that
      deviates less.
    0255a974