* [PATCH] clang-format: Update .clang-format with the latest for_each macro list
@ 2019-01-18 22:57 Jason Gunthorpe
2019-01-19 18:30 ` Miguel Ojeda
0 siblings, 1 reply; 7+ messages in thread
From: Jason Gunthorpe @ 2019-01-18 22:57 UTC (permalink / raw)
To: Miguel Ojeda, linux-kernel
Re-run the shell fragment that generated the original list. In particular
this adds the missing xarray related functions.
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
---
.clang-format | 43 ++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 42 insertions(+), 1 deletion(-)
diff --git a/.clang-format b/.clang-format
index e6080f5834a356..bc2ffb2a0b5366 100644
--- a/.clang-format
+++ b/.clang-format
@@ -72,6 +72,10 @@ ForEachMacros:
- 'apei_estatus_for_each_section'
- 'ata_for_each_dev'
- 'ata_for_each_link'
+ - '__ata_qc_for_each'
+ - 'ata_qc_for_each'
+ - 'ata_qc_for_each_raw'
+ - 'ata_qc_for_each_with_internal'
- 'ax25_for_each'
- 'ax25_uid_for_each'
- 'bio_for_each_integrity_vec'
@@ -85,6 +89,7 @@ ForEachMacros:
- 'blk_queue_for_each_rl'
- 'bond_for_each_slave'
- 'bond_for_each_slave_rcu'
+ - 'bpf_for_each_spilled_reg'
- 'btree_for_each_safe128'
- 'btree_for_each_safe32'
- 'btree_for_each_safe64'
@@ -103,6 +108,8 @@ ForEachMacros:
- 'drm_atomic_crtc_for_each_plane'
- 'drm_atomic_crtc_state_for_each_plane'
- 'drm_atomic_crtc_state_for_each_plane_state'
+ - 'drm_atomic_for_each_plane_damage'
+ - 'drm_connector_for_each_possible_encoder'
- 'drm_for_each_connector_iter'
- 'drm_for_each_crtc'
- 'drm_for_each_encoder'
@@ -121,11 +128,21 @@ ForEachMacros:
- 'for_each_bio'
- 'for_each_board_func_rsrc'
- 'for_each_bvec'
+ - 'for_each_card_components'
+ - 'for_each_card_links'
+ - 'for_each_card_links_safe'
+ - 'for_each_card_prelinks'
+ - 'for_each_card_rtds'
+ - 'for_each_card_rtds_safe'
+ - 'for_each_cgroup_storage_type'
- 'for_each_child_of_node'
- 'for_each_clear_bit'
- 'for_each_clear_bit_from'
- 'for_each_cmsghdr'
- 'for_each_compatible_node'
+ - 'for_each_component_dais'
+ - 'for_each_component_dais_safe'
+ - 'for_each_comp_order'
- 'for_each_console'
- 'for_each_cpu'
- 'for_each_cpu_and'
@@ -133,6 +150,10 @@ ForEachMacros:
- 'for_each_cpu_wrap'
- 'for_each_dev_addr'
- 'for_each_dma_cap_mask'
+ - 'for_each_dpcm_be'
+ - 'for_each_dpcm_be_rollback'
+ - 'for_each_dpcm_be_safe'
+ - 'for_each_dpcm_fe'
- 'for_each_drhd_unit'
- 'for_each_dss_dev'
- 'for_each_efi_memory_desc'
@@ -149,6 +170,7 @@ ForEachMacros:
- 'for_each_iommu'
- 'for_each_ip_tunnel_rcu'
- 'for_each_irq_nr'
+ - 'for_each_link_codecs'
- 'for_each_lru'
- 'for_each_matching_node'
- 'for_each_matching_node_and_match'
@@ -160,6 +182,7 @@ ForEachMacros:
- 'for_each_mem_range_rev'
- 'for_each_migratetype_order'
- 'for_each_msi_entry'
+ - 'for_each_msi_entry_safe'
- 'for_each_net'
- 'for_each_netdev'
- 'for_each_netdev_continue'
@@ -183,12 +206,14 @@ ForEachMacros:
- 'for_each_node_with_property'
- 'for_each_of_allnodes'
- 'for_each_of_allnodes_from'
+ - 'for_each_of_cpu_node'
- 'for_each_of_pci_range'
- 'for_each_old_connector_in_state'
- 'for_each_old_crtc_in_state'
- 'for_each_oldnew_connector_in_state'
- 'for_each_oldnew_crtc_in_state'
- 'for_each_oldnew_plane_in_state'
+ - 'for_each_oldnew_plane_in_state_reverse'
- 'for_each_oldnew_private_obj_in_state'
- 'for_each_old_plane_in_state'
- 'for_each_old_private_obj_in_state'
@@ -206,14 +231,17 @@ ForEachMacros:
- 'for_each_process'
- 'for_each_process_thread'
- 'for_each_property_of_node'
+ - 'for_each_registered_fb'
- 'for_each_reserved_mem_region'
- - 'for_each_resv_unavail_range'
+ - 'for_each_rtd_codec_dai'
+ - 'for_each_rtd_codec_dai_rollback'
- 'for_each_rtdcom'
- 'for_each_rtdcom_safe'
- 'for_each_set_bit'
- 'for_each_set_bit_from'
- 'for_each_sg'
- 'for_each_sg_page'
+ - 'for_each_sibling_event'
- '__for_each_thread'
- 'for_each_thread'
- 'for_each_zone'
@@ -251,6 +279,8 @@ ForEachMacros:
- 'hlist_nulls_for_each_entry_from'
- 'hlist_nulls_for_each_entry_rcu'
- 'hlist_nulls_for_each_entry_safe'
+ - 'i3c_bus_for_each_i2cdev'
+ - 'i3c_bus_for_each_i3cdev'
- 'ide_host_for_each_port'
- 'ide_port_for_each_dev'
- 'ide_port_for_each_present_dev'
@@ -267,11 +297,14 @@ ForEachMacros:
- 'kvm_for_each_memslot'
- 'kvm_for_each_vcpu'
- 'list_for_each'
+ - 'list_for_each_codec'
+ - 'list_for_each_codec_safe'
- 'list_for_each_entry'
- 'list_for_each_entry_continue'
- 'list_for_each_entry_continue_rcu'
- 'list_for_each_entry_continue_reverse'
- 'list_for_each_entry_from'
+ - 'list_for_each_entry_from_rcu'
- 'list_for_each_entry_from_reverse'
- 'list_for_each_entry_lockless'
- 'list_for_each_entry_rcu'
@@ -291,6 +324,7 @@ ForEachMacros:
- 'media_device_for_each_intf'
- 'media_device_for_each_link'
- 'media_device_for_each_pad'
+ - 'nanddev_io_for_each_page'
- 'netdev_for_each_lower_dev'
- 'netdev_for_each_lower_private'
- 'netdev_for_each_lower_private_rcu'
@@ -357,12 +391,14 @@ ForEachMacros:
- 'sk_nulls_for_each'
- 'sk_nulls_for_each_from'
- 'sk_nulls_for_each_rcu'
+ - 'snd_array_for_each'
- 'snd_pcm_group_for_each_entry'
- 'snd_soc_dapm_widget_for_each_path'
- 'snd_soc_dapm_widget_for_each_path_safe'
- 'snd_soc_dapm_widget_for_each_sink_path'
- 'snd_soc_dapm_widget_for_each_source_path'
- 'tb_property_for_each'
+ - 'tcf_exts_for_each_action'
- 'udp_portaddr_for_each_entry'
- 'udp_portaddr_for_each_entry_rcu'
- 'usb_hub_for_each_child'
@@ -371,6 +407,11 @@ ForEachMacros:
- 'v4l2_m2m_for_each_dst_buf_safe'
- 'v4l2_m2m_for_each_src_buf'
- 'v4l2_m2m_for_each_src_buf_safe'
+ - 'virtio_device_for_each_vq'
+ - 'xa_for_each'
+ - 'xas_for_each'
+ - 'xas_for_each_conflict'
+ - 'xas_for_each_marked'
- 'zorro_for_each_dev'
#IncludeBlocks: Preserve # Unknown to clang-format-5.0
--
2.20.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] clang-format: Update .clang-format with the latest for_each macro list
2019-01-18 22:57 [PATCH] clang-format: Update .clang-format with the latest for_each macro list Jason Gunthorpe
@ 2019-01-19 18:30 ` Miguel Ojeda
2019-01-19 19:06 ` Joe Perches
0 siblings, 1 reply; 7+ messages in thread
From: Miguel Ojeda @ 2019-01-19 18:30 UTC (permalink / raw)
To: Jason Gunthorpe; +Cc: linux-kernel
Hi Jason,
On Fri, Jan 18, 2019 at 11:57 PM Jason Gunthorpe <jgg@mellanox.com> wrote:
>
> Re-run the shell fragment that generated the original list. In particular
> this adds the missing xarray related functions.
>
> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Thank for the patch! Picking it up.
Cheers,
Miguel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] clang-format: Update .clang-format with the latest for_each macro list
2019-01-19 18:30 ` Miguel Ojeda
@ 2019-01-19 19:06 ` Joe Perches
2019-01-19 19:32 ` Miguel Ojeda
0 siblings, 1 reply; 7+ messages in thread
From: Joe Perches @ 2019-01-19 19:06 UTC (permalink / raw)
To: Miguel Ojeda, Jason Gunthorpe; +Cc: linux-kernel
On Sat, 2019-01-19 at 19:30 +0100, Miguel Ojeda wrote:
> Hi Jason,
>
> On Fri, Jan 18, 2019 at 11:57 PM Jason Gunthorpe <jgg@mellanox.com> wrote:
> > Re-run the shell fragment that generated the original list. In particular
> > this adds the missing xarray related functions.
> >
> > Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
>
> Thank for the patch! Picking it up.
This misses all the directory/file specific #defines
outside of include/ with for_each
$ 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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] clang-format: Update .clang-format with the latest for_each macro list
2019-01-19 19:06 ` Joe Perches
@ 2019-01-19 19:32 ` Miguel Ojeda
2019-01-19 19:45 ` Joe Perches
0 siblings, 1 reply; 7+ messages in thread
From: Miguel Ojeda @ 2019-01-19 19:32 UTC (permalink / raw)
To: Joe Perches; +Cc: Jason Gunthorpe, linux-kernel
Hi Joe,
On Sat, Jan 19, 2019 at 8:06 PM Joe Perches <joe@perches.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?
Cheers,
Miguel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] clang-format: Update .clang-format with the latest for_each macro list
2019-01-19 19:32 ` Miguel Ojeda
@ 2019-01-19 19:45 ` Joe Perches
2019-01-19 21:29 ` Miguel Ojeda
0 siblings, 1 reply; 7+ messages in thread
From: Joe Perches @ 2019-01-19 19:45 UTC (permalink / raw)
To: Miguel Ojeda; +Cc: Jason Gunthorpe, linux-kernel
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@perches.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'
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] clang-format: Update .clang-format with the latest for_each macro list
2019-01-19 19:45 ` Joe Perches
@ 2019-01-19 21:29 ` Miguel Ojeda
2019-01-21 1:59 ` Jason Gunthorpe
0 siblings, 1 reply; 7+ messages in thread
From: Miguel Ojeda @ 2019-01-19 21:29 UTC (permalink / raw)
To: Joe Perches; +Cc: Jason Gunthorpe, linux-kernel
Hi Joe,
On Sat, Jan 19, 2019 at 8:45 PM Joe Perches <joe@perches.com> wrote:
>
> 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'
Ah, yeah, of course. And it should be easy, because there is already
support for regexes in the IncludeCategories option. However, the
configuration file was intended for clang-format >= 4 (when I added
the file, the intention was to make it usable as easily as possible,
i.e. taking into account the availability of clang-format in distros).
Actually, if we were to change clang-format and then require in the
kernel the latest release, we could go a bit further and add the
missing features needed to match the kernel style almost completely. I
have been trying to allocate some time to start that project in my
backlog, but... :-)
Cheers,
Miguel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] clang-format: Update .clang-format with the latest for_each macro list
2019-01-19 21:29 ` Miguel Ojeda
@ 2019-01-21 1:59 ` Jason Gunthorpe
0 siblings, 0 replies; 7+ messages in thread
From: Jason Gunthorpe @ 2019-01-21 1:59 UTC (permalink / raw)
To: Miguel Ojeda; +Cc: Joe Perches, linux-kernel
On Sat, Jan 19, 2019 at 10:29:50PM +0100, Miguel Ojeda wrote:
> Hi Joe,
>
> On Sat, Jan 19, 2019 at 8:45 PM Joe Perches <joe@perches.com> wrote:
> >
> > 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'
>
> Ah, yeah, of course. And it should be easy, because there is already
> support for regexes in the IncludeCategories option. However, the
> configuration file was intended for clang-format >= 4 (when I added
> the file, the intention was to make it usable as easily as possible,
> i.e. taking into account the availability of clang-format in distros).
>
> Actually, if we were to change clang-format and then require in the
> kernel the latest release, we could go a bit further and add the
> missing features needed to match the kernel style almost completely. I
> have been trying to allocate some time to start that project in my
> backlog, but... :-)
It is unfortunate that clang format does not have a way for old
versions to parse new .clang-format files.
Perhaps the best course is to get that ability and then go ahead and
bump the min required version to there.. Otherwise this is a never
ending upgrade treadmill.
ie if clang-format would look for a .clang-format.VERSION first and
then try for the generic we could at least have a (somewhat painful)
path.. Or if it would run it through cpp first we could use
#ifdef/etc.
Jason
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-01-21 7:14 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-18 22:57 [PATCH] clang-format: Update .clang-format with the latest for_each macro list Jason Gunthorpe
2019-01-19 18:30 ` Miguel Ojeda
2019-01-19 19:06 ` Joe Perches
2019-01-19 19:32 ` Miguel Ojeda
2019-01-19 19:45 ` Joe Perches
2019-01-19 21:29 ` Miguel Ojeda
2019-01-21 1:59 ` Jason Gunthorpe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome