[PATCH 4/4] gas: new_logical_line{,_flags}() can return "void"
Jan Beulich
jbeulich@suse.com
Mon Apr 4 16:02:22 GMT 2022
With the sole user of the return value gone, convert the return type to
void. This in turn allows simplifying another construct, by moving it
slightly later in the function.
--- a/gas/as.h
+++ b/gas/as.h
@@ -473,8 +473,8 @@ void do_scrub_begin (int);
void input_scrub_begin (void);
void input_scrub_close (void);
void input_scrub_end (void);
-int new_logical_line (const char *, int);
-int new_logical_line_flags (const char *, int, int);
+void new_logical_line (const char *, int);
+void new_logical_line_flags (const char *, int, int);
void subsegs_begin (void);
void subseg_change (segT, int);
segT subseg_new (const char *, subsegT);
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -19737,7 +19737,7 @@ s_mips_file (int x ATTRIBUTE_UNUSED)
after 3.1 in order to support DWARF-2 on MIPS. */
if (filename != NULL && ! first_file_directive)
{
- (void) new_logical_line (filename, -1);
+ new_logical_line (filename, -1);
s_file_string (filename);
}
first_file_directive = 1;
--- a/gas/input-scrub.c
+++ b/gas/input-scrub.c
@@ -450,7 +450,7 @@ bump_line_counters (void)
bit 3 of flags is set.
Returns nonzero if the filename actually changes. */
-int
+void
new_logical_line_flags (const char *fname, /* DON'T destroy it! We point to it! */
int line_number,
int flags)
@@ -473,7 +473,7 @@ new_logical_line_flags (const char *fnam
/* PR gas/16908 workaround: Ignore updates when nested inside a macro
expansion. */
if (from_sb_expansion == expanding_nested)
- return 0;
+ return;
if (next_saved_file->logical_input_file)
fname = next_saved_file->logical_input_file;
else
@@ -492,30 +492,25 @@ new_logical_line_flags (const char *fnam
fname = NULL;
}
+ if (fname
+ && (logical_input_file == NULL
+ || filename_cmp (logical_input_file, fname)))
+ logical_input_file = fname;
+
/* When encountering file or line changes inside a macro, arrange for
bump_line_counters() to henceforth increment the logical line number
again, just like it does when expanding repeats. See as_where() for
why changing file or line alone doesn't alter expansion mode. */
if (from_sb_expansion == expanding_macro
- && (logical_input_file != NULL || fname != NULL)
+ && logical_input_file != NULL
&& logical_input_line != -1u)
from_sb_expansion = expanding_repeat;
-
- if (fname
- && (logical_input_file == NULL
- || filename_cmp (logical_input_file, fname)))
- {
- logical_input_file = fname;
- return 1;
- }
- else
- return 0;
}
-int
+void
new_logical_line (const char *fname, int line_number)
{
- return new_logical_line_flags (fname, line_number, 0);
+ new_logical_line_flags (fname, line_number, 0);
}
More information about the Binutils
mailing list