summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2024-04-30 14:13:22 +0200
committerDavid Lamparter <equinox@opensourcerouting.org>2024-05-02 22:26:53 +0200
commitda3677e7199e1911e55a70ab37b2a2ebac2db6a9 (patch)
treeddbb09727efc331d38fa5d93ef59ddc8636a4434 /tools
parentlib: fix `time_t` print without cast (diff)
downloadfrr-da3677e7199e1911e55a70ab37b2a2ebac2db6a9.tar.xz
frr-da3677e7199e1911e55a70ab37b2a2ebac2db6a9.zip
tools/gcc-plugins: warn for `suseconds_t` format
The plugin was already catching attempts to print `time_t` without casting it first (there is no valid printf specifier without a cast), but `__suseconds64_t` needs the same treatment. (Probably `__suseconds_t` too, if it exists, which I'm not sure it does - but that doesn't matter, the plugin ignores non-existing types.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/gcc-plugins/frr-format.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/gcc-plugins/frr-format.c b/tools/gcc-plugins/frr-format.c
index 4e2c2d3ba..963741e47 100644
--- a/tools/gcc-plugins/frr-format.c
+++ b/tools/gcc-plugins/frr-format.c
@@ -66,6 +66,8 @@ static GTY(()) tree local_pid_t_node;
static GTY(()) tree local_uid_t_node;
static GTY(()) tree local_gid_t_node;
static GTY(()) tree local_time_t_node;
+static GTY(()) tree local_suseconds_t_node;
+static GTY(()) tree local_suseconds64_t_node;
static GTY(()) tree local_socklen_t_node;
static GTY(()) tree local_in_addr_t_node;
@@ -85,6 +87,8 @@ static struct type_special {
{ &local_uid_t_node, NULL, &local_uid_t_node, },
{ &local_gid_t_node, NULL, &local_gid_t_node, },
{ &local_time_t_node, NULL, &local_time_t_node, },
+ { &local_suseconds_t_node, NULL, &local_suseconds_t_node, },
+ { &local_suseconds64_t_node, NULL, &local_suseconds64_t_node, },
{ NULL, NULL, NULL, }
};
@@ -4176,6 +4180,8 @@ handle_finish_parse (void *event_data, void *data)
setup_type ("uid_t", &local_uid_t_node);
setup_type ("gid_t", &local_gid_t_node);
setup_type ("time_t", &local_time_t_node);
+ setup_type ("__suseconds_t", &local_suseconds_t_node);
+ setup_type ("__suseconds64_t", &local_suseconds64_t_node);
setup_type ("socklen_t", &local_socklen_t_node);
setup_type ("in_addr_t", &local_in_addr_t_node);