From: Nick Clifton Date: Mon, 8 Dec 2025 09:11:23 +0000 (+0000) Subject: GAS: Change S parameter of find_no_app to CHAR* in order to avoid problems with STRST... X-Git-Tag: binutils-2_46~697 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8e992ccb1e4e351f52516af713cff1a3191df640;p=thirdparty%2Fbinutils-gdb.git GAS: Change S parameter of find_no_app to CHAR* in order to avoid problems with STRSTR returning a CONST CHAR* PR 33696 --- diff --git a/gas/read.c b/gas/read.c index 4ba71f99250..23fa4c67534 100644 --- a/gas/read.c +++ b/gas/read.c @@ -858,16 +858,24 @@ do_align (unsigned int n, char *fill, unsigned int len, unsigned int max) } /* Find first NO_APP, if any, in the supplied buffer. - Return NULL if there's none, or else the position of . */ + Return NULL if there's none, or else the position of . + + 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;