From owner-freebsd-hackers@freebsd.org Tue Apr 16 20:26:21 2019 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 58AC5157C563 for ; Tue, 16 Apr 2019 20:26:21 +0000 (UTC) (envelope-from arichardson.kde@gmail.com) Received: from mail-yw1-f45.google.com (mail-yw1-f45.google.com [209.85.161.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7C5A1769DE for ; Tue, 16 Apr 2019 20:26:20 +0000 (UTC) (envelope-from arichardson.kde@gmail.com) Received: by mail-yw1-f45.google.com with SMTP id d132so7814622ywa.2 for ; Tue, 16 Apr 2019 13:26:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=Fg0PLT0alDrAoSvYNq2Ds6jnNPifgcCk7gwQZHxSEpc=; b=aAu+dHGZV+AurCDfqXMHRm4IPKV43K1tN0PJfx+h8tBt7S2flcAV/6z/6BWdjfnIQn DJr0QeSjbPkU0masKF9DL8CJW9hz3DX3UAnf7EYOih8hSjDIf/XBH1PSIccVuTciXNns dwg1+tY+/42metNMTXvcYT+RPO7qjsHpqMAGHVY968M38RXx4gvxXQsewcict+V2W1fp I2eyfOUzHMez1lJQEr8m1gpyT9q9OPxL8B744vEnRzvc91uMgo7KR/QGDwTefcB1goZo vu/pe7YsXHS1gnKovSyDfmaEfkCVnkiCj4qQhgrEbW6aOf7wAx7Hl3U5bhd7q8s0Ilwx 1kuA== X-Gm-Message-State: APjAAAWFAsg18FtwjjDGG9+ExXhou7LycXQnSUIncyM+jfXFYsS3UipG 6ZalD0rNM3hJW8sL8BMnIZGjqswR X-Google-Smtp-Source: APXvYqxjEMtUgoKnn3Qq4S1FmtGIlfAmI2X0dass6MXBrqajIm41XoLOqnGoKvgH9cS+CgVIppncSQ== X-Received: by 2002:a81:4606:: with SMTP id t6mr43882296ywa.422.1555446374071; Tue, 16 Apr 2019 13:26:14 -0700 (PDT) Received: from mail-yb1-f173.google.com (mail-yb1-f173.google.com. [209.85.219.173]) by smtp.gmail.com with ESMTPSA id b68sm22593214ywh.50.2019.04.16.13.26.13 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Apr 2019 13:26:13 -0700 (PDT) Received: by mail-yb1-f173.google.com with SMTP id e190so8277065ybf.2 for ; Tue, 16 Apr 2019 13:26:13 -0700 (PDT) X-Received: by 2002:a25:dc0f:: with SMTP id y15mr58192345ybe.185.1555446373575; Tue, 16 Apr 2019 13:26:13 -0700 (PDT) MIME-Version: 1.0 From: Alexander Richardson Date: Tue, 16 Apr 2019 16:26:02 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Clang-format config for FreeBSD style To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 7C5A1769DE X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; spf=pass (mx1.freebsd.org: domain of arichardsonkde@gmail.com designates 209.85.161.45 as permitted sender) smtp.mailfrom=arichardsonkde@gmail.com X-Spamd-Result: default: False [-4.09 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; TO_DN_NONE(0.00)[]; RCVD_COUNT_THREE(0.00)[4]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; NEURAL_HAM_SHORT(-0.85)[-0.845,0]; FORGED_SENDER(0.30)[arichardson@freebsd.org,arichardsonkde@gmail.com]; MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; TAGGED_FROM(0.00)[]; TO_DOM_EQ_FROM_DOM(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_NEQ_ENVFROM(0.00)[arichardson@freebsd.org,arichardsonkde@gmail.com]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; RCPT_COUNT_ONE(0.00)[1]; IP_SCORE(-1.23)[ipnet: 209.85.128.0/17(-3.88), asn: 15169(-2.21), country: US(-0.06)]; RCVD_IN_DNSWL_NONE(0.00)[45.161.85.209.list.dnswl.org : 127.0.5.0]; RCVD_TLS_LAST(0.00)[] X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2019 20:26:21 -0000 Hello all, For CheriBSD I have added a .clang-format file[1] that (at least based on some simple checking) gets reasonably close to existing style. Is there any interest in adding this to the main repository so that future patches can easily be formatted using git-clang-format or clang-format-diff. I find that clang-format increases my productivity when I submit patches for LLVM since I can write my code, run git-clang-format and then upload the patch to phabricator and know that I won't have to fix lots of coding style errors before the patch can be submitted. Would there be interest in adding this config file to the src repository? I am not proposing mandatory clang-format before commit in a phabricator hook, but I do wonder if this would be possible in the future once clang-format produces correctly formatted code. The attached config file gets close for some files that I tested but there are definitely some line-wrapping changes that could cause unncessary code churn if it was applied in bulk to existing code. However, I do think that it could be useful for new patches (and makes it easier for people like me who can't remember all the coding style requirements for the different projects they contribute to). Alex [1] # Basic .clang-format --- BasedOnStyle: WebKit AlignAfterOpenBracket: DontAlign AlignConsecutiveAssignments: false AlignConsecutiveDeclarations: false AlignEscapedNewlines: Left AlignOperands: false AlignTrailingComments: false AllowAllParametersOfDeclarationOnNextLine: false AllowShortBlocksOnASingleLine: false AllowShortCaseLabelsOnASingleLine: false AllowShortFunctionsOnASingleLine: InlineOnly AllowShortIfStatementsOnASingleLine: false AllowShortLoopsOnASingleLine: false AlwaysBreakAfterDefinitionReturnType: TopLevel AlwaysBreakAfterReturnType: TopLevelDefinitions BinPackArguments: true BinPackParameters: true BreakBeforeBinaryOperators: None BreakBeforeBraces: WebKit BreakBeforeTernaryOperators: false # TODO: BreakStringLiterals can cause very strange formatting so turn it off? # BreakStringLiterals: false # Avoid breaking function calls before the first argument: PenaltyBreakBeforeFirstCallParameter: 100000 CommentPragmas: '^ CHERI CHANGES START' CompactNamespaces: true DerivePointerAlignment: false DisableFormat: false ForEachMacros: - SLIST_FOREACH - SLIST_FOREACH_SAFE - LIST_FOREACH - LIST_FOREACH_SAFE - STAILQ_FOREACH - STAILQ_FOREACH_SAFE - TAILQ_FOREACH - TAILQ_FOREACH_SAFE IndentCaseLabels: false IndentPPDirectives: None Language: Cpp NamespaceIndentation: None PointerAlignment: Right ContinuationIndentWidth: 4 IndentWidth: 8 TabWidth: 8 ColumnLimit: 80 UseTab: Always SortIncludes: false ...