]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
GAS: Change S parameter of find_no_app to CHAR* in order to avoid problems with STRST...
authorNick Clifton <nickc@redhat.com>
Mon, 8 Dec 2025 09:11:23 +0000 (09:11 +0000)
committerNick Clifton <nickc@redhat.com>
Mon, 8 Dec 2025 09:11:23 +0000 (09:11 +0000)
PR 33696

gas/read.c

index 4ba71f99250cb79feaebd78b538eea4cd69d5891..23fa4c67534e61debfde025ff3373b061f5295e0 100644 (file)
@@ -858,16 +858,24 @@ do_align (unsigned int n, char *fill, unsigned int len, unsigned int max)
 }
 
 /* Find first <eol><next_char>NO_APP<eol>, if any, in the supplied buffer.
-   Return NULL if there's none, or else the position of <next_char>.  */
+   Return NULL if there's none, or else the position of <next_char>.
+   
+   Note: the S parameter to this function is typed as CHAR* rather than
+   CONST CHAR* because if it is const then the strstr() function will return
+   a const pointer, which in turn means that the END local would need to be
+   const, which would mean that the function itself would have to return a
+   const pointer, which means that input_line_pointer would have to become
+   const, which would break lots of things.  (See PR 33696).  */
+
 static char *
-find_no_app (const char *s, char next_char)
+find_no_app (char *s, char next_char)
 {
   const char *start = s;
   const char srch[] = { next_char, 'N', 'O', '_', 'A', 'P', 'P', '\0' };
 
   for (;;)
     {
-      char *ends = strstr (s, srch);
+      char * ends = strstr (s, srch);
 
       if (ends == NULL)
        break;