tools: add include guard check script
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 14 May 2024 18:08:23 +0000 (14:08 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Fri, 24 May 2024 15:53:58 +0000 (11:53 -0400)
commit270aa17afe7d73a4ea41871bdfc2c3dfe76ec21c
tree66569ec184bfc2f99944ff99c038927dfa48168d
parent0e0c04cfcabe06eae81503b52e9c85162d266a57
tools: add include guard check script

Add `tools/check-include-guard.py`, whose task is to verify that the
include guards in a given file is formatted as we want.  Example:

    $ ./tools/check-include-guard.py ./src/plugins/ctf/fs-sink/fs-sink-trace.hpp
    In `#ifndef BABELTRACE_PLUGIN_CTF_FS_SINK_FS_SINK_TRACE_H` include guard line: expecting `#ifndef BABELTRACE_PLUGINS_CTF_FS_SINK_FS_SINK_TRACE_HPP`

`tools/check-include-guard.py` supports the `--fix` option, which makes
it try to fix the include guards in-place (mostly useful for that
initial pass where we have a lot of stuff to fix).

Add `tools/check-include-guards.sh`, whose task is to find all the
files we want to check include guards for, and call
`tools/check-include-guard.py` on them.

Limitations:

 - Only tested on GNU/Linux

Change-Id: I7a376fdcf50f92bda20ab50e529d73bcd2faeb03
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12632
tools/check-include-guard.py [new file with mode: 0755]
tools/check-include-guards.sh [new file with mode: 0755]
This page took 0.028378 seconds and 4 git commands to generate.