This is an archive of the discontinued LLVM Phabricator instance.

Allow parameter names to be elided in a function definition in C
ClosedPublic

Authored by aaron.ballman on Apr 6 2020, 1:32 PM.

Details

Summary

WG14 has adopted N2480 (http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2480.pdf) into C2x at the meetings last week, allowing parameter names of a function definition to be elided. This patch relaxes the error so that C++ and C2x do not diagnose this situation, and modes before C2x will allow it as an extension.

This also adds the same feature to ObjC blocks under the assumption that ObjC wishes to follow the C standard in this regard.

Diff Detail

Event Timeline

aaron.ballman created this revision.Apr 6 2020, 1:32 PM
erik.pilkington accepted this revision.Apr 7 2020, 8:31 AM

This also adds the same feature to ObjC blocks under the assumption that ObjC wishes to follow the C standard in this regard.

SGTM - thats generally been the idea for blocks.

This revision is now accepted and ready to land.Apr 7 2020, 8:31 AM
rsmith accepted this revision.Apr 7 2020, 11:02 AM
rsmith added inline comments.
clang/include/clang/Basic/DiagnosticSemaKinds.td
278

Why the extra "m"? This was spelled correctly before.

aaron.ballman closed this revision.Apr 7 2020, 11:45 AM
aaron.ballman marked an inline comment as done.
clang/include/clang/Basic/DiagnosticSemaKinds.td
278

I fat-fingered that, good catch! I've corrected the issue in the commit.

This also adds the same feature to ObjC blocks under the assumption that ObjC wishes to follow the C standard in this regard.

SGTM - thats generally been the idea for blocks.

Note that -fblocks is a C extension, not just Objective-C. (SGTM to me too.)