Open Bug 1514948 Opened 6 years ago Updated 2 years ago

Reformat IPDL files to consistent style

Categories

(Core :: IPC, enhancement, P3)

enhancement

Tracking

()

People

(Reporter: jld, Unassigned)

References

Details

I noticed that some of our IPDL files have 4-space indents (despite, in some cases, modelines specifying 2 spaces) while most have 2-space indents like C++ code. There's also at least one unindented `manager` declaration. We probably can't fix this with clang-format, because it's not C/C++, but in principle a tool could be created. Manual fixes are also a possibility.
Hmm, I wouldn't be surprised if clang-format _can_ actually format IPDL successfully, since the tokens the tokenizer would see are similar enough to C++. It may be worth giving that a shot... If you wanted to try it out, you can add the ipdl/ipdlh extensions here <https://searchfox.org/mozilla-central/rev/13788edbabb04d004e4a1ceff41d4de68a8320a2/python/mozbuild/mozbuild/mach_commands.py#1650> and run |find srcdir -name '*.ipdl*' | xargs ./mach clang-format -p| on the tree and see what you end up with...
It probably wouldn't be that hard to write a backend for one of the existing IPDL parsers to do pretty printing, though you'd need to modify them to save comments.
(In reply to :Ehsan Akhgari from comment #1) > Hmm, I wouldn't be surprised if clang-format _can_ actually format IPDL > successfully, since the tokens the tokenizer would see are similar enough to > C++. It may be worth giving that a shot... The problem there is that we might want to evolve the syntax, and it might not stay close enough to C++. For example, there are some ideas about having something like WebIDL extended attributes or Rust #[attributes], although C++ [[attributes]] could also work.
Fair point!
Priority: -- → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.