Remove tab characters from most NSPR files
Categories
(NSPR :: NSPR, task)
Tracking
(Not tracked)
People
(Reporter: KaiE, Assigned: KaiE)
References
Details
Attachments
(4 files, 2 obsolete files)
Bug 1375876 is more work, so I'd like to start with a simpler change:
Let's remove all tab characters from most NSPR source files.
Easier editing, without having to worry about tabs, is my primary goal when working with the code.
Assignee | ||
Comment 1•5 years ago
|
||
Updated•5 years ago
|
Assignee | ||
Comment 2•5 years ago
|
||
Assignee | ||
Comment 3•5 years ago
|
||
Assignee | ||
Comment 4•5 years ago
|
||
I've experimented with the "artistic style" (astyle) utility, and I like the results better than clang-format.
The changes made by astyle are less invasive. It cleans up the indenting nicely.
It avoids most of the changes you had critized in https://phabricator.services.mozilla.com/D36729
It doesn't touch the * alignments, and it keeps the blocks unchanged, where you had asked for // clang off
Also, I've added the braces for one line if statements, as you had requested.
I haven't addressed your complaints about win16 headers or "error instead of #error", I think that's out of scope and should be done separately.
I've used the following parameters for the astyle utility, and applied them to all files with h/c/cpp extensions:
astyle --mode=c --indent=spaces=4 --convert-tabs --min-conditional-indent=0 --options=none --indent-switches --keep-one-line-statements --add-braces --align-reference=none
I'll attach an incremental patch in a minute.
Assignee | ||
Comment 5•5 years ago
|
||
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 6•5 years ago
|
||
BTW, astyle appears to be smarter than the version of clang-format that we're using for NSS.
clang-format replaced tabs inside two strings, while astyle kept them correctly.
Assignee | ||
Comment 7•5 years ago
|
||
astyle also offers
} else {
but enabling that would change many additional lines, and move the opening bracket in many places.
(additional astyle parameter --style=mozilla)
I'll attach an optional, incremental patch, and leave it to you, if you want to review that, too.
I don't consider it necessary.
Assignee | ||
Comment 8•5 years ago
|
||
Assignee | ||
Comment 9•5 years ago
|
||
Mike, my primary question for you is:
Do you agree these changes are an improvement? If yes, I'd prefer to apply these changes, without going into much more detail.
Personally, I'd only use patches 1, 2, 3, and ignore 4.
Assignee | ||
Comment 10•5 years ago
|
||
Here is a NSS try build, which built NSPR including the currently attached NSPR patches.
https://treeherder.mozilla.org/#/jobs?repo=nss-try&revision=8fb13f219d4d4c0013058dccfdff50084daa1cff
Updated•5 years ago
|
Assignee | ||
Comment 11•5 years ago
|
||
Assignee | ||
Comment 12•5 years ago
|
||
Thanks for the reviews Mike!
https://hg.mozilla.org/projects/nspr/rev/6856b110d025599a243f0b0128c7f39572a9ead0
https://hg.mozilla.org/projects/nspr/rev/753c7baeb58d34bb93f6bdcdd49f8e74bc32ee41
https://hg.mozilla.org/projects/nspr/rev/b2e285dc48be27713b3c648de3cf33f8637a3e94
Description
•