[PATCH v3] devtools: add .clang-format file
Abdullah Ömer Yamaç
aomeryamac at gmail.com
Mon May 6 12:43:31 CEST 2024
On Sun, May 5, 2024 at 11:38 PM Stephen Hemminger <
stephen at networkplumber.org> wrote:
> On Sun, 5 May 2024 22:42:57 +0300
> Abdullah Ömer Yamaç <aomeryamac at gmail.com> wrote:
>
> > > Also, this looks wrong. The initialized arrays looked better before.
> > >
> > >
> > > -static const char *tuntap_types[ETH_TUNTAP_TYPE_MAX] = {
> > > - "UNKNOWN", "TUN", "TAP"
> > > -};
> > > +static const char *tuntap_types[ETH_TUNTAP_TYPE_MAX] = {"UNKNOWN",
> "TUN",
> > > "TAP"};
> > >
> > > -static const char *valid_arguments[] = {
> > > - ETH_TAP_IFACE_ARG,
> > > - ETH_TAP_REMOTE_ARG,
> > > - ETH_TAP_MAC_ARG,
> > > - ETH_TAP_PERSIST_ARG,
> > > - NULL
> > > -};
> > > +static const char *valid_arguments[] = {ETH_TAP_IFACE_ARG,
> > > ETH_TAP_REMOTE_ARG, ETH_TAP_MAC_ARG,
> > > + ETH_TAP_PERSIST_ARG, NULL};
> > >
> >
> > I am confused about these variables. tuntap_types list values in a
> single
> > line, but valid_arguments' values are listed separately.
> > So, it is getting more complex to handle both of them. What should we do,
> > do you have any idea?
>
> Ignore the initialized lists for now. It should be possible to have it
> generate something
> like
>
> static const char *tuntap_types[ETH_TUNTAP_TYPE_MAX] = {
> "UNKNOWN", "TUN", "TAP"
> };
>
> With the following changes result looks better. You got the format wrong
> for the ForEach list.
>
> diff --git a/.clang-format b/.clang-format
> index 16164ef1de..d16185c049 100644
> --- a/.clang-format
> +++ b/.clang-format
> @@ -1,12 +1,20 @@
> ---
> BasedOnStyle: LLVM
>
> +AttributeMacros:
> + - __rte_aligned
> + - __rte_packed
> + - __rte_may_alias
> + - __rte_deprecated
> + - __rte_weak
> + - __rte_unused
> + - __rte_restrict
> +
> # Place opening and closing parentheses on the same line for control
> statements
> BreakBeforeBraces: Custom
> BraceWrapping:
> - AfterFunction: false
> + AfterFunction: true
> AfterControlStatement: false
> - AfterEnum: false
>
> These are ok for me.
> # Set maximum line length to 100 characters
> ColumnLimit: 100
> @@ -41,98 +49,117 @@ AlwaysBreakAfterReturnType: TopLevelDefinitions
> # Always break before multiline string literals
> AlignEscapedNewlines: Left
>
> -# Foreach macros
>
In the clang documentation, it says "ForEachMacros (List of Strings)" and
gives an example: "ForEachMacros: ['RANGES_FOR', 'FOREACH']"
> ...
> +ObjCSpaceAfterProperty: true
> +IndentGotoLabels: false
>
These are also ok for me.
If you agree on the for-each part, then I will send the new patch.
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mails.dpdk.org/archives/dev/attachments/20240506/ed708ca4/attachment.htm>
More information about the dev
mailing list