lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2324fe307d1e077225171e7436ff1a4fc96292f5.camel@perches.com>
Date:   Sat, 19 Jan 2019 11:45:07 -0800
From:   Joe Perches <joe@...ches.com>
To:     Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
Cc:     Jason Gunthorpe <jgg@...lanox.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] clang-format: Update .clang-format with the latest
 for_each macro list

On Sat, 2019-01-19 at 20:32 +0100, Miguel Ojeda wrote:
> Hi Joe,
> 
> On Sat, Jan 19, 2019 at 8:06 PM Joe Perches <joe@...ches.com> wrote:
> > This misses all the directory/file specific #defines
> > outside of include/ with for_each
> 
> Indeed, the command only searches the include/ directory, but when
> searching for the entire tree, it returns ~500 more entries (vs. the
> ~300 original ones). I cannot recall if there was a reason to search
> only inside include/, though.
> 
> > $ git grep "#define.*for_each" | grep -v '^include' | wc -l
> > 619
> > 
> > Is it possible to make this generic somehow instead?
> > Perhaps extend .clang_format with regexes?
> > 
> > (?:[a-z0-9_]+_)?for_each(?:_[a-z_]+)
> > [a-z0-9_]+_for_each
> 
> What do you mean?

Documentation for .clang-format shows
https://clang.llvm.org/docs/ClangFormatStyleOptions.html

   ForEachMacros (std::vector<std::string>)

       A vector of macros that should be interpreted as foreach loops instead of as function calls.

       These are expected to be macros of the form:

       FOREACH(<variable-declaration>, ...)
         <loop-body>

       In the .clang-format configuration file, this can be configured like:

       ForEachMacros: ['RANGES_FOR', 'FOREACH']

       For example: BOOST_FOREACH.

I suggest clang-format's ForEachMacros statement vector
be expanded to support regexes ala

ForEachMacros:
  - Regex:           '\b(?:(?:[a-z0-9_]+_)?for_each(?:_[a-z_]+)|[a-z0-9_]+_for_each)\b'


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ