summaryrefslogtreecommitdiff
path: root/gdb/compile
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/compile')
-rw-r--r--gdb/compile/compile-c-support.c12
-rw-r--r--gdb/compile/compile-loc2c.c22
-rw-r--r--gdb/compile/compile.c7
3 files changed, 25 insertions, 16 deletions
diff --git a/gdb/compile/compile-c-support.c b/gdb/compile/compile-c-support.c
index 1711cdafb4f..48a17e289b5 100644
--- a/gdb/compile/compile-c-support.c
+++ b/gdb/compile/compile-c-support.c
@@ -131,7 +131,9 @@ print_one_macro (const char *name, const struct macro_definition *macro,
if (line == 0)
return;
- fprintf_filtered (file, "#define %s", name);
+ /* None of -Wno-builtin-macro-redefined, #undef first
+ or plain #define of the same value would avoid a warning. */
+ fprintf_filtered (file, "#ifndef %s\n# define %s", name, name);
if (macro->kind == macro_function_like)
{
@@ -147,7 +149,7 @@ print_one_macro (const char *name, const struct macro_definition *macro,
fputs_filtered (")", file);
}
- fprintf_filtered (file, " %s\n", macro->replacement);
+ fprintf_filtered (file, " %s\n#endif\n", macro->replacement);
}
/* Write macro definitions at PC to FILE. */
@@ -252,7 +254,7 @@ generate_register_struct (struct ui_file *stream, struct gdbarch *gdbarch,
switch (TYPE_CODE (regtype))
{
case TYPE_CODE_PTR:
- fprintf_filtered (stream, "void *%s", regname);
+ fprintf_filtered (stream, "__gdb_uintptr %s", regname);
break;
case TYPE_CODE_INT:
@@ -340,8 +342,6 @@ c_compute_program (struct compile_instance *inst,
expr_block, expr_pc);
make_cleanup (xfree, registers_used);
- generate_register_struct (buf, gdbarch, registers_used);
-
fputs_unfiltered ("typedef unsigned int"
" __attribute__ ((__mode__(__pointer__)))"
" __gdb_uintptr;\n",
@@ -363,6 +363,8 @@ c_compute_program (struct compile_instance *inst,
" __gdb_int_%s;\n",
mode, mode);
}
+
+ generate_register_struct (buf, gdbarch, registers_used);
}
add_code_header (inst->scope, buf);
diff --git a/gdb/compile/compile-loc2c.c b/gdb/compile/compile-loc2c.c
index 6a3615d45ab..6f538142891 100644
--- a/gdb/compile/compile-loc2c.c
+++ b/gdb/compile/compile-loc2c.c
@@ -436,7 +436,8 @@ compute_stack_depth (enum bfd_endian byte_order, unsigned int addr_size,
static void
push (int indent, struct ui_file *stream, ULONGEST l)
{
- fprintfi_filtered (indent, stream, "__gdb_stack[++__gdb_tos] = %s;\n",
+ fprintfi_filtered (indent, stream,
+ "__gdb_stack[++__gdb_tos] = (" GCC_UINTPTR ") %s;\n",
hex_string (l));
}
@@ -520,7 +521,8 @@ pushf_register_address (int indent, struct ui_file *stream,
struct cleanup *cleanups = make_cleanup (xfree, regname);
registers_used[regnum] = 1;
- pushf (indent, stream, "&" COMPILE_I_SIMPLE_REGISTER_ARG_NAME "->%s",
+ pushf (indent, stream,
+ "(" GCC_UINTPTR ") &" COMPILE_I_SIMPLE_REGISTER_ARG_NAME "->%s",
regname);
do_cleanups (cleanups);
@@ -544,7 +546,8 @@ pushf_register (int indent, struct ui_file *stream,
pushf (indent, stream, COMPILE_I_SIMPLE_REGISTER_ARG_NAME "->%s",
regname);
else
- pushf (indent, stream, COMPILE_I_SIMPLE_REGISTER_ARG_NAME "->%s + %s",
+ pushf (indent, stream,
+ COMPILE_I_SIMPLE_REGISTER_ARG_NAME "->%s + (" GCC_UINTPTR ") %s",
regname, hex_string (offset));
do_cleanups (cleanups);
@@ -605,7 +608,8 @@ do_compile_dwarf_expr_to_c (int indent, struct ui_file *stream,
++scope;
- fprintfi_filtered (indent, stream, "%s%s;\n", type_name, result_name);
+ fprintfi_filtered (indent, stream, "__attribute__ ((unused)) %s %s;\n",
+ type_name, result_name);
fprintfi_filtered (indent, stream, "{\n");
indent += 2;
@@ -899,7 +903,7 @@ do_compile_dwarf_expr_to_c (int indent, struct ui_file *stream,
(long) (op_ptr - base));
do_compile_dwarf_expr_to_c (indent, stream,
- "void *", fb_name,
+ GCC_UINTPTR, fb_name,
sym, pc,
arch, registers_used, addr_size,
datastart, datastart + datalen,
@@ -1080,7 +1084,7 @@ do_compile_dwarf_expr_to_c (int indent, struct ui_file *stream,
"__cfa_%ld", (long) (op_ptr - base));
do_compile_dwarf_expr_to_c (indent, stream,
- "void *", cfa_name,
+ GCC_UINTPTR, cfa_name,
sym, pc, arch, registers_used,
addr_size,
cfa_start, cfa_end,
@@ -1117,8 +1121,8 @@ do_compile_dwarf_expr_to_c (int indent, struct ui_file *stream,
}
}
- fprintfi_filtered (indent, stream, "%s = (%s) __gdb_stack[__gdb_tos];\n",
- result_name, type_name);
+ fprintfi_filtered (indent, stream, "%s = __gdb_stack[__gdb_tos];\n",
+ result_name);
fprintfi_filtered (indent - 2, stream, "}\n");
do_cleanups (cleanup);
@@ -1134,7 +1138,7 @@ compile_dwarf_expr_to_c (struct ui_file *stream, const char *result_name,
const gdb_byte *op_ptr, const gdb_byte *op_end,
struct dwarf2_per_cu_data *per_cu)
{
- do_compile_dwarf_expr_to_c (2, stream, "void *", result_name, sym, pc,
+ do_compile_dwarf_expr_to_c (2, stream, GCC_UINTPTR, result_name, sym, pc,
arch, registers_used, addr_size, op_ptr, op_end,
NULL, per_cu);
}
diff --git a/gdb/compile/compile.c b/gdb/compile/compile.c
index 621de6659fb..ab19a5decef 100644
--- a/gdb/compile/compile.c
+++ b/gdb/compile/compile.c
@@ -680,8 +680,11 @@ String quoting is parsed like in shell, for example:\n\
absolute target address.
-fPIC is not used at is would require from GDB to generate .got. */
" -fPIE"
- /* We don't want warnings. */
- " -w"
+ /* We want warnings, except for some commonly happening for GDB commands. */
+ " -Wall "
+ " -Wno-implicit-function-declaration"
+ " -Wno-unused-but-set-variable"
+ " -Wno-unused-variable"
/* Override CU's possible -fstack-protector-strong. */
" -fno-stack-protector"
);