Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 274290
b: refs/heads/master
c: 2c5925d
h: refs/heads/master
v: v3
  • Loading branch information
Michal Marek committed Oct 11, 2011
1 parent 79f86e2 commit 74445c2
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b06fcd6c83c231f51a86448bb33c4cd717fefee8
refs/heads/master: 2c5925d6b7fedc8f1c325f4f85451f505ec69aca
3 changes: 2 additions & 1 deletion trunk/scripts/genksyms/genksyms.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ static struct symbol *symtab[HASH_BUCKETS];
static FILE *debugfile;

int cur_line = 1;
char *cur_filename;
char *cur_filename, *source_file;
int in_source_file;

static int flag_debug, flag_dump_defs, flag_reference, flag_dump_types,
flag_preserve, flag_warnings;
Expand Down
4 changes: 3 additions & 1 deletion trunk/scripts/genksyms/genksyms.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ enum symbol_status {
struct string_list {
struct string_list *next;
enum symbol_type tag;
int in_source_file;
char *string;
};

Expand All @@ -57,7 +58,8 @@ typedef struct string_list **yystype;
#define YYSTYPE yystype

extern int cur_line;
extern char *cur_filename;
extern char *cur_filename, *source_file;
extern int in_source_file;

struct symbol *find_symbol(const char *name, enum symbol_type ns, int exact);
struct symbol *add_symbol(const char *name, enum symbol_type type,
Expand Down
8 changes: 8 additions & 0 deletions trunk/scripts/genksyms/lex.l
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ MC_TOKEN ([~%^&*+=|<>/-]=)|(&&)|("||")|(->)|(<<)|(>>)
cur_node->tag = \
find_symbol(cur_node->string, SYM_ENUM_CONST, 1)?\
SYM_ENUM_CONST : SYM_NORMAL ; \
cur_node->in_source_file = in_source_file; \
} while (0)
#define APP _APP(yytext, yyleng)
Expand Down Expand Up @@ -166,6 +167,13 @@ repeat:
cur_filename = memcpy(xmalloc(e-file+1), file, e-file+1);
cur_line = atoi(yytext+2);
if (!source_file) {
source_file = xstrdup(cur_filename);
in_source_file = 1;
} else {
in_source_file = (strcmp(cur_filename, source_file) == 0);
}
goto repeat;
}
Expand Down
7 changes: 7 additions & 0 deletions trunk/scripts/genksyms/parse.y
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ static void record_compound(struct string_list **keyw,
enum symbol_type type)
{
struct string_list *b = *body, *i = *ident, *r;

if (i->in_source_file) {
remove_node(keyw);
(*ident)->tag = type;
remove_list(body, ident);
return;
}
r = copy_node(i); r->tag = type;
r->next = (*keyw)->next; *body = r; (*keyw)->next = NULL;
add_symbol(i->string, type, b, is_extern);
Expand Down

0 comments on commit 74445c2

Please sign in to comment.