[all-commits] [llvm/llvm-project] 05dcfa: [clang] [Gnu] Improve GCCVersion parsing to match ...

Martin Storsjö via All-commits all-commits at lists.llvm.org
Thu Oct 26 00:56:07 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 05dcfa44c0f4c68c3a7b831d6ac2dd0572741ece
      https://github.com/llvm/llvm-project/commit/05dcfa44c0f4c68c3a7b831d6ac2dd0572741ece
  Author: Martin Storsjö <martin at martin.st>
  Date:   2023-10-26 (Thu, 26 Oct 2023)

  Changed paths:
    M clang/lib/Driver/ToolChains/Gnu.cpp
    M clang/unittests/Driver/GCCVersionTest.cpp

  Log Message:
  -----------
  [clang] [Gnu] Improve GCCVersion parsing to match versions such as "10-win32" (#69079)

In earlier GCC versions, the Debian/Ubuntu provided mingw toolchains
were packaged in /usr/lib/gcc/<triple> with version strings such as
"5.3-win32", which were matched and found since
6afcd64eb65fca233a7b173f88cffb2c2c9c114c. However in recent versions,
they have stopped including the minor version number and only have
version strings such as "10-win32" and "10-posix".

Generalize the parsing code to tolerate the patch suffix to be present
on a version number with only a major number.

Refactor the string parsing code to highlight the overall structure of
the parsing. This implementation should yield the same result as before,
except for when there's only one segment and it has trailing, non-number
contents.

This allows Clang to find the GCC libraries and headers in Debian/Ubuntu
provided MinGW cross compilers.




More information about the All-commits mailing list