MFC rpc_hout.c 1.12 and rpc_main.c 1.28:

Only write prototypes to the headers if -h was specified and they don't have
internal linkage.
This commit is contained in:
stefanf 2006-06-24 09:31:29 +00:00
parent f361b24e4b
commit 5a4cc9e905
2 changed files with 22 additions and 23 deletions

View File

@ -50,7 +50,7 @@ void storexdrfuncdecl( char *, int );
static void pconstdef( definition * );
static void pstructdef( definition * );
static void puniondef( definition * );
static void pprogramdef( definition * );
static void pprogramdef( definition *, int );
static void pstructdef( definition * );
static void penumdef( definition * );
static void ptypedef( definition * );
@ -64,8 +64,7 @@ void pdeclaration( char *, declaration *, int, char * );
* Print the C-version of an xdr definition
*/
void
print_datadef(def)
definition *def;
print_datadef(definition *def, int headeronly)
{
if (def->def_kind == DEF_PROGRAM) /* handle data only */
@ -88,7 +87,7 @@ print_datadef(def)
ptypedef(def);
break;
case DEF_PROGRAM:
pprogramdef(def);
pprogramdef(def, headeronly);
break;
case DEF_CONST:
pconstdef(def);
@ -104,13 +103,12 @@ print_datadef(def)
void
print_funcdef(def)
definition *def;
print_funcdef(definition *def, int headeronly)
{
switch (def->def_kind) {
case DEF_PROGRAM:
f_print(fout, "\n");
pprogramdef(def);
pprogramdef(def, headeronly);
break;
default:
break;
@ -315,8 +313,7 @@ pdispatch(char * name, char *vers, int mode)
}
static void
pprogramdef(def)
definition *def;
pprogramdef(definition *def, int headeronly)
{
version_list *vers;
proc_list *proc;
@ -344,8 +341,10 @@ pprogramdef(def)
if(!Cflag){
ext = "extern ";
f_print(fout, "%s", ext);
pdispatch(def->def_name, vers->vers_num, 2);
if (headeronly) {
f_print(fout, "%s", ext);
pdispatch(def->def_name, vers->vers_num, 2);
}
for (proc = vers->procs; proc != NULL;
proc = proc->next) {
if (!define_printed(proc,
@ -373,8 +372,11 @@ pprogramdef(def)
ext = "extern ";
}
f_print(fout, "%s", ext);
pdispatch(def->def_name, vers->vers_num, i);
if (headeronly) {
f_print(fout, "%s", ext);
pdispatch(def->def_name, vers->vers_num,
i);
}
for (proc = vers->procs; proc != NULL;
proc = proc->next) {
if (!define_printed(proc,

View File

@ -61,7 +61,7 @@ extern int write_sample_clnt( definition * );
extern void write_sample_clnt_main( void );
extern void add_sample_msg( void );
static void c_output( char *, char *, int, char * );
static void h_output( char *, char *, int, char * );
static void h_output( char *, char *, int, char *, int );
static void l_output( char *, char *, int, char * );
static void t_output( char *, char *, int, char * );
static void clnt_output( char *, char *, int, char * );
@ -172,7 +172,8 @@ main(argc, argv)
if (cmd.cflag) {
c_output(cmd.infile, "-DRPC_XDR", DONT_EXTEND, cmd.outfile);
} else if (cmd.hflag) {
h_output(cmd.infile, "-DRPC_HDR", DONT_EXTEND, cmd.outfile);
h_output(cmd.infile, "-DRPC_HDR", DONT_EXTEND, cmd.outfile,
cmd.hflag);
} else if (cmd.lflag) {
l_output(cmd.infile, "-DRPC_CLNT", DONT_EXTEND, cmd.outfile);
} else if (cmd.sflag || cmd.mflag || (cmd.nflag)) {
@ -192,7 +193,7 @@ main(argc, argv)
/* the rescans are required, since cpp may effect input */
c_output(cmd.infile, "-DRPC_XDR", EXTEND, "_xdr.c");
reinitialize();
h_output(cmd.infile, "-DRPC_HDR", EXTEND, ".h");
h_output(cmd.infile, "-DRPC_HDR", EXTEND, ".h", cmd.hflag);
reinitialize();
l_output(cmd.infile, "-DRPC_CLNT", EXTEND, "_clnt.c");
reinitialize();
@ -514,11 +515,7 @@ char *generate_guard(pathname)
static void
h_output(infile, define, extend, outfile)
char *infile;
char *define;
int extend;
char *outfile;
h_output(char *infile, char *define, int extend, char *outfile, int headeronly)
{
definition *def;
char *outfilename;
@ -558,7 +555,7 @@ h_output(infile, define, extend, outfile)
/* print data definitions */
while ( (def = get_definition()) ) {
print_datadef(def);
print_datadef(def, headeronly);
}
/*
@ -567,7 +564,7 @@ h_output(infile, define, extend, outfile)
* arguments for functions
*/
for (l = defined; l != NULL; l = l->next) {
print_funcdef(l->val);
print_funcdef(l->val, headeronly);
}
/* Now print all xdr func declarations */
if (xdrfunc_head != NULL){