Closed Bug 1581890 Opened 5 years ago Closed 5 years ago

Remove tab characters from most NSPR files

Categories

(NSPR :: NSPR, task)

task
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

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.

See Also: → 1375876
Attachment #9093335 - Attachment is obsolete: true

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: nobody → kaie

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.

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.

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.

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

Attachment #9093410 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: