The config-*triple* file handling isn't tolerant of leading/trailing whitespace, making it not terribly obvious when a single extraneous tab/space/etc will cause the override to be ignored. This patch simply trims the lines to ensure that it is tolerant of whitespace.
Details
Diff Detail
Event Timeline
lib/Driver/ToolChains/Gnu.cpp | ||
---|---|---|
2176 | Can we just do Line = Line.trim() so we won't have an extra StringRef and no one can misuse the untrimmed on in the future. |
Is there any specific reason you need this? Since the file is autogenerated, I don't think it matters very much to allow extra whiespace. But then, I do not think it hurts, so feel free to do it. The code LGTM; note that I haven't tested it, however.
In my case, a misbehaving copy of SVN caused the test for this to have a '\r\n' line ending on Windows. I fixed my SVN, but also realized that tolerance for whitespace might be valuable, particularly since a human might decide to change this without the gcc-config tool and neglect a trailing space. It scared me that this was a condition where it would APPEAR to work well (ie, configure it to the 'latest', but not realize it is being ignored), then be surprised later.
Well, I've just checked gcc-config sources and it seems that it sources the file through bash, and gets the resulting ${CURRENT}. While I don't think we ought to do complete bash support here, I guess allowing the same degree of whitespace bash does makes sense.
Forgot the "DifferentialRevision" in the commit message, but added it as related here.
Can we just do
Line = Line.trim()
so we won't have an extra StringRef and no one can misuse the untrimmed on in the future.