handle return statements

svn path=/trunk/; revision=6634
This commit is contained in:
Royce Mitchell III 2003-11-12 21:27:26 +00:00
parent d20b00b875
commit 2a02daaac3
2 changed files with 10 additions and 8 deletions

View file

@ -6,7 +6,7 @@
typedef enum typedef enum
{ {
T_UNKNOWN = -1, T_UNKNOWN = -1,
T_ASM, T_IGNORED_STATEMENT,
T_TIDENT, T_TIDENT,
T_MACRO, T_MACRO,
T_DEFINE, T_DEFINE,

View file

@ -45,7 +45,7 @@ Type process ( const string& element, vector<string>& names, bool& isTypedef, ve
void process_preprocessor ( const char* filename, Header& h, const string& element ); void process_preprocessor ( const char* filename, Header& h, const string& element );
void process_c ( Header& h, const string& element ); void process_c ( Header& h, const string& element );
int parse_type ( Type t, const vector<string>& tokens, int off, vector<string>& names, vector<string>& dependencies ); int parse_type ( Type t, const vector<string>& tokens, int off, vector<string>& names, vector<string>& dependencies );
int parse_asm ( const vector<string>& tokens, int off, vector<string>& names, vector<string>& dependencies ); int parse_ignored_statement ( const vector<string>& tokens, int off, vector<string>& names, vector<string>& dependencies );
int parse_tident ( const vector<string>& tokens, int off, vector<string>& names, vector<string>& dependencies ); int parse_tident ( const vector<string>& tokens, int off, vector<string>& names, vector<string>& dependencies );
int parse_variable ( const vector<string>& tokens, int off, vector<string>& names, vector<string>& dependencies ); int parse_variable ( const vector<string>& tokens, int off, vector<string>& names, vector<string>& dependencies );
int parse_struct ( const vector<string>& tokens, int off, vector<string>& names, vector<string>& dependencies ); int parse_struct ( const vector<string>& tokens, int off, vector<string>& names, vector<string>& dependencies );
@ -60,7 +60,8 @@ const char* libc_includes[] =
"except.h", "except.h",
"limits.h", "limits.h",
"stdarg.h", "stdarg.h",
"stdlib.h" "stdlib.h",
"string.h"
}; };
bool is_libc_include ( const string& inc ) bool is_libc_include ( const string& inc )
@ -495,7 +496,9 @@ Type identify ( const vector<string>& tokens, int off )
_CrtDbgBreak(); _CrtDbgBreak();
}*/ }*/
if ( tokens[off] == "__asm__" ) if ( tokens[off] == "__asm__" )
return T_ASM; return T_IGNORED_STATEMENT;
else if ( tokens[off] == "return" )
return T_IGNORED_STATEMENT;
else if ( tokens[off] == "typedef_tident" ) else if ( tokens[off] == "typedef_tident" )
return T_TIDENT; return T_TIDENT;
else if ( tokens[off] == "if" ) else if ( tokens[off] == "if" )
@ -561,8 +564,8 @@ int parse_type ( Type t, const vector<string>& tokens, int off, vector<string>&
{ {
switch ( t ) switch ( t )
{ {
case T_ASM: case T_IGNORED_STATEMENT:
return parse_asm ( tokens, off, names, dependencies ); return parse_ignored_statement ( tokens, off, names, dependencies );
case T_TIDENT: case T_TIDENT:
return parse_tident ( tokens, off, names, dependencies ); return parse_tident ( tokens, off, names, dependencies );
case T_VARIABLE: case T_VARIABLE:
@ -612,9 +615,8 @@ void depend ( const string& ident, vector<string>& dependencies )
dependencies.push_back ( ident ); dependencies.push_back ( ident );
} }
int parse_asm ( const vector<string>& tokens, int off, vector<string>& names, vector<string>& dependencies ) int parse_ignored_statement ( const vector<string>& tokens, int off, vector<string>& names, vector<string>& dependencies )
{ {
TOKASSERT ( tokens[off] == "__asm__" );
off++; off++;
while ( tokens[off] != ";" ) while ( tokens[off] != ";" )
off++; off++;