This is an archive of the discontinued LLVM Phabricator instance.

[Driver] Disable OpenSUSE rules for OpenSUSE/SLES 10 and older
ClosedPublic

Authored by mgorny on Sep 27 2016, 12:36 AM.

Details

Summary

Disable the OpenSUSE rules for OpenSUSE versions older than 11 as they
are incompatible with the old binutils on that distribution.

Differential Revision: https://reviews.llvm.org/D24954

Diff Detail

Repository
rL LLVM

Event Timeline

mgorny updated this revision to Diff 72607.Sep 27 2016, 12:36 AM
mgorny retitled this revision from to [ToolChains] Do not assume OpenSUSE for other SUSE variants.
mgorny updated this object.
mgorny added reviewers: rafael, theraven, ismail.
mgorny added a subscriber: cfe-commits.
ismail edited edge metadata.Sep 27 2016, 12:39 AM

This will break SLES11 and later so it's not OK. Also note that SLES10 is not supported anymore.

mgorny updated this revision to Diff 72609.Sep 27 2016, 2:27 AM
mgorny retitled this revision from [ToolChains] Do not assume OpenSUSE for other SUSE variants to [ToolChains] Disable OpenSUSE rules for SLES10.
mgorny updated this object.
mgorny edited edge metadata.

Does this one look better for you? Yes, I know it's unsupported, that's why I don't really want to put any more effort on it than it is absolutely necessary to make clang work somehow.

theraven resigned from this revision.Sep 27 2016, 2:38 AM
theraven removed a reviewer: theraven.
ismail added a comment.Oct 5 2016, 2:57 AM

That looks good to me but I am not a reviewer. Someone else must approve.

bruno added a subscriber: bruno.
bruno added inline comments.
lib/Driver/ToolChains.cpp
3915 ↗(On Diff #72609)

You should keep using the VFS to obtain the file. You probably also want to add a comment here to describe what you mentioned in the patch Summary.

mgorny added inline comments.Oct 10 2016, 2:20 PM
lib/Driver/ToolChains.cpp
3915 ↗(On Diff #72609)

Hmm, this method is consistent with all the other distributions in the method. It seems that getVFS() is only used for exists() checks there. Are you sure I should change this, without touching the other reads first?

bruno added inline comments.Oct 10 2016, 2:36 PM
lib/Driver/ToolChains.cpp
3915 ↗(On Diff #72609)

Right, there seems to be some inconsistent usage here. Ideally we should go through the VFS, but given the precedence it's understandable if you don't make it in this patch.

AFAIU, this drops support for SLES10 and I guess that this would also be true for SLES9? It seems that the checking could be improved a bit by checking the digits (as in the distros above)? Also add a comment explaining why.

mgorny planned changes to this revision.Oct 17 2016, 11:43 AM

I'm going to delay this one a bit. I've already fixed all other distro checks to use VFS. Now I'd like to update them to use proper numeric parsing.

mgorny updated this revision to Diff 75357.Oct 20 2016, 2:48 PM
mgorny retitled this revision from [ToolChains] Disable OpenSUSE rules for SLES10 to [Driver] Disable OpenSUSE rules for OpenSUSE/SLES 10 and older.
mgorny updated this object.
mgorny marked 3 inline comments as done.Oct 20 2016, 2:54 PM

I think I've addressed all your concerns now.

bruno added inline comments.Oct 24 2016, 10:53 AM
lib/Driver/ToolChains.cpp
3937 ↗(On Diff #75357)

This file usually has 5-6 lines, can you use 8 instead?

3940 ↗(On Diff #75357)

You probably want to explicitly skip the lines you're not interested to make it a bit more clear. AFAIU, the VERSION is usually on the second line. How about:

if (Line.first.trim() != "VERSION")
  continue;
<... then split and parse the value>
mgorny updated this revision to Diff 75615.Oct 24 2016, 11:15 AM
mgorny marked 2 inline comments as done.

Refactored the code as requested. Also I've noticed that if VERSION had invalid value, the code continued reading the file — now it immediately returns UnknownDistro in that case.

bruno added inline comments.Oct 24 2016, 11:32 AM
lib/Driver/ToolChains.cpp
3942 ↗(On Diff #75615)

You can check Line.trim() != VERSION before the split as to do not try to split unnecessary lines.

mgorny added inline comments.Oct 24 2016, 2:26 PM
lib/Driver/ToolChains.cpp
3942 ↗(On Diff #75615)

You mean line.trim().startswith(), correct?

bruno added inline comments.Oct 24 2016, 2:31 PM
lib/Driver/ToolChains.cpp
3942 ↗(On Diff #75615)

Yep, you got the idea :-)

mgorny updated this revision to Diff 75704.Oct 25 2016, 7:54 AM

Updated to perform .startswith() check before splitting.

mgorny marked 3 inline comments as done.Oct 25 2016, 7:55 AM
bruno accepted this revision.Oct 25 2016, 8:22 AM
bruno edited edge metadata.

LGTM!

This revision is now accepted and ready to land.Oct 25 2016, 8:22 AM
This revision was automatically updated to reflect the committed changes.