This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] Break an unwrapped line at a K&R C parameter decl
ClosedPublic

Authored by owenpan on Jul 15 2021, 5:04 PM.

Details

Summary

Break an unwrapped line before the first parameter declaration in a K&R C function definition.

See PR51074.

Diff Detail

Event Timeline

owenpan requested review of this revision.Jul 15 2021, 5:04 PM
owenpan created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptJul 15 2021, 5:04 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
MyDeveloperDay accepted this revision.Jul 16 2021, 4:13 AM

Thanks for this, LGTM, maybe give the others some time

This revision is now accepted and ready to land.Jul 16 2021, 4:13 AM

Looks okay, but I was wondering if we don't want to guard all K&R-related changes behind e.g. `Standard: Cpp78``, so as not to possibly introduce strange bugs in newer modes.
It may be an overkill if there are 2 patches like this, but if there are more, that might become sensible to do so.
WDYT?

Looks okay, but I was wondering if we don't want to guard all K&R-related changes behind e.g. `Standard: Cpp78``, so as not to possibly introduce strange bugs in newer modes.
It may be an overkill if there are 2 patches like this, but if there are more, that might become sensible to do so.
WDYT?

I wouldn't be opposed to that idea

Looks okay, but I was wondering if we don't want to guard all K&R-related changes behind e.g. `Standard: Cpp78``, so as not to possibly introduce strange bugs in newer modes.
It may be an overkill if there are 2 patches like this, but if there are more, that might become sensible to do so.
WDYT?

I think this would be reasonable.

Looks okay, but I was wondering if we don't want to guard all K&R-related changes behind e.g. `Standard: Cpp78``, so as not to possibly introduce strange bugs in newer modes.
It may be an overkill if there are 2 patches like this, but if there are more, that might become sensible to do so.
WDYT?

I just reviewed the differences between K&R C (circa 1978) and ANSI/ISO C again and didn't see anything else that would impact clang-format, so a new Standard enum value for C78 is not needed. Nevertheless, we can add a boolean option e.g. C78ParameterDecl in the future if this patch causes regressions for some users. WDYT?

curdeius accepted this revision.Jul 19 2021, 7:48 AM

I just reviewed the differences between K&R C (circa 1978) and ANSI/ISO C again and didn't see anything else that would impact clang-format, so a new Standard enum value for C78 is not needed. Nevertheless, we can add a boolean option e.g. C78ParameterDecl in the future if this patch causes regressions for some users. WDYT?

Sounds reasonable.
Any way, you can go forward and land this patch.

This revision was landed with ongoing or failed builds.Jul 19 2021, 1:34 PM
This revision was automatically updated to reflect the committed changes.