]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libcpp/directives.c
preprocessor: Handle digit separators in #line [PR82359]
[thirdparty/gcc.git] / libcpp / directives.c
index f4aa17d11569916eac4cf47808a2efa7746fb148..795f93e664bc18b1ab6e311bb3f4aa72e68e8e9e 100644 (file)
@@ -922,12 +922,19 @@ strtolinenum (const uchar *str, size_t len, linenum_type *nump, bool *wrapped)
   linenum_type reg = 0;
 
   uchar c;
+  bool seen_digit_sep = false;
   *wrapped = false;
   while (len--)
     {
       c = *str++;
+      if (!seen_digit_sep && c == '\'' && len)
+       {
+         seen_digit_sep = true;
+         continue;
+       }
       if (!ISDIGIT (c))
        return true;
+      seen_digit_sep = false;
       if (reg > ((linenum_type) -1) / 10)
        *wrapped = true;
       reg *= 10;