Skip to content

Commit

Permalink
printf() WARN fix for %argnum$ > 9
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubmisek committed Aug 16, 2024
1 parent 4980fd9 commit fec3124
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ internal partial class DiagnosticWalker<T>
/// Matches <c>printf()</c> format specifier.
/// </summary>
static readonly Lazy<Regex> s_printfSpecsRegex = new Lazy<Regex>(
() => new Regex(@"%(?:(\d)+\$)?[+-]?(?:[ 0]|'.{1})?-?\d*(?:\.\d+)?[bcdeEufFgGosxX]", RegexOptions.Compiled | RegexOptions.CultureInvariant)
() => new Regex(@"%(?:(\d+)\$)?[+-]?(?:[ 0]|'.{1})?-?\d*(?:\.\d+)?[bcdeEufFgGosxX]", RegexOptions.Compiled | RegexOptions.CultureInvariant)
);

void printfCheck(string name, ImmutableArray<BoundArgument> arguments)
Expand All @@ -44,7 +44,7 @@ void printfCheck(string name, ImmutableArray<BoundArgument> arguments)
else
{
// %2$d
int numSpec = int.Parse(numSpecStr);
int numSpec = int.Parse(numSpecStr); // > 0, starts from 1
numSpecMax = Math.Max(numSpec, numSpecMax);
}
}
Expand Down

0 comments on commit fec3124

Please sign in to comment.