This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Commit: Add support for a temporary input line pointer in gas/read.c
- From: Nick Clifton <nickc at redhat dot com>
- To: Alan Modra <amodra at gmail dot com>
- Cc: binutils at sourceware dot org
- Date: Fri, 13 Jan 2017 09:58:03 +0000
- Subject: Re: Commit: Add support for a temporary input line pointer in gas/read.c
- Authentication-results: sourceware.org; auth=none
- References: <8760lk9vki.fsf@redhat.com> <20170113002629.GN32333@bubble.grove.modra.org>
Hi Alan,
>> +static char *saved_ilp = NULL;
>> +static char *saved_limit;
>
> Can I suggest instead that you declare a struct save_ilp, use one of
> them as a local var, and pass that by reference to the save/restore
> functions. They could be made inline too.
I could do this, but why ? What do we gain. It is not like these functions
need to be fast, or that they affect the performance of the assembler.
>> + /* Prevent the assert in restore_ilp from triggering if
>> + the input_line_pointer has not yet been initialised. */
>> + if (saved_ilp == NULL)
>> + saved_limit = saved_ilp = (char *) "";
>
> Changing saved_ilp means it really isn't saved!
True, but I just wanted to avoid having to create a third local variable
saying 'the saved_ilp has been initialised'. It does not matter that we
"restore" the input_line_pointer to an empty buffer, because the only way
that this situation can arise is if the input_line_pointer has not yet
been used.
Cheers
Nick