lang_input_statement_type next pointers

"next" and "next_real_file" in lang_input_statement_type always point
to another lang_input_statement_type, so it makes sense for these to
not be the generic lang_statement_union_type.  This patch also updates
a number of variables in ldlang.c for the same reason, and modifies
lang_statement_append to reduce the need for casts.

	* ldlang.h (lang_input_statement_type): Make next
	and next_real_file a lang_input_statement_type pointer.
	(lang_statement_append): Delete prototype.
	(LANG_FOR_EACH_INPUT_STATEMENT): Update for lang_input_statement_type
	change.
	* ldmain.c (add_archive_element): Likewise.
	* ldlang.c: Likewise throughout.
	(lang_statement_append): Make static.  Make element and field
	void pointers.  Remove casts in calls.
	(lang_check): Use a lang_input_statement_type pointer for "file".
	(find_rescan_insertion): Similarly for "iter" and return value.
	(lang_process): Similarly for "insert", "iter" and "temp".
	* emultempl/spuelf.em (embedded_spu_file): Likewise.
	* emultempl/aix.em (gld${EMULATION_NAME}_before_allocation): Expand
	lang_statment_append call.
This commit is contained in:
Alan Modra
2019-08-10 10:30:19 +09:30
parent 8be90e9631
commit 36983a93bb
6 changed files with 67 additions and 56 deletions

View File

@@ -309,10 +309,10 @@ typedef struct lang_input_statement_struct
struct flag_info *section_flag_list;
/* Next pointer for file_chain statement list. */
union lang_statement_union *next;
struct lang_input_statement_struct *next;
/* Next pointer for input_file_chain statement list. */
union lang_statement_union *next_real_file;
struct lang_input_statement_struct *next_real_file;
const char *target;
@@ -567,9 +567,6 @@ extern void lang_float
extern void lang_leave_output_section_statement
(fill_type *, const char *, lang_output_section_phdr_list *,
const char *);
extern void lang_statement_append
(lang_statement_list_type *, lang_statement_union_type *,
lang_statement_union_type **);
extern void lang_for_each_input_file
(void (*dothis) (lang_input_statement_type *));
extern void lang_for_each_file
@@ -585,7 +582,7 @@ extern asection *section_for_dot
lang_input_statement_type *statement; \
for (statement = &file_chain.head->input_statement; \
statement != NULL; \
statement = &statement->next->input_statement)
statement = statement->next)
#define lang_output_section_find(NAME) \
lang_output_section_statement_lookup (NAME, 0, FALSE)