ctf-writer: fix -Wformat-overflow errors in resolve.c
authorSimon Marchi <simon.marchi@efficios.com>
Thu, 23 Feb 2023 19:11:38 +0000 (14:11 -0500)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Mon, 13 Mar 2023 15:26:10 +0000 (11:26 -0400)
commita79c4ac935ed9fe764f89dcb81135b7d78d806e4
treeb24f266a0ea2cbb66337c215e7d7bc07c17ee8ba
parenta762c3ee11719bb9ccbdbdc6ad5c9b17311f3c37
ctf-writer: fix -Wformat-overflow errors in resolve.c

Fix these, seen when building with -O2 with gcc 12.2.1:

      CC       resolve.lo
    In file included from logging.h:11,
                     from resolve.c:11:
    In function 'pathstr_to_field_path',
        inlined from 'resolve_sequence_or_variant_type' at resolve.c:1004:22,
        inlined from 'resolve_type' at resolve.c:1105:9:
    resolve.c:667:25: error: '%s' directive argument is null [-Werror=format-overflow=]
      667 |                 BT_LOGT("Found field path: path=\"%s\", field-path=\"%s\"",
          |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../../src/logging/log.h:815:67: note: in definition of macro 'BT_LOG_WRITE'
      815 |                                                         lvl, tag, __VA_ARGS__); \
          |                                                                   ^~~~~~~~~~~
    resolve.c:667:17: note: in expansion of macro 'BT_LOGT'
      667 |                 BT_LOGT("Found field path: path=\"%s\", field-path=\"%s\"",
          |                 ^~~~~~~
    resolve.c: In function 'resolve_type':
    resolve.c:667:70: note: format string is defined here
      667 |                 BT_LOGT("Found field path: path=\"%s\", field-path=\"%s\"",
          |                                                                      ^~
    In function 'get_field_paths_lca_index',
        inlined from 'validate_target_field_path' at resolve.c:901:15,
        inlined from 'resolve_sequence_or_variant_type' at resolve.c:1026:8,
        inlined from 'resolve_type' at resolve.c:1105:9:
    resolve.c:792:25: error: '%s' directive argument is null [-Werror=format-overflow=]
      792 |                 BT_LOGT("Finding lowest common ancestor (LCA) between two field paths: "
          |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../../src/logging/log.h:815:67: note: in definition of macro 'BT_LOG_WRITE'
      815 |                                                         lvl, tag, __VA_ARGS__); \
          |                                                                   ^~~~~~~~~~~
    resolve.c:792:17: note: in expansion of macro 'BT_LOGT'
      792 |                 BT_LOGT("Finding lowest common ancestor (LCA) between two field paths: "
          |                 ^~~~~~~
    resolve.c:792:25: error: '%s' directive argument is null [-Werror=format-overflow=]
      792 |                 BT_LOGT("Finding lowest common ancestor (LCA) between two field paths: "
          |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../../src/logging/log.h:815:67: note: in definition of macro 'BT_LOG_WRITE'
      815 |                                                         lvl, tag, __VA_ARGS__); \
          |                                                                   ^~~~~~~~~~~
    resolve.c:792:17: note: in expansion of macro 'BT_LOGT'
      792 |                 BT_LOGT("Finding lowest common ancestor (LCA) between two field paths: "
          |                 ^~~~~~~

Change-Id: I91608a4e782a4059225986dd974130ccbaf54207
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
(cherry picked from commit 39630c3ba7000fc6c9337b2420bbeba2d9d7c723)
Reviewed-on: https://review.lttng.org/c/babeltrace/+/9547
Tested-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
src/ctf-writer/resolve.c
This page took 0.026732 seconds and 4 git commands to generate.