mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-01 12:19:28 +00:00
Only write the dispatch table function prototypes to the header if the -h
flag was specified. If all files are generated at once, those functions are static and shouldn't appear in the header. PR: 84450 Reviewed by: alfred
This commit is contained in:
parent
a79d1e8314
commit
ec06b5e868
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=149695
@ -51,7 +51,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 * );
|
||||
@ -65,8 +65,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 */
|
||||
@ -89,7 +88,7 @@ print_datadef(def)
|
||||
ptypedef(def);
|
||||
break;
|
||||
case DEF_PROGRAM:
|
||||
pprogramdef(def);
|
||||
pprogramdef(def, headeronly);
|
||||
break;
|
||||
case DEF_CONST:
|
||||
pconstdef(def);
|
||||
@ -105,13 +104,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;
|
||||
@ -316,8 +314,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;
|
||||
@ -345,8 +342,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,
|
||||
@ -374,8 +373,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,
|
||||
|
@ -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){
|
||||
|
@ -191,8 +191,8 @@ void emit(definition *def);
|
||||
/*
|
||||
* rpc_hout routines
|
||||
*/
|
||||
void print_datadef(definition *def);
|
||||
void print_funcdef(definition *def);
|
||||
void print_datadef(definition *def, int headeronly);
|
||||
void print_funcdef(definition *def, int headeronly);
|
||||
void print_xdr_func_def(char* name, int pointerp, int i);
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user