Fix preprocessor directive syntax (text after #endif).

The style of this program is still atrocious (not fixed).
This commit is contained in:
Garrett Wollman 2002-05-30 21:18:01 +00:00
parent 75aa1830f8
commit 0fb7a0beb0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=97631
6 changed files with 61 additions and 53 deletions

View File

@ -92,7 +92,7 @@ aout_getnfile(const char *filename, char ***defaultEs)
printf("[getnfile] 0X%08lx\t%s\n", nl[j].value, nl[j].name); printf("[getnfile] 0X%08lx\t%s\n", nl[j].value, nl[j].name);
} }
} }
# endif DEBUG # endif /* DEBUG */
*defaultEs = excludes; *defaultEs = excludes;
return 0; return 0;
} }
@ -160,7 +160,7 @@ getsymtab(FILE *nfile, const char *filename)
printf( "[getsymtab] rejecting: 0x%x %s\n" , printf( "[getsymtab] rejecting: 0x%x %s\n" ,
nbuf.n_type , strtab + nbuf.n_un.n_strx ); nbuf.n_type , strtab + nbuf.n_un.n_strx );
} }
# endif DEBUG # endif /* DEBUG */
continue; continue;
} }
npe->value = nbuf.n_value; npe->value = nbuf.n_value;
@ -170,7 +170,7 @@ getsymtab(FILE *nfile, const char *filename)
printf( "[getsymtab] %d %s 0x%08lx\n" , printf( "[getsymtab] %d %s 0x%08lx\n" ,
nname , npe -> name , npe -> value ); nname , npe -> name , npe -> value );
} }
# endif DEBUG # endif /* DEBUG */
npe++; npe++;
nname++; nname++;
} }

View File

@ -47,7 +47,7 @@ int visited;
int viable; int viable;
int newcycle; int newcycle;
int oldcycle; int oldcycle;
#endif DEBUG #endif /* DEBUG */
/* /*
* add (or just increment) an arc * add (or just increment) an arc
@ -64,7 +64,7 @@ addarc( parentp , childp , count )
printf( "[addarc] %ld arcs from %s to %s\n" , printf( "[addarc] %ld arcs from %s to %s\n" ,
count , parentp -> name , childp -> name ); count , parentp -> name , childp -> name );
} }
# endif DEBUG # endif /* DEBUG */
arcp = arclookup( parentp , childp ); arcp = arclookup( parentp , childp );
if ( arcp != 0 ) { if ( arcp != 0 ) {
/* /*
@ -75,7 +75,7 @@ addarc( parentp , childp , count )
printf( "[tally] hit %ld += %ld\n" , printf( "[tally] hit %ld += %ld\n" ,
arcp -> arc_count , count ); arcp -> arc_count , count );
} }
# endif DEBUG # endif /* DEBUG */
arcp -> arc_count += count; arcp -> arc_count += count;
return; return;
} }
@ -175,7 +175,7 @@ doarcs()
if ( debug & BREAKCYCLE ) { if ( debug & BREAKCYCLE ) {
printf("[doarcs] pass %ld, cycle(s) %d\n" , pass , ncycle ); printf("[doarcs] pass %ld, cycle(s) %d\n" , pass , ncycle );
} }
# endif DEBUG # endif /* DEBUG */
if ( pass == 1 ) { if ( pass == 1 ) {
printf( "\n\n%s %s\n%s %d:\n" , printf( "\n\n%s %s\n%s %d:\n" ,
"The following arcs were deleted" , "The following arcs were deleted" ,
@ -219,7 +219,7 @@ doarcs()
printf( "\n" ); printf( "\n" );
} }
} }
# endif DEBUG # endif /* DEBUG */
/* /*
* starting from the topological top, * starting from the topological top,
* propagate print flags to children. * propagate print flags to children.
@ -349,7 +349,7 @@ timepropagate( parentp )
printname( parentp ); printname( parentp );
printf( "\n[dotime] share %f\n" , share ); printf( "\n[dotime] share %f\n" , share );
} }
# endif DEBUG # endif /* DEBUG */
} }
} }
@ -417,7 +417,7 @@ cyclelink()
printname( nlp ); printname( nlp );
printf( " is the head of cycle %d\n" , cycle ); printf( " is the head of cycle %d\n" , cycle );
} }
# endif DEBUG # endif /* DEBUG */
/* /*
* link members to cycle header * link members to cycle header
*/ */
@ -492,7 +492,7 @@ cycleanalyze()
printf( "[cycleanalyze] starting cycle %d of %d, size %d\n" , printf( "[cycleanalyze] starting cycle %d of %d, size %d\n" ,
cycleno , ncycle , size ); cycleno , ncycle , size );
} }
# endif DEBUG # endif /* DEBUG */
for ( nlp = cyclenl[ cycleno ] . cnext ; nlp ; nlp = nlp -> cnext ) { for ( nlp = cyclenl[ cycleno ] . cnext ; nlp ; nlp = nlp -> cnext ) {
stkp = &cyclestack[0]; stkp = &cyclestack[0];
nlp -> flags |= CYCLEHEAD; nlp -> flags |= CYCLEHEAD;
@ -520,7 +520,7 @@ cycleanalyze()
printf("%s visited %d, viable %d, newcycle %d, oldcycle %d\n", printf("%s visited %d, viable %d, newcycle %d, oldcycle %d\n",
"[doarcs]" , visited , viable , newcycle , oldcycle); "[doarcs]" , visited , viable , newcycle , oldcycle);
} }
# endif DEBUG # endif /* DEBUG */
return( done ); return( done );
} }
@ -535,14 +535,14 @@ descend( node , stkstart , stkp )
for ( arcp = node -> children ; arcp ; arcp = arcp -> arc_childlist ) { for ( arcp = node -> children ; arcp ; arcp = arcp -> arc_childlist ) {
# ifdef DEBUG # ifdef DEBUG
visited++; visited++;
# endif DEBUG # endif /* DEBUG */
if ( arcp -> arc_childp -> cycleno != node -> cycleno if ( arcp -> arc_childp -> cycleno != node -> cycleno
|| ( arcp -> arc_childp -> flags & VISITED ) || ( arcp -> arc_childp -> flags & VISITED )
|| ( arcp -> arc_flags & DEADARC ) ) || ( arcp -> arc_flags & DEADARC ) )
continue; continue;
# ifdef DEBUG # ifdef DEBUG
viable++; viable++;
# endif DEBUG # endif /* DEBUG */
*stkp = arcp; *stkp = arcp;
if ( arcp -> arc_childp -> flags & CYCLEHEAD ) { if ( arcp -> arc_childp -> flags & CYCLEHEAD ) {
if ( addcycle( stkstart , stkp ) == FALSE ) if ( addcycle( stkstart , stkp ) == FALSE )
@ -593,7 +593,7 @@ addcycle( stkstart , stkend )
if ( arcpp == endlist ) { if ( arcpp == endlist ) {
# ifdef DEBUG # ifdef DEBUG
oldcycle++; oldcycle++;
# endif DEBUG # endif /* DEBUG */
return( TRUE ); return( TRUE );
} }
} }
@ -625,7 +625,7 @@ addcycle( stkstart , stkend )
if ( debug & SUBCYCLELIST ) { if ( debug & SUBCYCLELIST ) {
printsubcycle( clp ); printsubcycle( clp );
} }
# endif DEBUG # endif /* DEBUG */
cyclecnt++; cyclecnt++;
if ( cyclecnt >= CYCLEMAX ) if ( cyclecnt >= CYCLEMAX )
return( FALSE ); return( FALSE );
@ -648,7 +648,7 @@ compresslist()
int maxnoparentcnt; int maxnoparentcnt;
# ifdef DEBUG # ifdef DEBUG
const char *type; const char *type;
# endif DEBUG # endif /* DEBUG */
maxexitcnt = 0; maxexitcnt = 0;
maxwithparentcnt = 0; maxwithparentcnt = 0;
@ -693,7 +693,7 @@ compresslist()
maxarcp = maxexitarcp; maxarcp = maxexitarcp;
# ifdef DEBUG # ifdef DEBUG
type = "exit"; type = "exit";
# endif DEBUG # endif /* DEBUG */
} else if ( maxwithparentcnt > 0 ) { } else if ( maxwithparentcnt > 0 ) {
/* /*
* second choice is edge leading to node with at least one * second choice is edge leading to node with at least one
@ -702,7 +702,7 @@ compresslist()
maxarcp = maxwithparentarcp; maxarcp = maxwithparentarcp;
# ifdef DEBUG # ifdef DEBUG
type = "internal"; type = "internal";
# endif DEBUG # endif /* DEBUG */
} else { } else {
/* /*
* last choice is edge leading to node with only this arc as * last choice is edge leading to node with only this arc as
@ -711,7 +711,7 @@ compresslist()
maxarcp = maxnoparentarcp; maxarcp = maxnoparentarcp;
# ifdef DEBUG # ifdef DEBUG
type = "orphan"; type = "orphan";
# endif DEBUG # endif /* DEBUG */
} }
maxarcp -> arc_flags |= DEADARC; maxarcp -> arc_flags |= DEADARC;
maxarcp -> arc_childp -> parentcnt -= 1; maxarcp -> arc_childp -> parentcnt -= 1;
@ -723,7 +723,7 @@ compresslist()
maxarcp -> arc_count , maxarcp -> arc_childp -> name , maxarcp -> arc_count , maxarcp -> arc_childp -> name ,
maxarcp -> arc_cyclecnt ); maxarcp -> arc_cyclecnt );
} }
# endif DEBUG # endif /* DEBUG */
printf( "\t%s to %s with %ld calls\n" , maxarcp -> arc_parentp -> name , printf( "\t%s to %s with %ld calls\n" , maxarcp -> arc_parentp -> name ,
maxarcp -> arc_childp -> name , maxarcp -> arc_count ); maxarcp -> arc_childp -> name , maxarcp -> arc_count );
prev = &cyclehead; prev = &cyclehead;
@ -760,7 +760,7 @@ printsubcycle( clp )
printf( "\t(%ld) -> %s\n" , (*arcpp) -> arc_count , printf( "\t(%ld) -> %s\n" , (*arcpp) -> arc_count ,
(*arcpp) -> arc_childp -> name ) ; (*arcpp) -> arc_childp -> name ) ;
} }
#endif DEBUG #endif /* DEBUG */
cycletime() cycletime()
{ {
@ -818,7 +818,7 @@ doflags()
printf( " inherits printflag %d and propfraction %f\n" , printf( " inherits printflag %d and propfraction %f\n" ,
childp -> printflag , childp -> propfraction ); childp -> printflag , childp -> propfraction );
} }
# endif DEBUG # endif /* DEBUG */
if ( ! childp -> printflag ) { if ( ! childp -> printflag ) {
/* /*
* printflag is off * printflag is off
@ -874,7 +874,7 @@ doflags()
printf( "time %f propself %f printtime %f\n" , printf( "time %f propself %f printtime %f\n" ,
childp -> time , childp -> propself , printtime ); childp -> time , childp -> propself , printtime );
} }
# endif DEBUG # endif /* DEBUG */
} }
} }

View File

@ -32,7 +32,11 @@
*/ */
#ifndef lint #ifndef lint
#if 0
static char sccsid[] = "@(#)dfn.c 8.1 (Berkeley) 6/6/93"; static char sccsid[] = "@(#)dfn.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
"$FreeBSD$";
#endif /* not lint */ #endif /* not lint */
#include <stdio.h> #include <stdio.h>
@ -71,7 +75,7 @@ dfn( parentp )
printname( parentp ); printname( parentp );
printf( ")\n" ); printf( ")\n" );
} }
# endif DEBUG # endif /* DEBUG */
/* /*
* if we're already numbered, no need to look any furthur. * if we're already numbered, no need to look any furthur.
*/ */
@ -124,7 +128,7 @@ dfn_pre_visit( parentp )
printname( parentp ); printname( parentp );
printf( "\n" ); printf( "\n" );
} }
# endif DEBUG # endif /* DEBUG */
} }
/* /*
@ -184,7 +188,7 @@ dfn_findcycle( childp )
printname( cycleheadp ); printname( cycleheadp );
printf( "\n" ); printf( "\n" );
} }
# endif DEBUG # endif /* DEBUG */
if ( cycletop == dfn_depth ) { if ( cycletop == dfn_depth ) {
/* /*
* this is previous function, e.g. this calls itself * this is previous function, e.g. this calls itself
@ -206,7 +210,7 @@ dfn_findcycle( childp )
printname( tailp ); printname( tailp );
printf( "\n" ); printf( "\n" );
} }
# endif DEBUG # endif /* DEBUG */
} }
/* /*
* if what we think is the top of the cycle * if what we think is the top of the cycle
@ -221,7 +225,7 @@ dfn_findcycle( childp )
printname( cycleheadp ); printname( cycleheadp );
printf( "\n" ); printf( "\n" );
} }
# endif DEBUG # endif /* DEBUG */
} }
for ( index = cycletop + 1 ; index <= dfn_depth ; index += 1 ) { for ( index = cycletop + 1 ; index <= dfn_depth ; index += 1 ) {
childp = dfn_stack[ index ].nlentryp; childp = dfn_stack[ index ].nlentryp;
@ -240,7 +244,7 @@ dfn_findcycle( childp )
printname( cycleheadp ); printname( cycleheadp );
printf( "\n" ); printf( "\n" );
} }
# endif DEBUG # endif /* DEBUG */
for ( tailp = childp ; tailp->cnext ; tailp = tailp->cnext ) { for ( tailp = childp ; tailp->cnext ; tailp = tailp->cnext ) {
tailp -> cnext -> cyclehead = cycleheadp; tailp -> cnext -> cyclehead = cycleheadp;
# ifdef DEBUG # ifdef DEBUG
@ -251,7 +255,7 @@ dfn_findcycle( childp )
printname( cycleheadp ); printname( cycleheadp );
printf( "\n" ); printf( "\n" );
} }
# endif DEBUG # endif /* DEBUG */
} }
} else if ( childp -> cyclehead != cycleheadp /* firewall */ ) { } else if ( childp -> cyclehead != cycleheadp /* firewall */ ) {
fprintf( stderr , fprintf( stderr ,
@ -278,7 +282,7 @@ dfn_self_cycle( parentp )
printname( parentp ); printname( parentp );
printf( "\n" ); printf( "\n" );
} }
# endif DEBUG # endif /* DEBUG */
} }
/* /*
@ -297,7 +301,7 @@ dfn_post_visit( parentp )
printname( parentp ); printname( parentp );
printf( "\n" ); printf( "\n" );
} }
# endif DEBUG # endif /* DEBUG */
/* /*
* number functions and things in their cycles * number functions and things in their cycles
* unless the function is itself part of a cycle * unless the function is itself part of a cycle
@ -312,14 +316,14 @@ dfn_post_visit( parentp )
printname( memberp ); printname( memberp );
printf( " -> toporder = %d\n" , dfn_counter ); printf( " -> toporder = %d\n" , dfn_counter );
} }
# endif DEBUG # endif /* DEBUG */
} }
} else { } else {
# ifdef DEBUG # ifdef DEBUG
if ( debug & DFNDEBUG ) { if ( debug & DFNDEBUG ) {
printf( "[dfn_post_visit]\t\tis part of a cycle\n" ); printf( "[dfn_post_visit]\t\tis part of a cycle\n" );
} }
# endif DEBUG # endif /* DEBUG */
} }
dfn_depth -= 1; dfn_depth -= 1;
} }

View File

@ -96,9 +96,9 @@ main(argc, argv)
debug |= ANYDEBUG; debug |= ANYDEBUG;
# ifdef DEBUG # ifdef DEBUG
printf("[main] debug = %d\n", debug); printf("[main] debug = %d\n", debug);
# else not DEBUG # else /* not DEBUG */
printf("gprof: -d ignored\n"); printf("gprof: -d ignored\n");
# endif DEBUG # endif /* DEBUG */
break; break;
case 'E': case 'E':
++argv; ++argv;
@ -258,7 +258,7 @@ getpfile(filename)
printf( "[getpfile] frompc 0x%lx selfpc 0x%lx count %ld\n" , printf( "[getpfile] frompc 0x%lx selfpc 0x%lx count %ld\n" ,
arc.raw_frompc , arc.raw_selfpc , arc.raw_count ); arc.raw_frompc , arc.raw_selfpc , arc.raw_count );
} }
# endif DEBUG # endif /* DEBUG */
/* /*
* add this arc * add this arc
*/ */
@ -330,7 +330,7 @@ openpfile(filename)
sampbytes , nsamples ); sampbytes , nsamples );
printf( "[openpfile] sample rate %ld\n" , hz ); printf( "[openpfile] sample rate %ld\n" , hz );
} }
# endif DEBUG # endif /* DEBUG */
return(pfile); return(pfile);
} }
@ -355,7 +355,7 @@ tally( rawp )
printf( "[tally] arc from %s to %s traversed %ld times\n" , printf( "[tally] arc from %s to %s traversed %ld times\n" ,
parentp -> name , childp -> name , rawp -> raw_count ); parentp -> name , childp -> name , rawp -> raw_count );
} }
# endif DEBUG # endif /* DEBUG */
addarc( parentp , childp , rawp -> raw_count ); addarc( parentp , childp , rawp -> raw_count );
} }
@ -405,7 +405,7 @@ dumpsum( sumfile )
printf( "[dumpsum] frompc 0x%lx selfpc 0x%lx count %ld\n" , printf( "[dumpsum] frompc 0x%lx selfpc 0x%lx count %ld\n" ,
arc.raw_frompc , arc.raw_selfpc , arc.raw_count ); arc.raw_frompc , arc.raw_selfpc , arc.raw_count );
} }
# endif DEBUG # endif /* DEBUG */
} }
} }
fclose( sfile ); fclose( sfile );
@ -538,7 +538,7 @@ asgnsamples()
printf( "[asgnsamples] pcl 0x%lx pch 0x%lx ccnt %.0f\n" , printf( "[asgnsamples] pcl 0x%lx pch 0x%lx ccnt %.0f\n" ,
pcl , pch , ccnt ); pcl , pch , ccnt );
} }
# endif DEBUG # endif /* DEBUG */
totime += time; totime += time;
for (j = j - 1; j < nname; j++) { for (j = j - 1; j < nname; j++) {
svalue0 = nl[j].svalue; svalue0 = nl[j].svalue;
@ -564,7 +564,7 @@ asgnsamples()
svalue0, svalue1, nl[j].name, svalue0, svalue1, nl[j].name,
overlap * time / scale, overlap); overlap * time / scale, overlap);
} }
# endif DEBUG # endif /* DEBUG */
nl[j].time += overlap * time / scale; nl[j].time += overlap * time / scale;
} }
} }
@ -573,7 +573,7 @@ asgnsamples()
if (debug & SAMPLEDEBUG) { if (debug & SAMPLEDEBUG) {
printf("[asgnsamples] totime %f\n", totime); printf("[asgnsamples] totime %f\n", totime);
} }
# endif DEBUG # endif /* DEBUG */
} }
@ -619,7 +619,7 @@ alignentries()
nlp->svalue, nlp->svalue,
nlp->svalue + OFFSET_OF_CODE / HISTORICAL_SCALE_2); nlp->svalue + OFFSET_OF_CODE / HISTORICAL_SCALE_2);
} }
# endif DEBUG # endif /* DEBUG */
nlp->svalue += OFFSET_OF_CODE / HISTORICAL_SCALE_2; nlp->svalue += OFFSET_OF_CODE / HISTORICAL_SCALE_2;
} }
} }

View File

@ -32,7 +32,11 @@
*/ */
#ifndef lint #ifndef lint
#if 0
static char sccsid[] = "@(#)lookup.c 8.1 (Berkeley) 6/6/93"; static char sccsid[] = "@(#)lookup.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
"$FreeBSD$";
#endif /* not lint */ #endif /* not lint */
#include "gprof.h" #include "gprof.h"
@ -53,18 +57,18 @@ nllookup( address )
register int probes; register int probes;
probes = 0; probes = 0;
# endif DEBUG # endif /* DEBUG */
for ( low = 0 , high = nname - 1 ; low != high ; ) { for ( low = 0 , high = nname - 1 ; low != high ; ) {
# ifdef DEBUG # ifdef DEBUG
probes += 1; probes += 1;
# endif DEBUG # endif /* DEBUG */
middle = ( high + low ) >> 1; middle = ( high + low ) >> 1;
if ( nl[ middle ].value <= address && nl[ middle+1 ].value > address ) { if ( nl[ middle ].value <= address && nl[ middle+1 ].value > address ) {
# ifdef DEBUG # ifdef DEBUG
if ( debug & LOOKUPDEBUG ) { if ( debug & LOOKUPDEBUG ) {
printf( "[nllookup] %d (%d) probes\n" , probes , nname-1 ); printf( "[nllookup] %d (%d) probes\n" , probes , nname-1 );
} }
# endif DEBUG # endif /* DEBUG */
return &nl[ middle ]; return &nl[ middle ];
} }
if ( nl[ middle ].value > address ) { if ( nl[ middle ].value > address ) {
@ -78,7 +82,7 @@ nllookup( address )
fprintf( stderr , "[nllookup] (%d) binary search fails\n" , fprintf( stderr , "[nllookup] (%d) binary search fails\n" ,
nname-1 ); nname-1 );
} }
# endif DEBUG # endif /* DEBUG */
return 0; return 0;
} }
@ -98,7 +102,7 @@ arclookup( parentp , childp )
printf( "[arclookup] parent %s child %s\n" , printf( "[arclookup] parent %s child %s\n" ,
parentp -> name , childp -> name ); parentp -> name , childp -> name );
} }
# endif DEBUG # endif /* DEBUG */
for ( arcp = parentp -> children ; arcp ; arcp = arcp -> arc_childlist ) { for ( arcp = parentp -> children ; arcp ; arcp = arcp -> arc_childlist ) {
# ifdef DEBUG # ifdef DEBUG
if ( debug & LOOKUPDEBUG ) { if ( debug & LOOKUPDEBUG ) {
@ -106,7 +110,7 @@ arclookup( parentp , childp )
arcp -> arc_parentp -> name , arcp -> arc_parentp -> name ,
arcp -> arc_childp -> name ); arcp -> arc_childp -> name );
} }
# endif DEBUG # endif /* DEBUG */
if ( arcp -> arc_childp == childp ) { if ( arcp -> arc_childp == childp ) {
return arcp; return arcp;
} }

View File

@ -379,7 +379,7 @@ printname( selfp )
if ( debug & PROPDEBUG ) { if ( debug & PROPDEBUG ) {
printf( "%5.2f%% " , selfp -> propfraction ); printf( "%5.2f%% " , selfp -> propfraction );
} }
# endif DEBUG # endif /* DEBUG */
} }
if ( selfp -> cycleno != 0 ) { if ( selfp -> cycleno != 0 ) {
printf( " <cycle %d>" , selfp -> cycleno ); printf( " <cycle %d>" , selfp -> cycleno );
@ -617,7 +617,7 @@ arccmp( thisp , thatp )
thatp -> arc_count , thatchildp -> ncall ); thatp -> arc_count , thatchildp -> ncall );
printf( "\n" ); printf( "\n" );
} }
# endif DEBUG # endif /* DEBUG */
if ( thisparentp == thischildp ) { if ( thisparentp == thischildp ) {
/* this is a self call */ /* this is a self call */
return LESSTHAN; return LESSTHAN;