Solve clang-format problems with different versions #73747

Closed
opened 2020-02-12 11:23:30 +01:00 by Dalai Felinto · 13 comments

clang-format 6 and 7 are shown by make format as valid version, but give different results when run on code in master. Meanwhile clang-format in precompiled libraries is being upgraded to 9.

  • Decide and document supported versions.
  • Add /* clang-format off */ or other workarounds to make result same on all supported versions.
  • make format does not use clang-format from precompiled libraries on Linux, path is wrong.

clang-format version 6 to 9 should now give the same result, and that range has been marked as supported in make format. We can decide to narrow it later if needed.

clang-format 6 and 7 are shown by `make format` as valid version, but give different results when run on code in master. Meanwhile clang-format in precompiled libraries is being upgraded to 9. - [x] Decide and document supported versions. - [x] Add `/* clang-format off */` or other workarounds to make result same on all supported versions. - [x] `make format` does not use clang-format from precompiled libraries on Linux, path is wrong. clang-format version 6 to 9 should now give the same result, and that range has been marked as supported in `make format`. We can decide to narrow it later if needed.
Author
Owner

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Author
Owner

Added subscriber: @dfelinto

Added subscriber: @dfelinto

Added subscriber: @mont29

Added subscriber: @mont29

Not sure this is really needed to force that, make format already uses clang-format from make deps area if it exists...

Will tweak py script behind make format to try and use system clang-format in recommended version if possible too.

Not sure this is really needed to force that, `make format` already uses `clang-format` from `make deps` area if it exists... Will tweak py script behind `make format` to try and use system `clang-format` in recommended version if possible too.
See blender/blender-dev-tools@0254e2baa8
Author
Owner

Added subscriber: @brecht

Added subscriber: @brecht
Author
Owner

If this is already reinforced, how is @brecht still running into conflicting clang-format versions at his work stations?

If this is already reinforced, how is @brecht still running into conflicting clang-format versions at his work stations?

blender/blender-dev-tools@0254e2baa8 checks for versions between 6 and 7 and warns in case of other version.

Clang-format in the precompiled libs on Windows is version 9 already, and other platforms will be soon as well. So, we need to decide to either upgade to 9 or revert it to 6 on Windows. Or support 6 through 9 and add more /* clang-format off */ to make it work.

make format does not use the clang-format from the precompiled libraries on Linux. The path needs to be fixed here:

    PATH="../lib/${OS_NCASE}/llvm/bin/:$(PATH)" \
        $(PYTHON) source/tools/utils_maintenance/clang_format_paths.py $(PATHS)

For me on Ubuntu Linux, I have version 6.0.0-1ubuntu2 from the distribution and 6.0.1 in the precompiled libraries. Both give the same result, which has some differences compared to master.

 intern/cycles/util/util_defines.h        | 192 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------
 intern/cycles/util/util_static_assert.h  |  16 ++++++++--------
 intern/ghost/intern/GHOST_ContextCGL.mm  |   9 ++++++---
 intern/ghost/intern/GHOST_WindowCocoa.mm |   3 ++-
 source/blender/blenlib/BLI_map.h         |  19 +++++++++----------
 5 files changed, 121 insertions(+), 118 deletions(-)
blender/blender-dev-tools@0254e2baa8 checks for versions between 6 and 7 and warns in case of other version. Clang-format in the precompiled libs on Windows is version 9 already, and other platforms will be soon as well. So, we need to decide to either upgade to 9 or revert it to 6 on Windows. Or support 6 through 9 and add more `/* clang-format off */` to make it work. `make format` does not use the `clang-format` from the precompiled libraries on Linux. The path needs to be fixed here: ``` PATH="../lib/${OS_NCASE}/llvm/bin/:$(PATH)" \ $(PYTHON) source/tools/utils_maintenance/clang_format_paths.py $(PATHS) ``` For me on Ubuntu Linux, I have version `6.0.0-1ubuntu2` from the distribution and `6.0.1` in the precompiled libraries. Both give the same result, which has some differences compared to master. ``` intern/cycles/util/util_defines.h | 192 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------ intern/cycles/util/util_static_assert.h | 16 ++++++++-------- intern/ghost/intern/GHOST_ContextCGL.mm | 9 ++++++--- intern/ghost/intern/GHOST_WindowCocoa.mm | 3 ++- source/blender/blenlib/BLI_map.h | 19 +++++++++---------- 5 files changed, 121 insertions(+), 118 deletions(-) ```

for me on debian testing, both 8.0 and 6.0 versions change current master.

  • 6.0.1:
 intern/cycles/util/util_defines.h        | 192 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------
 intern/cycles/util/util_static_assert.h  |  16 ++++++++--------
 intern/ghost/intern/GHOST_ContextCGL.mm  |   9 ++++++---
 intern/ghost/intern/GHOST_WindowCocoa.mm |   3 ++-
 source/blender/blenlib/BLI_map.h         |  19 +++++++++----------
 5 files changed, 121 insertions(+), 118 deletions(-)
  • 8.0.1:
 intern/cycles/util/util_defines.h       | 192 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------
 intern/cycles/util/util_static_assert.h |  16 ++++++++--------
 2 files changed, 104 insertions(+), 104 deletions(-)

So we clearly do not have a clang-format-6 formatted master currently...

Note that I don't mind switching to 9.0, but we really, really have to stick to one version, otherwise working with the tools becomes somewhat painful and/or noisy.

for me on debian testing, both 8.0 and 6.0 versions change current master. * 6.0.1: ``` intern/cycles/util/util_defines.h | 192 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------ intern/cycles/util/util_static_assert.h | 16 ++++++++-------- intern/ghost/intern/GHOST_ContextCGL.mm | 9 ++++++--- intern/ghost/intern/GHOST_WindowCocoa.mm | 3 ++- source/blender/blenlib/BLI_map.h | 19 +++++++++---------- 5 files changed, 121 insertions(+), 118 deletions(-) ``` * 8.0.1: ``` intern/cycles/util/util_defines.h | 192 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------ intern/cycles/util/util_static_assert.h | 16 ++++++++-------- 2 files changed, 104 insertions(+), 104 deletions(-) ``` So we clearly do not have a clang-format-6 formatted master currently... Note that I don't mind switching to 9.0, but we really, really have to stick to one version, otherwise working with the tools becomes somewhat painful and/or noisy.
Brecht Van Lommel changed title from `make format` to use `make deps` installed clang-format to Solve clang-format problems with different versions 2020-02-15 09:02:39 +01:00

This issue was referenced by 6669eca820

This issue was referenced by 6669eca820f5295204a9b0fe5cf19e1ce15ac792

This issue was referenced by blender/cycles@99a7da00e0

This issue was referenced by blender/cycles@99a7da00e0d37ae9eaeea5e8504be1425ac1d5e8

This issue was referenced by f0c991a380

This issue was referenced by f0c991a380e9d449ebc02cc91649ef3728848070

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#73747
No description provided.