1 - Most flags used by ack itself are now also passed to the phases

for recognition with mapflag.
2 - A few bugs are removed in connection with argument passing to the
    linker (unrecognized flags and libraries).
3 - The setting of RTS, HEAD and TAIL is done directly after the
    path determination for each file.
This commit is contained in:
keie 1984-10-05 13:28:56 +00:00
parent 1b251d6ab0
commit c4434ccbce

View file

@ -61,6 +61,12 @@ main(argc,argv) char **argv ; {
#endif #endif
} }
setlist(machine); setlist(machine);
/* Find the linker, needed for argument building */
scanlist(l_first(tr_list),elem) {
if ( t_cont(*elem)->t_linker ) {
linker= t_cont(*elem) ;
}
}
transini(); transini();
scanneeds(); scanneeds();
sprintf(template,TMPNAME,getpid()) ; sprintf(template,TMPNAME,getpid()) ;
@ -72,14 +78,6 @@ main(argc,argv) char **argv ; {
} }
} }
if ( !stopsuffix ) {
/* Find the linker, needed for argument building */
scanlist(l_first(tr_list),elem) {
if ( t_cont(*elem)->t_linker ) {
linker= t_cont(*elem) ;
}
}
}
scanlist ( l_first(arguments), elem ) { scanlist ( l_first(arguments), elem ) {
if ( !process(l_content(*elem)) && !k_flag ) return 1 ; if ( !process(l_content(*elem)) && !k_flag ) return 1 ;
@ -87,6 +85,7 @@ main(argc,argv) char **argv ; {
orig.p_path= (char *)0 ; orig.p_path= (char *)0 ;
if ( !rts ) rts="" ; if ( !rts ) rts="" ;
setsvar(keeps(RTS),rts) ; setsvar(keeps(RTS),rts) ;
if ( linker ) getmapflags(linker) ;
scanlist(l_first(tr_list),elem) { scanlist(l_first(tr_list),elem) {
phase=t_cont(*elem) ; phase=t_cont(*elem) ;
@ -145,6 +144,7 @@ vieuwargs(argc,argv) char **argv ; {
register char *argp; register char *argp;
register int nextarg ; register int nextarg ;
register int eaten ; register int eaten ;
int hide ;
firstarg(argv[0]) ; firstarg(argv[0]) ;
@ -160,6 +160,7 @@ vieuwargs(argc,argv) char **argv ; {
} }
/* Flags */ /* Flags */
hide=NO ; /* Do not hide this flags to the phases */
eaten=0 ; /* Did not 'eat' tail of flag yet */ eaten=0 ; /* Did not 'eat' tail of flag yet */
switch ( argp[1] ) { switch ( argp[1] ) {
case 'm': if ( machine ) fuerror("Two machines?") ; case 'm': if ( machine ) fuerror("Two machines?") ;
@ -171,6 +172,7 @@ vieuwargs(argc,argv) char **argv ; {
} }
if ( outfile ) fuerror("Two results?") ; if ( outfile ) fuerror("Two results?") ;
outfile= argv[nextarg++] ; outfile= argv[nextarg++] ;
hide=YES ;
break ; break ;
case 'O': Optflag++ ; case 'O': Optflag++ ;
break ; break ;
@ -213,13 +215,9 @@ vieuwargs(argc,argv) char **argv ; {
eaten=1 ; eaten=1 ;
break ; break ;
case 0 : nill_flag++ ; eaten++ ; case 0 : nill_flag++ ; eaten++ ;
hide=YES ;
break; break;
case 'w': { register char *tokeep ; case 'w': w_flag++;
w_flag++;
tokeep=keeps(argp) ;
*tokeep |= NO_SCAN ;
l_add(&flags,tokeep) ;
}
break ; break ;
default: /* The flag is not recognized, default: /* The flag is not recognized,
put it on the list for the sub-processes put it on the list for the sub-processes
@ -231,6 +229,13 @@ vieuwargs(argc,argv) char **argv ; {
#endif #endif
l_add(&flags,keeps(argp)) ; l_add(&flags,keeps(argp)) ;
eaten=1 ; eaten=1 ;
hide=YES ;
}
if ( !hide ) {
register char *tokeep ;
tokeep=keeps(argp) ;
*tokeep |= NO_SCAN ;
l_add(&flags,tokeep) ;
} }
if ( argp[2] && !eaten ) { if ( argp[2] && !eaten ) {
werror("Unexpected characters at end of %s",argp) ; werror("Unexpected characters at end of %s",argp) ;
@ -256,6 +261,7 @@ firstarg(argp) register char *argp ; {
process(arg) char *arg ; { process(arg) char *arg ; {
/* Process files & library arguments */ /* Process files & library arguments */
trf *phase ; trf *phase ;
register trf *tmp ;
#ifdef DEBUG #ifdef DEBUG
if ( debug ) vprint("Processing %s\n",arg) ; if ( debug ) vprint("Processing %s\n",arg) ;
@ -284,6 +290,23 @@ process(arg) char *arg ; {
break ; break ;
} }
if ( !phase ) return 1 ; if ( !phase ) return 1 ;
for ( tmp=phase ; tmp ; tmp=tmp->t_next )
if ( !tmp->t_visited ) {
/* The flags are set up once.
At the first time each phase is in a list.
The program name and flags may already be touched
by vieuwargs.
*/
tmp->t_visited=YES ;
if ( tmp->t_priority<0 )
werror("Using phase %s (negative priority)",
tmp->t_name) ;
if ( !rts && tmp->t_rts ) rts= tmp->t_rts ;
if ( tmp->t_needed ) {
add_head(tmp->t_needed) ;
add_tail(tmp->t_needed) ;
}
}
if ( phase->t_combine ) { if ( phase->t_combine ) {
add_input(&orig,phase) ; add_input(&orig,phase) ;
return 1 ; return 1 ;