fab.steps.c_pragma_injector module#

Add custom pragmas to C code which identify user and system include regions.

fab.steps.c_pragma_injector.c_pragma_injector(config, source=None, output_name=None)#

A build step to inject custom pragmas to mark blocks of user and system include statements.

By default, reads .c files from the INITIAL_SOURCE artefact and creates the pragmad_c artefact.

This step does not write to the build output folder, it creates the pragmad c in the same folder as the c file. This is because a subsequent preprocessing step needs to look in the source folder for header files, including in paths relative to the c file.

Parameters:
  • config – The fab.build_config.BuildConfig object where we can read settings such as the project workspace folder or the multiprocessing flag.

  • source (Optional[ArtefactsGetter]) – An ArtefactsGetter which give us our c files to process. (default: None)

  • output_name – The name of the artefact collection to create in the artefact store, with a sensible default (default: None)

fab.steps.c_pragma_injector.inject_pragmas(fpath)#

Reads a C source file but when encountering an #include preprocessor directive injects a special Fab-specific #pragma which can be picked up later by the Analyser after the preprocessing

Return type:

Generator