* breakpoint.c (break_command_really): New parameter
[deliverable/binutils-gdb.git] / gas / app.c
index e6b39d612132a0fa93540a1e6fdc266d7076fb3a..d8d0cc552d32beb2de8cc882fc517db740fa8041 100644 (file)
--- a/gas/app.c
+++ b/gas/app.c
@@ -7,13 +7,13 @@
 
    GAS is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
+   the Free Software Foundation; either version 3, or (at your option)
    any later version.
 
-   GAS is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
+   GAS is distributed in the hope that it will be useful, but WITHOUT
+   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+   License for more details.
 
    You should have received a copy of the GNU General Public License
    along with GAS; see the file COPYING.  If not, write to the Free
@@ -355,7 +355,7 @@ do_scrub_chars (int (*get) (char *, int), char *tostart, int tolen)
          5: parsing a string, then go to old-state
          6: putting out \ escape in a "d string.
          7: no longer used
-         8: After putting out a .appfile string, flush until newline.
+         8: no longer used
          9: After seeing symbol char in state 3 (keep 1white after symchar)
         10: After seeing whitespace in state 9 (keep white before symchar)
         11: After seeing a symbol character in state 0 (eg a label definition)
@@ -510,11 +510,10 @@ do_scrub_chars (int (*get) (char *, int), char *tostart, int tolen)
                ch = GET ();
              if (ch == '"')
                {
-                 PUT (' ');
-                 PUT (ch);
                  quotechar = ch;
                  state = 5;
-                 old_state = 8;
+                 old_state = 3;
+                 PUT (ch);
                }
              else
                {
@@ -551,14 +550,22 @@ do_scrub_chars (int (*get) (char *, int), char *tostart, int tolen)
                memcpy (to, from, len);
                to += len;
                from += len;
+               if (to >= toend)
+                 goto tofull;
              }
          }
 
          ch = GET ();
          if (ch == EOF)
            {
+             /* This buffer is here specifically so
+                that the UNGET below will work.  */
+             static char one_char_buf[1];
+
              as_warn (_("end of file in string; '%c' inserted"), quotechar);
              state = old_state;
+             from = fromend = one_char_buf + 1;
+             fromlen = 1;
              UNGET ('\n');
              PUT (quotechar);
            }
@@ -635,16 +642,6 @@ do_scrub_chars (int (*get) (char *, int), char *tostart, int tolen)
          PUT (ch);
          continue;
 
-       case 8:
-         do
-           if ((ch = GET ()) == EOF)
-             goto fromeof;
-           else
-             PUT (ch);
-         while (ch != '\n');
-         state = 0;
-         continue;
-
 #ifdef DOUBLEBAR_PARALLEL
        case 13:
          ch = GET ();
@@ -1230,6 +1227,15 @@ do_scrub_chars (int (*get) (char *, int), char *tostart, int tolen)
          if ((symver_state != NULL) && (*symver_state == 0))
            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.  */
+           goto de_fault;
+#endif
+
 #ifdef WARN_COMMENTS
          if (!found_comment)
            as_where (&found_comment_file, &found_comment);
@@ -1362,7 +1368,15 @@ do_scrub_chars (int (*get) (char *, int), char *tostart, int tolen)
                     the space.  We don't have enough information to
                     make the right choice, so here we are making the
                     choice which is more likely to be correct.  */
-                 PUT (' ');
+                 if (to + 1 >= toend)
+                   {
+                     /* If we're near the end of the buffer, save the
+                        character for the next time round.  Otherwise
+                        we'll lose our state.  */
+                     UNGET (ch);
+                     goto tofull;
+                   }
+                 *to++ = ' ';
                }
 
              state = 3;
This page took 0.027379 seconds and 4 git commands to generate.