This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch] Fix warnings using gcc-4.5 HEAD
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Sat, 11 Jul 2009 10:25:02 +0200
- Subject: [patch] Fix warnings using gcc-4.5 HEAD
Hi,
currently GDB CVS HEAD cannot be built with gcc SVN HEAD
gcc (GCC) 4.5.0 20090711 (experimental)
ada-lang.c: In function ‘ada_attribute_name’:
ada-lang.c:7501:9: error: comparison between ‘enum exp_opcode’ and ‘enum ada_operator’
ada-lang.c: In function ‘assign_component’:
ada-lang.c:8008:30: error: comparison between ‘enum exp_opcode’ and ‘enum ada_operator’
ada-lang.c: In function ‘aggregate_assign_from_choices’:
ada-lang.c:8163:14: error: comparison between ‘enum exp_opcode’ and ‘enum ada_operator’
ada-lang.c: In function ‘ada_evaluate_subexp’:
ada-lang.c:8581:34: error: comparison between ‘enum exp_opcode’ and ‘enum ada_operator’
ada-lang.c:9201:13: error: comparison between ‘enum exp_opcode’ and ‘enum ada_operator’
cp-name-parser.y: In function ‘cp_comp_to_string’:
cp-name-parser.y:1982:20: error: comparison between ‘enum demangle_component_type’ and ‘enum <anonymous>’
cp-name-parser.y:1987:25: error: comparison between ‘enum demangle_component_type’ and ‘enum <anonymous>’
dwarf2read.c: In function ‘dwarf2_name’:
dwarf2read.c:8513:22: error: comparison between ‘enum dwarf_form’ and ‘enum <anonymous>’
Regression tested on x86_64-fedora-linux-gnu using gcc-4.4.0-4/Fedora.
Using gcc-4.5.0-20090711/SVN there are some testsuite regressions due to the
built gcc target testcases - assuming not due to the built host gdb.
Thanks,
Jan
gdb/
2009-07-11 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix gcc-4.5 HEAD warnings.
* ada-lang.h (enum ada_operator): Make the enum anonymous.
(BINOP_IN_BOUNDS, TERNOP_IN_RANGE, OP_ATR_FIRST, OP_ATR_LAST)
(OP_ATR_LENGTH, OP_ATR_IMAGE, OP_ATR_MAX, OP_ATR_MIN, OP_ATR_MODULUS)
(OP_ATR_POS, OP_ATR_SIZE, OP_ATR_TAG, OP_ATR_VAL, UNOP_QUAL)
(UNOP_IN_RANGE, OP_AGGREGATE, OP_OTHERS, OP_CHOICES, OP_POSITIONAL)
(OP_DISCRETE_RANGE): New casted #defines.
* cp-name-parser.y (GLOBAL_CONSTRUCTORS, GLOBAL_DESTRUCTORS): Replace
the enum by casted #defines.
* dwarf2read.c (GDB_FORM_cached_string): Likewise.
--- a/gdb/ada-lang.h
+++ b/gdb/ada-lang.h
@@ -79,7 +79,9 @@ struct ada_opname_map
/* Defined in ada-lang.c */
extern const struct ada_opname_map ada_opname_table[];
-enum ada_operator
+/* Extend enum exp_opcode so that its new elements have the same type using
+ #defines below. */
+enum
{
/* X IN A'RANGE(N). N is an immediate operand, surrounded by
BINOP_IN_BOUNDS before and after. A is an array, X an index
@@ -87,31 +89,46 @@ enum ada_operator
dimension (1-based) of A. (A multi-dimensional array
type is represented as array of array of ...) */
BINOP_IN_BOUNDS = OP_EXTENDED0,
+#define BINOP_IN_BOUNDS ((enum exp_opcode) BINOP_IN_BOUNDS)
/* X IN L .. U. True iff L <= X <= U. */
TERNOP_IN_RANGE,
+#define TERNOP_IN_RANGE ((enum exp_opcode) TERNOP_IN_RANGE)
/* Ada attributes ('Foo). */
OP_ATR_FIRST,
+#define OP_ATR_FIRST ((enum exp_opcode) OP_ATR_FIRST)
OP_ATR_LAST,
+#define OP_ATR_LAST ((enum exp_opcode) OP_ATR_LAST)
OP_ATR_LENGTH,
+#define OP_ATR_LENGTH ((enum exp_opcode) OP_ATR_LENGTH)
OP_ATR_IMAGE,
+#define OP_ATR_IMAGE ((enum exp_opcode) OP_ATR_IMAGE)
OP_ATR_MAX,
+#define OP_ATR_MAX ((enum exp_opcode) OP_ATR_MAX)
OP_ATR_MIN,
+#define OP_ATR_MIN ((enum exp_opcode) OP_ATR_MIN)
OP_ATR_MODULUS,
+#define OP_ATR_MODULUS ((enum exp_opcode) OP_ATR_MODULUS)
OP_ATR_POS,
+#define OP_ATR_POS ((enum exp_opcode) OP_ATR_POS)
OP_ATR_SIZE,
+#define OP_ATR_SIZE ((enum exp_opcode) OP_ATR_SIZE)
OP_ATR_TAG,
+#define OP_ATR_TAG ((enum exp_opcode) OP_ATR_TAG)
OP_ATR_VAL,
+#define OP_ATR_VAL ((enum exp_opcode) OP_ATR_VAL)
/* Ada type qualification. It is encoded as for UNOP_CAST, above,
and denotes the TYPE'(EXPR) construct. */
UNOP_QUAL,
+#define UNOP_QUAL ((enum exp_opcode) UNOP_QUAL)
/* X IN TYPE. The `TYPE' argument is immediate, with
UNOP_IN_RANGE before and after it. True iff X is a member of
type TYPE (typically a subrange). */
UNOP_IN_RANGE,
+#define UNOP_IN_RANGE ((enum exp_opcode) UNOP_IN_RANGE)
/* An aggregate. A single immediate operand, N>0, gives
the number of component specifications that follow. The
@@ -122,9 +139,11 @@ enum ada_operator
positional aggregates only). Aggregates currently
occur only as the right sides of assignments. */
OP_AGGREGATE,
+#define OP_AGGREGATE ((enum exp_opcode) OP_AGGREGATE)
/* An others clause. Followed by a single expression. */
OP_OTHERS,
+#define OP_OTHERS ((enum exp_opcode) OP_OTHERS)
/* An aggregate component association. A single immediate operand, N,
gives the number of choices that follow. This is followed by a second
@@ -150,16 +169,19 @@ enum ada_operator
who can work around the problem in any case by putting
parentheses around X. */
OP_CHOICES,
+#define OP_CHOICES ((enum exp_opcode) OP_CHOICES)
/* A positional aggregate component association. The operator is
followed by a single integer indicating the position in the
aggregate (0-based), followed by a second OP_POSITIONAL. Next
follows a single expression giving the component value. */
OP_POSITIONAL,
+#define OP_POSITIONAL ((enum exp_opcode) OP_POSITIONAL)
/* A range of values. Followed by two expressions giving the
upper and lower bounds of the range. */
- OP_DISCRETE_RANGE,
+ OP_DISCRETE_RANGE,
+#define OP_DISCRETE_RANGE ((enum exp_opcode) OP_DISCRETE_RANGE)
/* End marker */
OP_ADA_LAST
--- a/gdb/cp-name-parser.y
+++ b/gdb/cp-name-parser.y
@@ -316,10 +316,8 @@ make_name (const char *name, int len)
%token <typed_val_int> GLOBAL
%{
-enum {
- GLOBAL_CONSTRUCTORS = DEMANGLE_COMPONENT_LITERAL + 20,
- GLOBAL_DESTRUCTORS = DEMANGLE_COMPONENT_LITERAL + 21
-};
+#define GLOBAL_CONSTRUCTORS (DEMANGLE_COMPONENT_LITERAL + 20)
+#define GLOBAL_DESTRUCTORS (DEMANGLE_COMPONENT_LITERAL + 21)
%}
/* Precedence declarations. */
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -501,14 +501,11 @@ struct attr_abbrev
ENUM_BITFIELD(dwarf_form) form : 16;
};
-/* Additional GDB-specific attribute forms. */
-enum
- {
- /* A string which has been updated to GDB's internal
- representation (e.g. converted to canonical form) and does not
- need to be updated again. */
- GDB_FORM_cached_string = 0xff
- };
+/* Additional GDB-specific attribute form:
+
+ A string which has been updated to GDB's internal representation (e.g.
+ converted to canonical form) and does not need to be updated again. */
+#define GDB_FORM_cached_string ((enum dwarf_form) 0xff)
/* Attributes have a name and a value */
struct attribute