[binutils-gdb] gas: new_logical_line{,_flags}() can return "void"
Jan Beulich
jbeulich@sourceware.org
Tue Apr 12 07:05:18 GMT 2022
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=66b39b8b9c886e6adc17ba6b81ebf5b1febabb53
commit 66b39b8b9c886e6adc17ba6b81ebf5b1febabb53
Author: Jan Beulich <jbeulich@suse.com>
Date: Tue Apr 12 09:04:42 2022 +0200
gas: new_logical_line{,_flags}() can return "void"
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.
Diff:
---
gas/as.h | 4 ++--
gas/config/tc-mips.c | 2 +-
gas/input-scrub.c | 25 ++++++++++---------------
3 files changed, 13 insertions(+), 18 deletions(-)
diff --git a/gas/as.h b/gas/as.h
index ff5b9a4c01c..135abc8f23d 100644
--- 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);
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index ae7a44315a6..9b895a65b63 100644
--- 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;
diff --git a/gas/input-scrub.c b/gas/input-scrub.c
index 47382e37aa0..f65cd7957b1 100644
--- 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 *fname, /* DON'T destroy it! We point to it!
/* 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 *fname, /* DON'T destroy it! We point to it!
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-cvs
mailing list