[Pdbg] [PATCH v2 3/9] main: Do not include libpdbg internal headers

Alistair Popple alistair at popple.id.au
Thu May 24 17:18:12 AEST 2018


Thanks Amitay.

On Wednesday, 23 May 2018 2:31:04 PM AEST Amitay Isaacs wrote:
> There are few execptions:
> 
> - src/thread.c, src/htm.c
>   These require bitutils.h.  The correct fix might be to include thread
>   abstraction in libpdbg.

I've cleaned this bit up today so we can get rid of it there.

> - src/main.c
>   This requires target.h.

Do you happen to know why main.c requires target.h?

- Alistair

> Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
> ---
>  src/cfam.c   | 2 --
>  src/htm.c    | 5 +++--
>  src/htm.h    | 2 --
>  src/main.c   | 2 +-
>  src/main.h   | 4 +++-
>  src/mem.c    | 4 ++--
>  src/reg.c    | 3 +--
>  src/scom.c   | 2 +-
>  src/scom.h   | 2 --
>  src/thread.c | 4 +---
>  src/thread.h | 2 --
>  11 files changed, 12 insertions(+), 20 deletions(-)
> 
> diff --git a/src/cfam.c b/src/cfam.c
> index 3ba8224..269123e 100644
> --- a/src/cfam.c
> +++ b/src/cfam.c
> @@ -19,8 +19,6 @@
>  #include <string.h>
>  #include <inttypes.h>
>  
> -#include <target.h>
> -
>  #include "main.h"
>  
>  static int getcfam(struct pdbg_target *target, uint32_t index, uint64_t *addr, uint64_t *unused)
> diff --git a/src/htm.c b/src/htm.c
> index a1a88d1..a45facf 100644
> --- a/src/htm.c
> +++ b/src/htm.c
> @@ -29,11 +29,12 @@
>  #include <stdlib.h>
>  #include <string.h>
>  #include <unistd.h>
> +#include <assert.h>
>  
>  #include <ccan/array_size/array_size.h>
>  
> -#include <target.h>
> -#include <operations.h>
> +#include <libpdbg.h>
> +#include <bitutils.h>
>  
>  #include "main.h"
>  
> diff --git a/src/htm.h b/src/htm.h
> index fef569e..f5ffa76 100644
> --- a/src/htm.h
> +++ b/src/htm.h
> @@ -16,8 +16,6 @@
>  #include <inttypes.h>
>  #include <stdio.h>
>  
> -#include <target.h>
> -
>  int run_htm_start(int optind, int argc, char *argv[]);
>  int run_htm_stop(int optind, int argc, char *argv[]);
>  int run_htm_status(int optind, int argc, char *argv[]);
> diff --git a/src/main.c b/src/main.c
> index eb5d64d..ee41a1d 100644
> --- a/src/main.c
> +++ b/src/main.c
> @@ -31,9 +31,9 @@
>  #include <config.h>
>  
>  #include <libpdbg.h>
> +#include <target.h>
>  
>  #include "main.h"
> -#include "bitutils.h"
>  #include "cfam.h"
>  #include "scom.h"
>  #include "reg.h"
> diff --git a/src/main.h b/src/main.h
> index e060553..b1366d9 100644
> --- a/src/main.h
> +++ b/src/main.h
> @@ -13,9 +13,11 @@
>   * See the License for the specific language governing permissions and
>   * limitations under the License.
>   */
> +
>  #include <inttypes.h>
> +#include <stdbool.h>
>  
> -#include <target.h>
> +#include <libpdbg.h>
>  
>  enum backend { FSI, I2C, KERNEL, FAKE, HOST };
>  
> diff --git a/src/mem.c b/src/mem.c
> index 71e91d3..dfdcf01 100644
> --- a/src/mem.c
> +++ b/src/mem.c
> @@ -19,9 +19,9 @@
>  #include <stdlib.h>
>  #include <string.h>
>  #include <unistd.h>
> +#include <assert.h>
>  
> -#include <operations.h>
> -#include <target.h>
> +#include <libpdbg.h>
>  
>  #include "main.h"
>  #include "progress.h"
> diff --git a/src/reg.c b/src/reg.c
> index d094fbe..002cfe9 100644
> --- a/src/reg.c
> +++ b/src/reg.c
> @@ -19,8 +19,7 @@
>  #include <stdlib.h>
>  #include <string.h>
>  
> -#include <target.h>
> -#include <operations.h>
> +#include <libpdbg.h>
>  
>  #include "main.h"
>  
> diff --git a/src/scom.c b/src/scom.c
> index 4073d88..4c59e2a 100644
> --- a/src/scom.c
> +++ b/src/scom.c
> @@ -19,7 +19,7 @@
>  #include <string.h>
>  #include <inttypes.h>
>  
> -#include <target.h>
> +#include <libpdbg.h>
>  
>  #include "main.h"
>  
> diff --git a/src/scom.h b/src/scom.h
> index 890207f..d4325b5 100644
> --- a/src/scom.h
> +++ b/src/scom.h
> @@ -15,6 +15,4 @@
>   */
>  #include <inttypes.h>
>  
> -#include <target.h>
> -
>  int handle_scoms(int optind, int argc, char *argv[]);
> diff --git a/src/thread.c b/src/thread.c
> index f32a437..e4253f6 100644
> --- a/src/thread.c
> +++ b/src/thread.c
> @@ -19,11 +19,9 @@
>  #include <stdlib.h>
>  #include <string.h>
>  
> +#include <libpdbg.h>
>  #include <bitutils.h>
>  
> -#include <target.h>
> -#include <operations.h>
> -
>  #include "main.h"
>  #include "mem.h"
>  
> diff --git a/src/thread.h b/src/thread.h
> index 5fc2a80..0c1caa2 100644
> --- a/src/thread.h
> +++ b/src/thread.h
> @@ -15,8 +15,6 @@
>   */
>  #include <inttypes.h>
>  
> -#include <target.h>
> -
>  int thread_start(int optind, int argc, char *argv[]);
>  int thread_step(int optind, int argc, char *argv[]);
>  int thread_stop(int optind, int argc, char *argv[]);
> 




More information about the Pdbg mailing list