From bff1e8d53dcc9b68240a70b005cc561b3a35fbaf Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Sat, 5 Nov 2011 23:24:30 +0000 Subject: Enhance the GCC version parsing and comparison logic to handle some more edge cases and have better behavior. Specifically, we should actually prefer the general '4.6' version string over the '4.6.1' string, as '4.6.2' should be able to replace it without breaking rpaths or any other place that these paths have been embedded. Debian-based distributions are already using a path structure with symlinks to achieve in-place upgrades for patch versions. Now our parsing reflects this and we select the shorter paths instead of the longer paths. A separate issue was that we would not parse a leading patch version number even in the presence of a suffix. The above change makes this more problematic as it would cause a suffix being added to make us treat the entire thing as patch-version-agnostic, which it isn't. This changes the logic to distinguish between '4.4.x' and 4.4.1-x', and retain that the latter has *some* patch number information. Currently, we always bias toward the shorter and more canonical version strings. If it becomes important we can add more Debian like rules to produce sequences such as '4.4.1b' > '4.4.1' > '4.4.1-rc3' > '4.4.1-rc2' > '4.4.1-pre5', but I'm very doubtful this will ever matter or be desirable. I've made the tests for this logic a bit more interesting, and added some specific tests for logic that is now different. llvm-svn: 143841 --- .../gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.6.99/crtbegin.o | 0 .../gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.6.x/crtbegin.o | 0 .../gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.7.0/crtbegin.o | 0 .../gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.7.1/crtbegin.o | 0 4 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 clang/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.6.99/crtbegin.o create mode 100644 clang/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.6.x/crtbegin.o create mode 100644 clang/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.7.0/crtbegin.o create mode 100644 clang/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.7.1/crtbegin.o (limited to 'clang/test/Driver/Inputs/gcc_version_parsing2/lib/gcc') diff --git a/clang/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.6.99/crtbegin.o b/clang/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.6.99/crtbegin.o new file mode 100644 index 00000000000..e69de29bb2d diff --git a/clang/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.6.x/crtbegin.o b/clang/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.6.x/crtbegin.o new file mode 100644 index 00000000000..e69de29bb2d diff --git a/clang/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.7.0/crtbegin.o b/clang/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.7.0/crtbegin.o new file mode 100644 index 00000000000..e69de29bb2d diff --git a/clang/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.7.1/crtbegin.o b/clang/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.7.1/crtbegin.o new file mode 100644 index 00000000000..e69de29bb2d -- cgit v1.2.3