Dmitry V. Levin
a8fce09e34
We used to declare and define all printers marked with MPERS_PRINTER_DECL, including ifdef'ed ones. That approach left us no way to conditionally compile mpersified printers, which was not a problem until btrfs ioctls appeared on the horizon. With this change, those mpersified printers that are not going to be compiled are also won't be declared and won't be added to struct_printers. This is implemented by filtering all source files containing MPERS_PRINTER_DECL markers through CPP. As a nice side effect, this also lifts an ugly requirement of writing all MPERS_PRINTER_DECL declarations in a single line. * README-mpers: Update description of MPERS_PRINTER_DECL syntax. * defs.h [IN_MPERS_BOOTSTRAP] (MPERS_PRINTER_DECL): Turn into a recursive variadic macro. [!IN_MPERS_BOOTSTRAP] (MPERS_PRINTER_DECL): Turn into a variadic macro. All callers changed. * Makefile.am (mpers_preproc_files, mpers_printer_decl_pattern): New variables. (CLEANFILES): Add $(mpers_preproc_files). (%.c.mpers.i): New rule. (printers.h, %_printer_decls.h, %_printer_defs.h): Use mpers_preproc_files instead of srcdir_mpers_source_files, use mpers_printer_decl_pattern. * .gitignore: Add /*.mpers.i.
15 lines
650 B
Plaintext
15 lines
650 B
Plaintext
To use mpers functionality, one should:
|
|
* typedef all of the target types which are compound and not typedefed
|
|
already;
|
|
* for each target type, include DEF_MPERS_TYPE(target_type_t), these can
|
|
be included conditionally;
|
|
* include MPERS_DEFS once;
|
|
* before inclusion of MPERS_DEFS include all important headers
|
|
(containing definitions of these types or other behaviour-affecting
|
|
defines);
|
|
* printers should be defined
|
|
as MPERS_PRINTER_DECL(return_type, function_name, args),
|
|
inside files that include MPERS_DEFS these printers should be called
|
|
as MPERS_FUNC_NAME(function_name)(args), in other files
|
|
they should be called just as function_name(args).
|