diff mbox series

[1/6] btrfs-progs: remove unused header for tune/main.c

Message ID a7224b1e785d51d74c6bd369ee0c0f586cbdf616.1711412540.git.wqu@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: zoned devices support for bgt feature | expand

Commit Message

Qu Wenruo March 26, 2024, 12:22 a.m. UTC
My clangd LSP server reports warning that "common/parse-utils.h" is not
utilized at all.

Just remove it.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 tune/main.c | 1 -
 1 file changed, 1 deletion(-)

Comments

David Sterba April 2, 2024, 6:42 p.m. UTC | #1
On Tue, Mar 26, 2024 at 10:52:41AM +1030, Qu Wenruo wrote:
> My clangd LSP server reports warning that "common/parse-utils.h" is not
> utilized at all.

Please be careful about removing headers, the LSP depends on the
build flags and reports symbols or headers only for the last configured
state.

In this case removing parse-utils.h causes compilation error in
experimental mode because of

287 #if EXPERIMENTAL
288                 case GETOPT_VAL_CSUM:
289                         btrfs_warn_experimental(
290                                 "Switching checksums is experimental, do not use for valuable data!");
291                         ctree_flags |= OPEN_CTREE_SKIP_CSUM_CHECK;
292                         csum_type = parse_csum_type(optarg);
                                        ^^^^^^^^^^^^^^^^^^^^^^^

293                         btrfstune_cmd_groups[CSUM_CHANGE] = true;
294                         break;
295 #endif

Some build checks or targets could be missing so we'd lack coverage and
early warnings during development, this needs to be fixed.

Builds that change LSP state (and combinations):

- make box
- make static box.static
- various D= values and modes
- configure --experimental
- possibly different includes for glibc and musl defining a symbol
  indirectly
Qu Wenruo April 2, 2024, 9:30 p.m. UTC | #2
在 2024/4/3 05:12, David Sterba 写道:
> On Tue, Mar 26, 2024 at 10:52:41AM +1030, Qu Wenruo wrote:
>> My clangd LSP server reports warning that "common/parse-utils.h" is not
>> utilized at all.
>
> Please be careful about removing headers, the LSP depends on the
> build flags and reports symbols or headers only for the last configured
> state.
>
> In this case removing parse-utils.h causes compilation error in
> experimental mode because of
>
> 287 #if EXPERIMENTAL
> 288                 case GETOPT_VAL_CSUM:
> 289                         btrfs_warn_experimental(
> 290                                 "Switching checksums is experimental, do not use for valuable data!");
> 291                         ctree_flags |= OPEN_CTREE_SKIP_CSUM_CHECK;
> 292                         csum_type = parse_csum_type(optarg);
>                                          ^^^^^^^^^^^^^^^^^^^^^^^
>
> 293                         btrfstune_cmd_groups[CSUM_CHANGE] = true;
> 294                         break;
> 295 #endif
>
> Some build checks or targets could be missing so we'd lack coverage and
> early warnings during development, this needs to be fixed.

Indeed.

Although I don't think early checks in headers would be a problem.

If a header never got included, then the header itself is not really
needed, meanwhile the checks in headers only need to be run once, thus
it's not a big deal when the early checks got executed.

>
> Builds that change LSP state (and combinations):
>
> - make box
> - make static box.static
> - various D= values and modes
> - configure --experimental
> - possibly different includes for glibc and musl defining a symbol
>    indirectly

I'll do more checks not only with the different configs, but also more
manual inspection into the dropped headers.

Thanks,
Qu
diff mbox series

Patch

diff --git a/tune/main.c b/tune/main.c
index 0fbf37dd4800..aa9f39d987ec 100644
--- a/tune/main.c
+++ b/tune/main.c
@@ -33,7 +33,6 @@ 
 #include "common/open-utils.h"
 #include "common/device-scan.h"
 #include "common/messages.h"
-#include "common/parse-utils.h"
 #include "common/string-utils.h"
 #include "common/help.h"
 #include "common/box.h"