Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

[enhancement] clang-modernize should support converting K&R parameter definitions into C prototypes #18856

Open Quuxplusone opened 10 years ago

Quuxplusone commented 10 years ago
Bugzilla Link PR18857
Status NEW
Importance P enhancement
Reported by James Widman (james.widman@gmail.com)
Reported on 2014-02-16 00:51:47 -0800
Last modified on 2020-08-20 03:19:25 -0700
Version unspecified
Hardware All All
CC alexfh@google.com, ascottcameron@gmail.com, djasper@google.com, edwin.vane@intel.com, eugene.zelenko@gmail.com, klimek@google.com, legalize@xmission.com
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
Example: convert:

/* a.h: */
void f();

struct A { int m; };

/* a.c: */
void f(x,p)
    int x;
    struct A *p;
{

}

.... to:

/* a.h: */
struct A;
void f( int x, struct A *p );

struct A { int m; };

/* a.c: */
void f( int x, struct A *p );
{

}

Notice that clang-modernize would have to insert a forward-declaration of
struct A before the first use of "ptr-to-A" as a function parameter.
(Otherwise, the type would belong to the scope of function parameters.)
Quuxplusone commented 9 years ago

Clang-modernize is deprecated in favour of Clang-tidy modernize module.

GCC had (or still has) protoize which fix function declarations.

Quuxplusone commented 8 years ago

_Bug 26466 has been marked as a duplicate of this bug._