/* This is the Assembler Pre-Processor
- Copyright (C) 1987-2014 Free Software Foundation, Inc.
+ Copyright (C) 1987-2021 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
static const char * symver_state;
#endif
+static char last_char;
+
static char lex[256];
static const char symbol_chars[] =
"$._ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
{
lex['"'] = LEX_IS_STRINGQUOTE;
-#if ! defined (TC_HPPA) && ! defined (TC_I370)
- /* I370 uses single-quotes to delimit integer, float constants. */
+#if ! defined (TC_HPPA)
lex['\''] = LEX_IS_ONECHAR_QUOTE;
#endif
/* Saved state of the scrubber. */
static int state;
static int old_state;
-static char *out_string;
+static const char *out_string;
static char out_buf[20];
static int add_newlines;
static char *saved_input;
{
int state;
int old_state;
- char * out_string;
+ const char * out_string;
char out_buf[sizeof (out_buf)];
int add_newlines;
char * saved_input;
#if defined TC_ARM && defined OBJ_ELF
const char * symver_state;
#endif
+ char last_char;
};
char *
app_push (void)
{
- register struct app_save *saved;
+ struct app_save *saved;
- saved = (struct app_save *) xmalloc (sizeof (*saved));
+ saved = XNEW (struct app_save);
saved->state = state;
saved->old_state = old_state;
saved->out_string = out_string;
saved->saved_input = NULL;
else
{
- saved->saved_input = (char *) xmalloc (saved_input_len);
+ saved->saved_input = XNEWVEC (char, saved_input_len);
memcpy (saved->saved_input, saved_input, saved_input_len);
saved->saved_input_len = saved_input_len;
}
#if defined TC_ARM && defined OBJ_ELF
saved->symver_state = symver_state;
#endif
+ saved->last_char = last_char;
/* do_scrub_begin() is not useful, just wastes time. */
void
app_pop (char *arg)
{
- register struct app_save *saved = (struct app_save *) arg;
+ struct app_save *saved = (struct app_save *) arg;
/* There is no do_scrub_end (). */
state = saved->state;
#if defined TC_ARM && defined OBJ_ELF
symver_state = saved->symver_state;
#endif
+ last_char = saved->last_char;
free (arg);
}
char *from;
char *fromend;
size_t fromlen;
- register int ch, ch2 = 0;
+ int ch, ch2 = 0;
/* Character that started the string we're working on. */
static char quotechar;
state = old_state;
PUT (ch);
}
-#ifndef NO_STRING_ESCAPES
- else if (ch == '\\')
+ else if (TC_STRING_ESCAPES && ch == '\\')
{
state = 6;
PUT (ch);
}
-#endif
else if (scrub_m68k_mri && ch == '\n')
{
/* Just quietly terminate the string. This permits lines like
state = 9;
break;
}
+ /* Fall through. */
case 17:
/* We have seen "af" at the start of a symbol,
a ' here is a part of that symbol. */
PUT (ch);
break;
-#ifndef IEEE_STYLE
case LEX_IS_ONECHAR_QUOTE:
#ifdef H_TICK_HEX
if (state == 9 && enable_h_tick_hex)
out_string = out_buf;
PUT (*out_string++);
break;
-#endif
case LEX_IS_COLON:
#ifdef KEEP_WHITE_AROUND_COLON
state = -2;
break;
}
- else
+ else if (ch2 != EOF)
{
UNGET (ch2);
}
goto de_fault;
#endif
-#ifdef TC_ARM
- /* For the ARM, care is needed not to damage occurrences of \@
- by stripping the @ onwards. Yuck. */
- if (to > tostart && *(to - 1) == '\\')
- /* Do not treat the @ as a start-of-comment. */
+ /* Care is needed not to damage occurrences of \<comment-char>
+ by stripping the <comment-char> onwards. Yuck. */
+ if ((to > tostart ? to[-1] : last_char) == '\\')
+ /* Do not treat the <comment-char> as a start-of-comment. */
goto de_fault;
-#endif
#ifdef WARN_COMMENTS
if (!found_comment)
- as_where (&found_comment_file, &found_comment);
+ found_comment_file = as_where (&found_comment);
#endif
do
{
else
UNGET (quot);
}
- /* FALL THROUGH */
#endif
+ /* Fall through. */
case LEX_IS_SYMBOL_COMPONENT:
if (state == 10)
fromeof:
/* We have reached the end of the input. */
+ if (to > tostart)
+ last_char = to[-1];
return to - tostart;
tofull:
else
saved_input = NULL;
+ if (to > tostart)
+ last_char = to[-1];
return to - tostart;
}