diff options
Diffstat (limited to 'gcc/treelang')
-rw-r--r-- | gcc/treelang/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/treelang/tree1.c | 24 | ||||
-rw-r--r-- | gcc/treelang/treelang.h | 2 | ||||
-rw-r--r-- | gcc/treelang/treetree.c | 42 | ||||
-rw-r--r-- | gcc/treelang/treetree.h | 18 |
5 files changed, 55 insertions, 43 deletions
diff --git a/gcc/treelang/ChangeLog b/gcc/treelang/ChangeLog index ed490c61e06..d7276347941 100644 --- a/gcc/treelang/ChangeLog +++ b/gcc/treelang/ChangeLog @@ -1,3 +1,15 @@ +2003-03-08 Neil Booth <neil@daikokuya.co.uk> + + * tree1.c (in_fname): Fix type. + (treelang_init): Update prototype and use of in_fname. + * treelang.h (in_fname): Fix type. + * treetree.c (tree_code_if_start, tree_code_if_else, + tree_code_if_end, tree_code_create_function_prototype, + tree_code_create_function_initial, tree_code_create_funciton_wrapup, + tree_code_create_variable, tree_code_output_expression_statement) + : Fix prototypes and use of filenames. + * treetree.h: Similarly. + 2003-03-05 Andreas Jaeger <aj@suse.de> * treetree.c (init_c_lex): Follow change to c-common.h. diff --git a/gcc/treelang/tree1.c b/gcc/treelang/tree1.c index 20913bafd78..e6f96d4b625 100644 --- a/gcc/treelang/tree1.c +++ b/gcc/treelang/tree1.c @@ -78,7 +78,7 @@ unsigned int option_lexer_trace = 0; /* Local variables. */ -unsigned char *in_fname = NULL; /* Input file name. */ +const char *in_fname; /* Input file name. */ /* This is 1 if we have output the version string. */ @@ -179,12 +179,12 @@ treelang_decode_option (num_options_left, first_option_left) /* Language dependent parser setup. */ -const char* -treelang_init (const char* filename) +bool +treelang_init () { - /* Set up the declarations needed for this front end. */ + in_fname = main_input_filename; - input_filename = ""; + /* Set up the declarations needed for this front end. */ lineno = 0; /* Init decls etc. */ @@ -193,7 +193,7 @@ treelang_init (const char* filename) /* This error will not happen from GCC as it will always create a fake input file. */ - if (!filename || (filename[0] == ' ') || (!filename[0])) + if (!in_fname || in_fname[0] == ' ' || !in_fname[0]) { if (!version_done) { @@ -201,17 +201,17 @@ treelang_init (const char* filename) exit (1); } - in_fname = NULL; - return NULL; + return false; } - yyin = fopen (filename, "r"); + + yyin = fopen (in_fname, "r"); if (!yyin) { - fprintf (stderr, "Unable to open input file %s\n", filename); + fprintf (stderr, "Unable to open input file %s\n", in_fname); exit (1); } - input_filename = filename; - return (char*) (in_fname = (unsigned char*)filename); + + return true; } /* Language dependent wrapup. */ diff --git a/gcc/treelang/treelang.h b/gcc/treelang/treelang.h index 6258c0e88ec..5fded628736 100644 --- a/gcc/treelang/treelang.h +++ b/gcc/treelang/treelang.h @@ -40,7 +40,7 @@ enum category_enum }; /* Input file name and FILE. */ -extern unsigned char* in_fname; +extern const char* in_fname; extern FILE* yyin; /* Forward references to satisfy mutually recursive definitions. */ diff --git a/gcc/treelang/treetree.c b/gcc/treelang/treetree.c index aedca9d3a25..cc5455963fa 100644 --- a/gcc/treelang/treetree.c +++ b/gcc/treelang/treetree.c @@ -179,14 +179,14 @@ tree_code_get_type (int type_num) LINENO in file FILENAME. */ void -tree_code_if_start (tree exp, unsigned char* filename, int lineno) +tree_code_if_start (tree exp, const char* filename, int lineno) { tree cond_exp; cond_exp = build (NE_EXPR, TREE_TYPE (exp), exp, build1 (CONVERT_EXPR, TREE_TYPE (exp), integer_zero_node)); - emit_line_note ((const char *)filename, lineno); /* Output the line number information. */ + emit_line_note (filename, lineno); /* Output the line number information. */ expand_start_cond (cond_exp, /* Exit-able if nonzero. */ 0); } @@ -194,9 +194,9 @@ tree_code_if_start (tree exp, unsigned char* filename, int lineno) at line LINENO in file FILENAME. */ void -tree_code_if_else (unsigned char* filename, int lineno) +tree_code_if_else (const char* filename, int lineno) { - emit_line_note ((const char *)filename, lineno); /* Output the line number information. */ + emit_line_note (filename, lineno); /* Output the line number information. */ expand_start_else (); } @@ -204,9 +204,9 @@ tree_code_if_else (unsigned char* filename, int lineno) at line LINENO in file FILENAME. */ void -tree_code_if_end (unsigned char* filename, int lineno) +tree_code_if_end (const char* filename, int lineno) { - emit_line_note ((const char *)filename, lineno); /* Output the line number information. */ + emit_line_note (filename, lineno); /* Output the line number information. */ expand_end_cond (); } @@ -219,7 +219,7 @@ tree_code_create_function_prototype (unsigned char* chars, unsigned int storage_class, unsigned int ret_type, struct prod_token_parm_item* parms, - unsigned char* filename, + const char* filename, int lineno) { @@ -252,7 +252,7 @@ tree_code_create_function_prototype (unsigned char* chars, fn_decl = build_decl (FUNCTION_DECL, id, fn_type); DECL_CONTEXT (fn_decl) = NULL_TREE; /* Nested functions not supported here. */ - DECL_SOURCE_FILE (fn_decl) = (const char *)filename; + DECL_SOURCE_FILE (fn_decl) = filename; /* if (lineno > 1000000) ; */ /* Probably the line # is rubbish because someone forgot to set the line number - and unfortunately impossible line #s are used as @@ -304,7 +304,7 @@ tree_code_create_function_prototype (unsigned char* chars, parameter details are in the lists PARMS. Returns nothing. */ void tree_code_create_function_initial (tree prev_saved, - unsigned char* filename, + const char* filename, int lineno, struct prod_token_parm_item* parms) { @@ -332,14 +332,14 @@ tree_code_create_function_initial (tree prev_saved, current_function_decl = fn_decl; DECL_INITIAL (fn_decl) = error_mark_node; - DECL_SOURCE_FILE (fn_decl) = (const char *)filename; + DECL_SOURCE_FILE (fn_decl) = filename; DECL_SOURCE_LINE (fn_decl) = lineno; /* Prepare creation of rtl for a new function. */ resultdecl = DECL_RESULT (fn_decl) = build_decl (RESULT_DECL, NULL_TREE, TREE_TYPE (TREE_TYPE (fn_decl))); DECL_CONTEXT (DECL_RESULT (fn_decl)) = fn_decl; - DECL_SOURCE_FILE (resultdecl) = (const char *)filename; + DECL_SOURCE_FILE (resultdecl) = filename; DECL_SOURCE_LINE (resultdecl) = lineno; /* Work out the size. ??? is this needed. */ layout_decl (DECL_RESULT (fn_decl), 0); @@ -359,7 +359,7 @@ tree_code_create_function_initial (tree prev_saved, if (!fn_decl) abort (); DECL_CONTEXT (parm_decl) = fn_decl; - DECL_SOURCE_FILE (parm_decl) = (const char *)filename; + DECL_SOURCE_FILE (parm_decl) = filename; DECL_SOURCE_LINE (parm_decl) = lineno; parm_list = chainon (parm_decl, parm_list); } @@ -389,7 +389,7 @@ tree_code_create_function_initial (tree prev_saved, make_decl_rtl (fn_decl, NULL); /* Use filename/lineno from above. */ - init_function_start (fn_decl, (const char *)filename, lineno); + init_function_start (fn_decl, filename, lineno); /* Create rtl for startup code of function, such as saving registers. */ @@ -435,12 +435,12 @@ tree_code_create_function_initial (tree prev_saved, expand_start_bindings (0); - emit_line_note ((const char *)filename, lineno); /* Output the line number information. */ + emit_line_note (filename, lineno); /* Output the line number information. */ } /* Wrapup a function contained in file FILENAME, ending at line LINENO. */ void -tree_code_create_function_wrapup (unsigned char* filename, +tree_code_create_function_wrapup (const char* filename, int lineno) { tree block; @@ -448,7 +448,7 @@ tree_code_create_function_wrapup (unsigned char* filename, fn_decl = current_function_decl; - emit_line_note ((const char *)filename, lineno); /* Output the line number information. */ + emit_line_note (filename, lineno); /* Output the line number information. */ /* Get completely built level from debugger symbol table. */ @@ -460,7 +460,7 @@ tree_code_create_function_wrapup (unsigned char* filename, /* Emit rtl for end of function. */ - expand_function_end ((const char *)filename, lineno, 0); + expand_function_end (filename, lineno, 0); /* Pop the level. */ @@ -498,7 +498,7 @@ tree_code_create_variable (unsigned int storage_class, unsigned int length, unsigned int expression_type, tree init, - unsigned char* filename, + const char* filename, int lineno) { tree var_type; @@ -531,7 +531,7 @@ tree_code_create_variable (unsigned int storage_class, DECL_CONTEXT (var_decl) = current_function_decl; - DECL_SOURCE_FILE (var_decl) = (const char *)filename; + DECL_SOURCE_FILE (var_decl) = filename; DECL_SOURCE_LINE (var_decl) = lineno; /* Set the storage mode and whether only visible in the same file. */ @@ -613,10 +613,10 @@ tree_code_generate_return (tree type, tree exp) void tree_code_output_expression_statement (tree code, - unsigned char* filename, int lineno) + const char* filename, int lineno) { /* Output the line number information. */ - emit_line_note ((const char *)filename, lineno); + emit_line_note (filename, lineno); TREE_USED (code) = 1; TREE_SIDE_EFFECTS (code) = 1; expand_expr_stmt (code); diff --git a/gcc/treelang/treetree.h b/gcc/treelang/treetree.h index 111cf128183..c41dd6d5ed4 100644 --- a/gcc/treelang/treetree.h +++ b/gcc/treelang/treetree.h @@ -39,31 +39,31 @@ void tree_ggc_storage_always_used (void *m); tree tree_code_get_expression (unsigned int exp_type, tree type, tree op1, tree op2, tree op3); tree tree_code_get_numeric_type (unsigned int size1, unsigned int sign1); void tree_code_create_function_initial (tree prev_saved, - unsigned char* filename, int lineno, + const char* filename, int lineno, struct prod_token_parm_item* parms); -void tree_code_create_function_wrapup (unsigned char* filename, int lineno); +void tree_code_create_function_wrapup (const char* filename, int lineno); tree tree_code_create_function_prototype (unsigned char* chars, unsigned int storage_class, unsigned int ret_type, struct prod_token_parm_item* parms, - unsigned char* filename, + const char* filename, int lineno); tree tree_code_create_variable (unsigned int storage_class, unsigned char* chars, unsigned int length, unsigned int expression_type, tree init, - unsigned char* filename, + const char* filename, int lineno); -void tree_code_output_expression_statement (tree code, unsigned char* filename, int lineno); +void tree_code_output_expression_statement (tree code, const char* filename, int lineno); tree get_type_for_numeric_type (unsigned int numeric_type); -void tree_code_if_start (tree exp, unsigned char* filename, int lineno); -void tree_code_if_else (unsigned char* filename, int lineno); -void tree_code_if_end (unsigned char* filename, int lineno); +void tree_code_if_start (tree exp, const char* filename, int lineno); +void tree_code_if_else (const char* filename, int lineno); +void tree_code_if_end (const char* filename, int lineno); tree tree_code_get_type (int type_num); void treelang_init_decl_processing (void); void treelang_finish (void); -const char *treelang_init (const char* filename); +bool treelang_init (void); int treelang_decode_option (int, char **); void treelang_parse_file (int debug_flag); void push_var_level (void); |