Make generated C code as `const` as possible
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 3 Sep 2020 15:19:36 +0000 (11:19 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 3 Sep 2020 15:23:03 +0000 (11:23 -0400)
commite18cf9d616d36a7fef0eab2da34e81bc6dd928e1
tree0059e3e26a4d65b84ab1137b68f0176ccc87aedb
parent629cfd448357724b75e8c1d67aae4bb022cabf76
Make generated C code as `const` as possible

This patch changes `gen.py` and many C-generating templates to make
barectf generate C code with as many `const` variables as possible.

The Jinja 2 `ft_c_type` filter now accepts a parameter to make the
returned C type `const`.

All the `*_params_str` filters also do; the reason is that I don't want
the public header to show those useless `const` parameters (for
variables), but I want the same parameters to be `const` in the C source
file.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
12 files changed:
barectf/gen.py
barectf/templates/c/barectf.c-macros.j2
barectf/templates/c/barectf.c.j2
barectf/templates/c/barectf.h.j2
barectf/templates/c/close-func-proto.j2
barectf/templates/c/common.j2
barectf/templates/c/ctx-init-func-proto.j2
barectf/templates/c/func-proto-params.j2
barectf/templates/c/open-func-proto.j2
barectf/templates/c/serialize-write-bit-array-statements.j2
barectf/templates/c/serialize-write-uuid-statements.j2
barectf/templates/c/trace-func-proto.j2
This page took 0.023963 seconds and 4 git commands to generate.