-qgenproto

Category

Portability and migration

Pragma equivalent

None.

Purpose

Produces prototype declarations from K&R function definitions or function definitions with empty parentheses, and displays them to standard output.

The compiler accepts and compiles K&R function definitions or definitions with a function declarator with empty parentheses; however, these function definitions are considered by the C standard to be obsolete (the compiler will diagnose them if you enable the -qinfo=obs option). When -qgenproto is in effect, the compiler generates the corresponding prototype declarations and displays them to standard output. You can use this option to help you identify obsolete function definitions and automatically obtain equivalent prototypes.

Syntax

Read syntax diagramSkip visual syntax diagram
        .-nogenproto-----------------.   
>>- -q--+-genproto--+--------------+-+-------------------------><
                    '-=--parmnames-'     

Defaults

-qnogenproto

Parameters

parmnames
Parameter names are included in the prototype. If you do not specify this suboption, parameter names will not be included in the prototype.

Predefined macros

None.

Examples

Compiling with - qgenproto for the following function definitions:
int foo(a, b)   // K&R function
  int a, b;
{
}

int faa(int i) { } // prototyped function

main() {  // missing void parameter 
}
produces the following output on the display:
int foo(int, int);
int main(void);
Specifying -qgenproto=parmnames produces:
int foo(int a, int b);
int main(void);