This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 02/11 v5] Introduce common-types.h
- From: Doug Evans <dje at google dot com>
- To: Gary Benson <gbenson at redhat dot com>
- Cc: gdb-patches at sourceware dot org, Pedro Alves <palves at redhat dot com>, Tom Tromey <tromey at redhat dot com>
- Date: Wed, 6 Aug 2014 09:34:43 -0700
- Subject: Re: [PATCH 02/11 v5] Introduce common-types.h
- Authentication-results: sourceware.org; auth=none
- References: <1406888377-25795-1-git-send-email-gbenson at redhat dot com> <1406888377-25795-3-git-send-email-gbenson at redhat dot com>
Gary Benson writes:
> This introduces common-types.h. This file defines various standard
> types used by gdb and gdbserver.
Side discussion: It's a bit odd to see common-types.h and then see
errors.h spelled as errors.h and not common-errors.h.
[Or vice versa.]
Is consistency in the file names a goal?
I realize common-utils.h needs to be something other than utils.h
because gdb and gdbserver each still have their own.
And similarly for common-defs.h - gdb still has defs.h.
But nothing else in common/ is spelled common-foo,
and I wonder if less randomness would be useful.
I'd be happy with #include "common/errors.h", and so on.
That way when I see it used I know where to look without having to
rely on memory or ls.
> Currently these types are conditionally defined based on GDBSERVER.
> The long term goal is to remove all such tests; however, this is
> difficult as currently gdb uses definitions from BFD. In the meantime
> this is still a step in the right direction.
>
> gdb/
> 2014-08-01 Tom Tromey <tromey@redhat.com>
> Gary Benson <gbenson@redhat.com>
>
> * common/common-types.h: New file.
> * Makefile.in (HFILES_NO_SRCDIR): Add common/common-types.h.
> * common/common-defs.h: Include common-types.h.
> * defs.h (gdb_byte, CORE_ADDR, CORE_ADDR_MAX, LONGEST)
> (ULONGEST): Remove.
>
> gdb/gdbserver/
> 2014-08-01 Tom Tromey <tromey@redhat.com>
> Gary Benson <gbenson@redhat.com>
>
> * server.h: Add static assertion.
> (gdb_byte, CORE_ADDR, LONGEST, ULONGEST): Remove.
>[...]
> diff --git a/gdb/common/common-types.h b/gdb/common/common-types.h
> new file mode 100644
> index 0000000..9fa1c24
> --- /dev/null
> +++ b/gdb/common/common-types.h
> @@ -0,0 +1,61 @@
> +/* Declarations for common types.
> +
> + Copyright (C) 1986-2014 Free Software Foundation, Inc.
> +
> + This file is part of GDB.
> +
> + This program is free software; you can redistribute it and/or modify
> + it under the terms of the GNU General Public License as published by
> + the Free Software Foundation; either version 3 of the License, or
> + (at your option) any later version.
> +
> + This program is distributed in the hope that it will be useful,
> + but WITHOUT ANY WARRANTY; without even the implied warranty of
> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + GNU General Public License for more details.
> +
> + You should have received a copy of the GNU General Public License
> + along with this program. If not, see <http://www.gnu.org/licenses/>. */
> +
> +#ifndef COMMON_TYPES_H
> +#define COMMON_TYPES_H
Nit, and I do mean nit :-): errors.h uses COMMON_ERRORS_H,
so should this be COMMON_COMMON_TYPES_H?