[Mesa-dev] [PATCH] scons: do not include headers when parsing the sources lists
Jose Fonseca
jfonseca at vmware.com
Wed Aug 13 07:28:17 PDT 2014
On 13/08/14 15:16, Emil Velikov wrote:
> On 13/08/14 14:08, Jose Fonseca wrote:
>> On 13/08/14 13:38, Emil Velikov wrote:
>>> Modify oour custom function/method SourceListParser to avoid including
>>> headers to the sources list. The SCons documentation is not explicit on
>>> the topic yet building mesa with SCons and MSVC is known to have
>>> problems when headers are listed. So be safe just drop them for now.
>>>
>>> Bugzilla:
>>> https://urldefense.proofpoint.com/v1/url?u=https://bugs.freedesktop.org/show_bug.cgi?id%3D82534&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=NMr9uy2iTjWVixC0wOcYCWEIYhfo80qKwRgdodpoDzA%3D%0A&m=bSAxUvr%2BkZFQrdOVPzHXFpuKRlYsjbOdppwDtQwMYV4%3D%0A&s=eafc5db76341cca1e444f46c18e5d3a29e51cac22ff52f018621406a72291954
>>>
>>> Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
>>> ---
>>> scons/source_list.py | 9 ++++++++-
>>> 1 file changed, 8 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/scons/source_list.py b/scons/source_list.py
>>> index e16d1f9..5a1bd96 100644
>>> --- a/scons/source_list.py
>>> +++ b/scons/source_list.py
>>> @@ -85,6 +85,9 @@ class SourceListParser(object):
>>> """Parse a source list line."""
>>> # more lines to come
>>> if line and line[-1] == '\\':
>>> + # do not include any headers
>>> + if line[:-1].rstrip().endswith('.h'):
>>> + return 0;
>>> # spaces around "\\\n" are replaced by a single space
>>> if self.line_cont:
>>> self.line_cont += line[:-1].strip() + ' '
>>> @@ -94,7 +97,11 @@ class SourceListParser(object):
>>>
>>> # combine with previous lines
>>> if self.line_cont:
>>> - line = self.line_cont + line.lstrip()
>>> + # do not include any headers
>>> + if line and line.rstrip().endswith('.h'):
>>> + line = self.line_cont
>>> + else:
>>> + line = self.line_cont + line.lstrip()
>>> self.line_cont = ''
>>>
>>> if line:
>>>
>>
>> I think that scons/custom.py is a better place for this manipulation. There
>> are a bunch of similarly natured maniuplations there already:
>>
> AFAICT this one might have a slightly greater overhead as we're adding the
> headers to the sym_table first and then dropping the headers as we iterate
> (construct the proper sources list).
>
> Either one is fine with me, as long as it makes SCons+MSVC happy :)
IMO, the runtime overhead should be negligible, whereas the simplified
maintenance is not. But I don't feel strongly neither: as you said
making SCons+MSVC is the most important. So feel free to do it either way.
Jose
More information about the mesa-dev
mailing list