Remove unused and unnecessary "declare enum" from bifcl

This commit is contained in:
Gregor Maier 2011-02-10 13:49:09 -08:00
parent a12e711888
commit 43a84866a0
5 changed files with 2 additions and 21 deletions

View file

@ -24,7 +24,6 @@ static struct {
}; };
extern const char* arg_list_name; extern const char* arg_list_name;
extern set<string> enum_types;
BuiltinFuncArg::BuiltinFuncArg(const char* arg_name, int arg_type) BuiltinFuncArg::BuiltinFuncArg(const char* arg_name, int arg_type)
{ {
@ -45,9 +44,6 @@ BuiltinFuncArg::BuiltinFuncArg(const char* arg_name, const char* arg_type_str)
type = i; type = i;
type_str = ""; type_str = "";
} }
if ( enum_types.find(type_str) != enum_types.end() )
type = TYPE_ENUM;
} }
void BuiltinFuncArg::PrintBro(FILE* fp) void BuiltinFuncArg::PrintBro(FILE* fp)

View file

@ -67,7 +67,6 @@ HEX [0-9a-fA-F]+
"event" return check_c_mode(TOK_EVENT); "event" return check_c_mode(TOK_EVENT);
"const" return check_c_mode(TOK_CONST); "const" return check_c_mode(TOK_CONST);
"enum" return check_c_mode(TOK_ENUM); "enum" return check_c_mode(TOK_ENUM);
"declare" return check_c_mode(TOK_DECLARE);
"type" return check_c_mode(TOK_TYPE); "type" return check_c_mode(TOK_TYPE);
"record" return check_c_mode(TOK_RECORD); "record" return check_c_mode(TOK_RECORD);

View file

@ -67,9 +67,6 @@ extern const char* decl_name;
int var_arg; // whether the number of arguments is variable int var_arg; // whether the number of arguments is variable
std::vector<BuiltinFuncArg*> args; std::vector<BuiltinFuncArg*> args;
// enum types declared by "declare enum <id>"
set<string> enum_types;
extern int yyerror(const char[]); extern int yyerror(const char[]);
extern int yywarn(const char msg[]); extern int yywarn(const char msg[]);
extern int yylex(); extern int yylex();
@ -154,7 +151,7 @@ void print_event_c_body(FILE *fp)
%token TOK_LPP TOK_RPP TOK_LPB TOK_RPB TOK_LPPB TOK_RPPB TOK_VAR_ARG %token TOK_LPP TOK_RPP TOK_LPB TOK_RPB TOK_LPPB TOK_RPPB TOK_VAR_ARG
%token TOK_BOOL %token TOK_BOOL
%token TOK_FUNCTION TOK_REWRITER TOK_EVENT TOK_CONST TOK_ENUM TOK_DECLARE %token TOK_FUNCTION TOK_REWRITER TOK_EVENT TOK_CONST TOK_ENUM
%token TOK_TYPE TOK_RECORD %token TOK_TYPE TOK_RECORD
%token TOK_WRITE TOK_PUSH TOK_EOF TOK_TRACE %token TOK_WRITE TOK_PUSH TOK_EOF TOK_TRACE
%token TOK_ARGS TOK_ARG TOK_ARGC %token TOK_ARGS TOK_ARG TOK_ARGC
@ -202,15 +199,9 @@ definition: event_def
| c_code_segment | c_code_segment
| enum_def | enum_def
| const_def | const_def
| declare_def
| type_def | type_def
; ;
declare_def: TOK_DECLARE opt_ws TOK_ENUM opt_ws TOK_ID opt_ws ';'
{
enum_types.insert($5);
}
;
// XXX: Add the netvar glue so that the event engine knows about // XXX: Add the netvar glue so that the event engine knows about
// the type. One still has to define the type in bro.init. // the type. One still has to define the type in bro.init.

View file

@ -1,10 +1,5 @@
# $Id: event.bif 6942 2009-11-16 03:54:08Z vern $ # $Id: event.bif 6942 2009-11-16 03:54:08Z vern $
# Declare to bifcl the following types as enum types.
declare enum dce_rpc_ptype;
declare enum dce_rpc_if_id;
declare enum rpc_status;
event bro_init%(%); event bro_init%(%);
event bro_done%(%); event bro_done%(%);

View file

@ -150,7 +150,7 @@ function PortmapCallFailed(connection: RPC_Conn,
status: EnumRPCStatus): bool status: EnumRPCStatus): bool
%{ %{
// BroEnum::rpc_status st = static_cast<BroEnum::rpc_status>(status); // BroEnum::rpc_status st = static_cast<BroEnum::rpc_status>(status);
BroEnum::rpc_status st = (BroEnum::rpc_status) status; Val *st = new EnumVal((BroEnum::rpc_status) status, enum_rpc_status);
switch ( call->proc() ) { switch ( call->proc() ) {
case PMAPPROC_NULL: case PMAPPROC_NULL: