Skip to content

Commit

Permalink
libdrgn: fix include-what-you-use warnings
Browse files Browse the repository at this point in the history
There are a few remaining issues due to
include-what-you-use/include-what-you-use#1569 and
include-what-you-use/include-what-you-use#970, but it's mostly clean
again.

Signed-off-by: Omar Sandoval <[email protected]>
  • Loading branch information
osandov committed Sep 9, 2024
1 parent d0ce699 commit f0df6ad
Show file tree
Hide file tree
Showing 22 changed files with 18 additions and 15 deletions.
1 change: 1 addition & 0 deletions libdrgn/arch_ppc64.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <byteswap.h>
#include <elf.h>
#include <endian.h>
#include <stdlib.h>
#include <string.h>

#include "cleanup.h"
Expand Down
1 change: 1 addition & 0 deletions libdrgn/debug_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#ifndef DRGN_DEBUG_INFO_H
#define DRGN_DEBUG_INFO_H

#include <elfutils/libdw.h>
#include <elfutils/libdwfl.h>
#include <elfutils/version.h>
#include <libelf.h>
Expand Down
2 changes: 2 additions & 0 deletions libdrgn/elf_file.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// Copyright (c) Meta Platforms, Inc. and affiliates.
// SPDX-License-Identifier: LGPL-2.1-or-later

#include <byteswap.h>
#include <elf.h>
#include <gelf.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

Expand Down
2 changes: 2 additions & 0 deletions libdrgn/elf_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@
#ifndef DRGN_ELF_FILE_H
#define DRGN_ELF_FILE_H

#include <elf.h>
#include <elfutils/libdw.h>
#include <libelf.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>

#include "binary_buffer.h"
#include "elf_sections.h" // IWYU pragma: export
Expand Down
1 change: 0 additions & 1 deletion libdrgn/handler.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) Meta Platforms, Inc. and affiliates.
// SPDX-License-Identifier: LGPL-2.1-or-later

#include <stdlib.h>
#include <string.h>

#include "cleanup.h"
Expand Down
3 changes: 2 additions & 1 deletion libdrgn/handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
#ifndef DRGN_HANDLER_H
#define DRGN_HANDLER_H

#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>

// This should be embedded as the first member in a structure containing the
// handler implementation.
Expand Down
1 change: 1 addition & 0 deletions libdrgn/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#ifndef DRGN_IO_H
#define DRGN_IO_H

#include <stddef.h>
#include <sys/types.h>

/**
Expand Down
1 change: 0 additions & 1 deletion libdrgn/linux_kernel.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) Meta Platforms, Inc. and affiliates.
// SPDX-License-Identifier: LGPL-2.1-or-later

#include <byteswap.h>
#include <dirent.h>
#include <elf.h>
#include <elfutils/libdwelf.h>
Expand Down
1 change: 0 additions & 1 deletion libdrgn/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include <stdarg.h>
#include <stdio.h>
#include <unistd.h>

#include "log.h"
#include "program.h"
Expand Down
1 change: 1 addition & 0 deletions libdrgn/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <string.h>

#include "drgn.h"
#include "handler.h"
#include "type.h"

/**
Expand Down
1 change: 0 additions & 1 deletion libdrgn/openmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>

#include "cleanup.h"
#include "hash_table.h"
Expand Down
1 change: 1 addition & 0 deletions libdrgn/orc_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: LGPL-2.1-or-later

#include <byteswap.h>
#include <elf.h>
#include <gelf.h>
#include <limits.h>
#include <stdlib.h>
Expand Down
1 change: 0 additions & 1 deletion libdrgn/orc_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#define DRGN_ORC_INFO_H

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>

#include "cfi.h"
Expand Down
2 changes: 2 additions & 0 deletions libdrgn/program.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <dirent.h>
#include <elf.h>
#include <elfutils/libdw.h>
#include <elfutils/libdwfl.h>
#include <errno.h>
#include <fcntl.h>
#include <gelf.h>
Expand All @@ -28,6 +29,7 @@
#include "linux_kernel.h"
#include "memory_reader.h"
#include "minmax.h"
#include "object.h"
#include "program.h"
#include "symbol.h"
#include "util.h"
Expand Down
3 changes: 0 additions & 3 deletions libdrgn/program.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#ifndef DRGN_PROGRAM_H
#define DRGN_PROGRAM_H

#include <elfutils/libdwfl.h>
#include <libelf.h>
#include <sys/types.h>
#ifdef WITH_LIBKDUMPFILE
Expand All @@ -27,11 +26,9 @@
#include "memory_reader.h"
#include "platform.h"
#include "pp.h"
#include "symbol.h"
#include "type.h"
#include "vector.h"

struct drgn_type_finder;
struct drgn_object_finder;
struct drgn_symbol_finder;

Expand Down
1 change: 0 additions & 1 deletion libdrgn/python/drgnpy.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include "../drgn.h"
// IWYU pragma: end_exports

#include "../hash_table.h"
#include "../hash_table.h"
#include "../pp.h"
#include "../program.h"
Expand Down
1 change: 0 additions & 1 deletion libdrgn/python/object.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include <math.h>

#include "drgnpy.h"
#include "../cleanup.h"
#include "../error.h"
#include "../object.h"
#include "../serialize.h"
Expand Down
3 changes: 2 additions & 1 deletion libdrgn/python/program.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
#include "../bitops.h"
#include "../error.h"
#include "../hash_table.h"
#include "../linux_kernel.h"
#include "../log.h"
#include "../program.h"
#include "../string_builder.h"
#include "../symbol.h"
#include "../util.h"
#include "../vector.h"
#include "../linux_kernel.h"

DEFINE_HASH_SET_FUNCTIONS(pyobjectp_set, ptr_key_hash_pair, scalar_key_eq);

Expand Down
1 change: 0 additions & 1 deletion libdrgn/python/symbol.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include <inttypes.h>

#include "drgnpy.h"
#include "../symbol.h"

PyObject *Symbol_wrap(struct drgn_symbol *sym, PyObject *name_obj)
{
Expand Down
1 change: 1 addition & 0 deletions libdrgn/python/type_kind_set.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "drgnpy.h"
#include "../bitops.h"
#include "../util.h"

static PyObject *collections_abc_Set;

Expand Down
3 changes: 1 addition & 2 deletions libdrgn/stack_trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
// SPDX-License-Identifier: LGPL-2.1-or-later

#include <assert.h>
#include <elf.h>
#include <elfutils/libdw.h>
#include <elfutils/libdwfl.h>
#include <inttypes.h>
#include <stdlib.h>
#include <string.h>

#include "cfi.h"
#include "cleanup.h"
#include "debug_info.h"
#include "drgn.h"
#include "dwarf_constants.h"
Expand Down
1 change: 1 addition & 0 deletions libdrgn/string_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>

/**
Expand Down

0 comments on commit f0df6ad

Please sign in to comment.