[Scons-users] SCons, forced includes and dependencies

Sazonov Boris bsazonov at gmail.com
Sat May 28 19:09:38 EDT 2016


Hi Bill,

No, it's more like this:
https://github.com/bo-on-software/rethread_testing/blob/master/test/helgrind_annotations.h

Regards,
Boris

2016-05-29 2:08 GMT+03:00 Bill Deegan <bill at baddogconsulting.com>:
> Is it basically this:
> http://repo.or.cz/valgrind.git/blob_plain/HEAD:/helgrind/helgrind.h
>
> -Bill
>
> On Sat, May 28, 2016 at 4:05 PM, Bill Deegan <bill at baddogconsulting.com>
> wrote:
>>
>> Boris,
>>
>> What's in helgrind.h ?
>>
>> -Bill
>>
>> On Sat, May 28, 2016 at 9:04 AM, Sazonov Boris <bsazonov at gmail.com> wrote:
>>>
>>> Hi.
>>> In my project I need to use '-include' gcc flag to include a special
>>> header before every source file. This file contains include and some
>>> defines to annotate g++ STL implementation, which are necessary to
>>> check multithreaded code under Helgrind.
>>>
>>> First of all, I add '-include' flag for compiler:
>>>
>>> env.Append(CPPFLAGS = ['-include', GetAbsolutePath('test/helgrind.h')])
>>>
>>> But it doesn't create dependency on this file. And I want all of my
>>> cpp files to depend on this header. To solve it, I've come up with
>>> scanner wrapper and overriding object builder in the environment:
>>>
>>> def forced_include_scanner(node, env, path, wrapped_scanner):
>>>   flags = env['CPPFLAGS']
>>>   print(wrapped_scanner(node, env, path)) # Returns an empty list
>>>   return map(lambda f: f[1], filter(lambda f: f[0] == '-include',
>>> zip(flags, flags[1:]))) + wrapped_scanner(node, env, path)
>>>
>>> obj_bld = env['BUILDERS']['Object']
>>> env['BUILDERS']['Object'] = Builder(action = obj_bld.action, suffix =
>>> obj_bld.suffix, src_suffix = obj_bld.src_suffix, source_scanner =
>>> SCons.Scanner.Base(function = forced_include_scanner, name =
>>> "ForcedIncludeScanner", argument = obj_bld.source_scanner))
>>>
>>> The problem is that wrapped_scanner(node, env, path) returns an empty
>>> list.
>>> What am I doing wrong?
>>>
>>> Thanks in advance!
>>> Regards,
>>> Boris Sazonov
>>> _______________________________________________
>>> Scons-users mailing list
>>> Scons-users at scons.org
>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
>>
>
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>


More information about the Scons-users mailing list