Commit 50e945a7 authored by dcw's avatar dcw
Browse files

added opt flag, meaning: only optimize if -o present

parent 0c7e05e7
......@@ -23,7 +23,7 @@
#include "decs.h"
#define MUSTBE(b) ASSERT(b,("Usage: datadec [-vp] outfile [infile]\n"))
#define MUSTBE(b) ASSERT(b,("Usage: datadec [-vpo] outfile [infile]\n"))
#define NEED_ANOTHER_ARG MUSTBE( IS_ANOTHER_ARG )
#define REQUIRE_NO_MORE_ARGS MUSTBE( argc == arg )
......@@ -43,7 +43,7 @@ main( argc, argv ) int argc; char **argv;
arg = 1;
NEED_ANOTHER_ARG;
verbose = FALSE; print = FALSE;
verbose = FALSE; print = FALSE; opt = FALSE;
while( *(s=argv[arg]) == '-' )
{
for( s++; *s; s++ )
......@@ -56,6 +56,9 @@ main( argc, argv ) int argc; char **argv;
case 'p':
print = TRUE;
break;
case 'o':
opt = TRUE;
break;
default:
ABORT( ("datadec: illegal option -%c\n",*s) );
}
......
......@@ -360,6 +360,12 @@ static void optimize( d ) declnlist d;
int t, e, ne;
for( ; d != NULL; d = d->next )
{
if( ! opt )
{
d->Defines = d->TagField = d->Struct = d->Union = TRUE;
d->UseNull = FALSE;
} else
{
count_empty_non( d->shapes, &e, &ne );
t = e+ne;
......@@ -381,7 +387,7 @@ static void optimize( d ) declnlist d;
{
d->Defines = TRUE;
/* !TagField, !Struct, !Union, !UseNull */
} else if( d->shapes->params == NULL ) /* 1st is empty */
} else if( d->shapes->params == NULL ) /* 1st empty */
{
d->UseNull = d->Struct = TRUE;
if( t==2 && ne==1 )
......@@ -432,6 +438,7 @@ static void optimize( d ) declnlist d;
ASSERT( implies(d->TagField,d->Defines),
("optimizer error: type %s has TagField&!Defines\n",d->name) );
}
}
}
......
......@@ -4,4 +4,4 @@ extern void make_declns( declnlist , FILE * , FILE * , char * );
extern void make_declns();
#endif
extern BOOL print, verbose;
extern BOOL print, verbose, opt;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment