* RFC: Warning fixes
@ 2006-12-28 19:58 Daniel Jacobowitz
2006-12-28 22:56 ` Mark Kettenis
0 siblings, 1 reply; 8+ messages in thread
From: Daniel Jacobowitz @ 2006-12-28 19:58 UTC (permalink / raw)
To: gdb-patches
Here are fixes for the warnings (on x86_64-linux only) shown up by
my previous patch to use -Wall -Wextra.
Several are obviously bugs: ada-lang.c, gdbtypes.c (my fault), i386-tdep.c,
linux-nat.c, prologue-value.h, varobj.c. The remote.c and tui-layout.c
changes avoid strict aliasing violation warnings; I'm not sure how useful
that really is in practice, but if we don't use -fno-strict-aliasing I
think we ought to be using -Wstrict-aliasing. The MI changes are
for -Wmissing-braces.
Any comments on these, or shall I commit them? Regardless of the configure
patch, we might as well fix the bugs.
--
Daniel Jacobowitz
CodeSourcery
2006-12-28 Daniel Jacobowitz <dan@codesourcery.com>
* ada-lang.c (find_struct_field): Initialize *byte_offset_p.
* breakpoint.c (do_enable_breakpoint): Ignore both mem_cnt and i.
* c-typeprint.c (c_type_print_varspec_suffix): Don't test length
greater than or equal to zero.
* m2-typeprint.c (m2_array): Likewise.
* p-typeprint.c (pascal_type_print_varspec_prefix): Likewise.
* gdbtypes.c (copy_type_recursive): Correct == typo.
* i386-tdep.c (i386_skip_prologue): Remove stray semicolon.
* linux-nat.c (linux_nat_info_proc_cmd): Don't compare a pointer
greater than zero.
* macroscope.c (sal_macro_scope): Don't name a local variable "main".
(default_macro_scope): Remove unused variable.
* prologue-value.h (pv_area_find_reg): Don't name an argument
"register".
* remote-fileio.c (remote_fio_func_map): Add missing braces.
* remote.c (sigint_remote_twice_token, sigint_remote_token): Change
type.
(cleanup_sigint_signal_handler): Remove casts.
* valprint.c (val_print): Use a volatile local for the modified
argument.
* varobj.c (languages): Remove extra array dimension.
(varobj_create): Correct access to languages array.
* mi/mi-cmd-break.c (mi_cmd_break_insert, mi_cmd_break_watch): Add
missing braces.
* mi/mi-cmd-disas.c (mi_cmd_disassemble): Likewise.
* mi/mi-cmd-env.c (mi_cmd_env_path, mi_cmd_env_dir): Likewise.
* mi/mi-getopt.c (mi_valid_noargs): Likewise.
* mi/mi-main.c (mi_cmd_data_read_memory): Likewise.
(mi_cmd_data_write_memory): Likewise.
* signals/signals.c (target_signal_to_string): Don't test >= 0.
* tui/tui-layout.c (init_and_make_win): Take and return a void *.
Update all callers.
Index: ada-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/ada-lang.c,v
retrieving revision 1.85
diff -u -p -r1.85 ada-lang.c
--- ada-lang.c 1 Dec 2006 00:32:29 -0000 1.85
+++ ada-lang.c 28 Dec 2006 19:41:59 -0000
@@ -5628,7 +5628,7 @@ find_struct_field (char *name, struct ty
if (field_type_p != NULL)
*field_type_p = NULL;
if (byte_offset_p != NULL)
- *byte_offset_p;
+ *byte_offset_p = 0;
if (bit_offset_p != NULL)
*bit_offset_p = 0;
if (bit_size_p != NULL)
Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.234
diff -u -p -r1.234 breakpoint.c
--- breakpoint.c 18 Dec 2006 22:10:13 -0000 1.234
+++ breakpoint.c 28 Dec 2006 19:42:00 -0000
@@ -7610,7 +7610,7 @@ is valid is not currently in scope.\n"),
int mem_cnt = can_use_hardware_watchpoint (bpt->val);
/* Hack around 'unused var' error for some targets here */
- (void) mem_cnt, i;
+ (void) mem_cnt, (void) i;
target_resources_ok = TARGET_CAN_USE_HARDWARE_WATCHPOINT (
bpt->type, i + mem_cnt, other_type_used);
/* we can consider of type is bp_hardware_watchpoint, convert to
Index: c-typeprint.c
===================================================================
RCS file: /cvs/src/src/gdb/c-typeprint.c,v
retrieving revision 1.33
diff -u -p -r1.33 c-typeprint.c
--- c-typeprint.c 17 Dec 2005 22:33:59 -0000 1.33
+++ c-typeprint.c 28 Dec 2006 19:42:00 -0000
@@ -537,7 +537,7 @@ c_type_print_varspec_suffix (struct type
fprintf_filtered (stream, ")");
fprintf_filtered (stream, "[");
- if (TYPE_LENGTH (type) >= 0 && TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0
+ if (TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0
&& TYPE_ARRAY_UPPER_BOUND_TYPE (type) != BOUND_CANNOT_BE_DETERMINED)
fprintf_filtered (stream, "%d",
(TYPE_LENGTH (type)
Index: gdbtypes.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtypes.c,v
retrieving revision 1.108
diff -u -p -r1.108 gdbtypes.c
--- gdbtypes.c 6 Dec 2006 20:15:19 -0000 1.108
+++ gdbtypes.c 28 Dec 2006 19:42:02 -0000
@@ -3284,7 +3284,7 @@ copy_type_recursive (struct objfile *obj
can't, but at the moment it is not needed. */
if (TYPE_CODE (type) == TYPE_CODE_FLT)
- TYPE_FLOATFORMAT (new_type) == TYPE_FLOATFORMAT (type);
+ TYPE_FLOATFORMAT (new_type) = TYPE_FLOATFORMAT (type);
else if (TYPE_CODE (type) == TYPE_CODE_STRUCT
|| TYPE_CODE (type) == TYPE_CODE_UNION
|| TYPE_CODE (type) == TYPE_CODE_TEMPLATE
Index: i386-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-tdep.c,v
retrieving revision 1.225
diff -u -p -r1.225 i386-tdep.c
--- i386-tdep.c 8 Aug 2006 21:36:46 -0000 1.225
+++ i386-tdep.c 28 Dec 2006 19:42:02 -0000
@@ -874,7 +874,7 @@ i386_skip_prologue (CORE_ADDR start_pc)
/* addl y,%ebx */
if (delta > 0 && op == 0x81
- && read_memory_unsigned_integer (pc + delta + 1, 1) == 0xc3);
+ && read_memory_unsigned_integer (pc + delta + 1, 1) == 0xc3)
{
pc += delta + 6;
}
Index: linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/linux-nat.c,v
retrieving revision 1.51
diff -u -p -r1.51 linux-nat.c
--- linux-nat.c 20 Nov 2006 21:47:06 -0000 1.51
+++ linux-nat.c 28 Dec 2006 19:42:03 -0000
@@ -2790,7 +2790,7 @@ linux_nat_info_proc_cmd (char *args, int
if (cmdline_f || all)
{
sprintf (fname1, "/proc/%lld/cmdline", pid);
- if ((procfile = fopen (fname1, "r")) > 0)
+ if ((procfile = fopen (fname1, "r")) != NULL)
{
fgets (buffer, sizeof (buffer), procfile);
printf_filtered ("cmdline = '%s'\n", buffer);
@@ -2820,7 +2820,7 @@ linux_nat_info_proc_cmd (char *args, int
if (mappings_f || all)
{
sprintf (fname1, "/proc/%lld/maps", pid);
- if ((procfile = fopen (fname1, "r")) > 0)
+ if ((procfile = fopen (fname1, "r")) != NULL)
{
long long addr, endaddr, size, offset, inode;
char permissions[8], device[8], filename[MAXPATHLEN];
@@ -2880,7 +2880,7 @@ linux_nat_info_proc_cmd (char *args, int
if (status_f || all)
{
sprintf (fname1, "/proc/%lld/status", pid);
- if ((procfile = fopen (fname1, "r")) > 0)
+ if ((procfile = fopen (fname1, "r")) != NULL)
{
while (fgets (buffer, sizeof (buffer), procfile) != NULL)
puts_filtered (buffer);
@@ -2892,7 +2892,7 @@ linux_nat_info_proc_cmd (char *args, int
if (stat_f || all)
{
sprintf (fname1, "/proc/%lld/stat", pid);
- if ((procfile = fopen (fname1, "r")) > 0)
+ if ((procfile = fopen (fname1, "r")) != NULL)
{
int itmp;
char ctmp;
Index: m2-typeprint.c
===================================================================
RCS file: /cvs/src/src/gdb/m2-typeprint.c,v
retrieving revision 1.8
diff -u -p -r1.8 m2-typeprint.c
--- m2-typeprint.c 27 May 2006 17:39:28 -0000 1.8
+++ m2-typeprint.c 28 Dec 2006 19:42:03 -0000
@@ -210,7 +210,7 @@ static void m2_array (struct type *type,
int show, int level)
{
fprintf_filtered (stream, "ARRAY [");
- if (TYPE_LENGTH (type) >= 0 && TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0
+ if (TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0
&& TYPE_ARRAY_UPPER_BOUND_TYPE (type) != BOUND_CANNOT_BE_DETERMINED)
{
if (TYPE_INDEX_TYPE (type) != 0)
Index: macroscope.c
===================================================================
RCS file: /cvs/src/src/gdb/macroscope.c,v
retrieving revision 1.9
diff -u -p -r1.9 macroscope.c
--- macroscope.c 17 Dec 2005 22:34:01 -0000 1.9
+++ macroscope.c 28 Dec 2006 19:42:03 -0000
@@ -33,7 +33,7 @@
struct macro_scope *
sal_macro_scope (struct symtab_and_line sal)
{
- struct macro_source_file *main, *inclusion;
+ struct macro_source_file *main_file, *inclusion;
struct macro_scope *ms;
if (! sal.symtab
@@ -42,8 +42,8 @@ sal_macro_scope (struct symtab_and_line
ms = (struct macro_scope *) xmalloc (sizeof (*ms));
- main = macro_main (sal.symtab->macro_table);
- inclusion = macro_lookup_inclusion (main, sal.symtab->filename);
+ main_file = macro_main (sal.symtab->macro_table);
+ inclusion = macro_lookup_inclusion (main_file, sal.symtab->filename);
if (inclusion)
{
@@ -66,7 +66,7 @@ sal_macro_scope (struct symtab_and_line
For the time being, though, we'll just treat these as
occurring at the end of the main source file. */
- ms->file = main;
+ ms->file = main_file;
ms->line = -1;
complaint (&symfile_complaints,
@@ -83,7 +83,6 @@ struct macro_scope *
default_macro_scope (void)
{
struct symtab_and_line sal;
- struct macro_source_file *main;
struct macro_scope *ms;
/* If there's a selected frame, use its PC. */
Index: p-typeprint.c
===================================================================
RCS file: /cvs/src/src/gdb/p-typeprint.c,v
retrieving revision 1.15
diff -u -p -r1.15 p-typeprint.c
--- p-typeprint.c 17 Dec 2005 22:34:01 -0000 1.15
+++ p-typeprint.c 28 Dec 2006 19:42:03 -0000
@@ -265,7 +265,7 @@ pascal_type_print_varspec_prefix (struct
if (passed_a_ptr)
fprintf_filtered (stream, "(");
fprintf_filtered (stream, "array ");
- if (TYPE_LENGTH (type) >= 0 && TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0
+ if (TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0
&& TYPE_ARRAY_UPPER_BOUND_TYPE (type) != BOUND_CANNOT_BE_DETERMINED)
fprintf_filtered (stream, "[%d..%d] ",
TYPE_ARRAY_LOWER_BOUND_VALUE (type),
Index: prologue-value.h
===================================================================
RCS file: /cvs/src/src/gdb/prologue-value.h,v
retrieving revision 1.2
diff -u -p -r1.2 prologue-value.h
--- prologue-value.h 28 Mar 2006 19:19:16 -0000 1.2
+++ prologue-value.h 28 Dec 2006 19:42:03 -0000
@@ -285,7 +285,7 @@ int pv_area_store_would_trash (struct pv
instead, and collecting all your information in one pass. */
int pv_area_find_reg (struct pv_area *area,
struct gdbarch *gdbarch,
- int register,
+ int reg,
CORE_ADDR *offset_p);
Index: remote-fileio.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-fileio.c,v
retrieving revision 1.21
diff -u -p -r1.21 remote-fileio.c
--- remote-fileio.c 15 Dec 2006 23:17:56 -0000 1.21
+++ remote-fileio.c 28 Dec 2006 19:42:03 -0000
@@ -1332,19 +1332,19 @@ static struct {
char *name;
void (*func)(char *);
} remote_fio_func_map[] = {
- "open", remote_fileio_func_open,
- "close", remote_fileio_func_close,
- "read", remote_fileio_func_read,
- "write", remote_fileio_func_write,
- "lseek", remote_fileio_func_lseek,
- "rename", remote_fileio_func_rename,
- "unlink", remote_fileio_func_unlink,
- "stat", remote_fileio_func_stat,
- "fstat", remote_fileio_func_fstat,
- "gettimeofday", remote_fileio_func_gettimeofday,
- "isatty", remote_fileio_func_isatty,
- "system", remote_fileio_func_system,
- NULL, NULL
+ { "open", remote_fileio_func_open },
+ { "close", remote_fileio_func_close },
+ { "read", remote_fileio_func_read },
+ { "write", remote_fileio_func_write },
+ { "lseek", remote_fileio_func_lseek },
+ { "rename", remote_fileio_func_rename },
+ { "unlink", remote_fileio_func_unlink },
+ { "stat", remote_fileio_func_stat },
+ { "fstat", remote_fileio_func_fstat },
+ { "gettimeofday", remote_fileio_func_gettimeofday },
+ { "isatty", remote_fileio_func_isatty },
+ { "system", remote_fileio_func_system },
+ { NULL, NULL }
};
static int
Index: remote.c
===================================================================
RCS file: /cvs/src/src/gdb/remote.c,v
retrieving revision 1.241
diff -u -p -r1.241 remote.c
--- remote.c 28 Nov 2006 22:14:31 -0000 1.241
+++ remote.c 28 Dec 2006 19:42:03 -0000
@@ -996,8 +996,8 @@ static int use_threadinfo_query;
static int use_threadextra_query;
/* Tokens for use by the asynchronous signal handlers for SIGINT. */
-static void *sigint_remote_twice_token;
-static void *sigint_remote_token;
+static struct async_signal_handler *sigint_remote_twice_token;
+static struct async_signal_handler *sigint_remote_token;
/* These are pointers to hook functions that may be set in order to
modify resume/wait behavior for a particular architecture. */
@@ -2945,11 +2945,9 @@ cleanup_sigint_signal_handler (void *dum
{
signal (SIGINT, handle_sigint);
if (sigint_remote_twice_token)
- delete_async_signal_handler ((struct async_signal_handler **)
- &sigint_remote_twice_token);
+ delete_async_signal_handler (&sigint_remote_twice_token);
if (sigint_remote_token)
- delete_async_signal_handler ((struct async_signal_handler **)
- &sigint_remote_token);
+ delete_async_signal_handler (&sigint_remote_token);
}
/* Send ^C to target to halt it. Target will respond, and send us a
Index: valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/valprint.c,v
retrieving revision 1.62
diff -u -p -r1.62 valprint.c
--- valprint.c 22 Aug 2006 21:36:05 -0000 1.62
+++ valprint.c 28 Dec 2006 19:42:04 -0000
@@ -207,13 +207,12 @@ val_print (struct type *type, const gdb_
int deref_ref, int recurse, enum val_prettyprint pretty)
{
volatile struct gdb_exception except;
+ volatile enum val_prettyprint real_pretty = pretty;
int ret = 0;
struct type *real_type = check_typedef (type);
if (pretty == Val_pretty_default)
- {
- pretty = prettyprint_structs ? Val_prettyprint : Val_no_prettyprint;
- }
+ real_pretty = prettyprint_structs ? Val_prettyprint : Val_no_prettyprint;
QUIT;
@@ -231,7 +230,7 @@ val_print (struct type *type, const gdb_
TRY_CATCH (except, RETURN_MASK_ERROR)
{
ret = LA_VAL_PRINT (type, valaddr, embedded_offset, address,
- stream, format, deref_ref, recurse, pretty);
+ stream, format, deref_ref, recurse, real_pretty);
}
if (except.reason < 0)
fprintf_filtered (stream, _("<error reading variable>"));
Index: varobj.c
===================================================================
RCS file: /cvs/src/src/gdb/varobj.c,v
retrieving revision 1.65
diff -u -p -r1.65 varobj.c
--- varobj.c 8 Dec 2006 22:06:04 -0000 1.65
+++ varobj.c 28 Dec 2006 19:42:04 -0000
@@ -325,8 +325,7 @@ struct language_specific
};
/* Array of known source language routines. */
-static struct language_specific
- languages[vlang_end][sizeof (struct language_specific)] = {
+static struct language_specific languages[vlang_end] = {
/* Unknown (try treating as C */
{
vlang_unknown,
@@ -517,7 +516,7 @@ varobj_create (char *objname,
/* Set language info */
lang = variable_language (var);
- var->root->lang = languages[lang];
+ var->root->lang = &languages[lang];
/* Set ourselves as our root */
var->root->rootvar = var;
Index: mi/mi-cmd-break.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-cmd-break.c,v
retrieving revision 1.13
diff -u -p -r1.13 mi-cmd-break.c
--- mi/mi-cmd-break.c 23 Dec 2005 18:57:46 -0000 1.13
+++ mi/mi-cmd-break.c 28 Dec 2006 19:42:04 -0000
@@ -90,7 +90,7 @@ mi_cmd_break_insert (char *command, char
{"c", CONDITION_OPT, 1},
{"i", IGNORE_COUNT_OPT, 1},
{"p", THREAD_OPT, 1},
- 0
+ { 0, 0, 0 }
};
/* Parse arguments. It could be -r or -h or -t, <location> or ``--''
@@ -196,7 +196,7 @@ mi_cmd_break_watch (char *command, char
{
{"r", READ_OPT, 0},
{"a", ACCESS_OPT, 0},
- 0
+ { 0, 0, 0 }
};
/* Parse arguments. */
Index: mi/mi-cmd-disas.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-cmd-disas.c,v
retrieving revision 1.22
diff -u -p -r1.22 mi-cmd-disas.c
--- mi/mi-cmd-disas.c 23 Dec 2005 18:57:46 -0000 1.22
+++ mi/mi-cmd-disas.c 28 Dec 2006 19:42:04 -0000
@@ -84,7 +84,7 @@ mi_cmd_disassemble (char *command, char
{"n", NUM_OPT, 1},
{"s", START_OPT, 1},
{"e", END_OPT, 1},
- 0
+ { 0, 0, 0 }
};
/* Get the options with their arguments. Keep track of what we
Index: mi/mi-cmd-env.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-cmd-env.c,v
retrieving revision 1.10
diff -u -p -r1.10 mi-cmd-env.c
--- mi/mi-cmd-env.c 23 Dec 2005 18:57:46 -0000 1.10
+++ mi/mi-cmd-env.c 28 Dec 2006 19:42:04 -0000
@@ -126,7 +126,7 @@ mi_cmd_env_path (char *command, char **a
static struct mi_opt opts[] =
{
{"r", RESET_OPT, 0},
- 0
+ { 0, 0, 0 }
};
dont_repeat ();
@@ -198,7 +198,7 @@ mi_cmd_env_dir (char *command, char **ar
static struct mi_opt opts[] =
{
{"r", RESET_OPT, 0},
- 0
+ { 0, 0, 0 }
};
dont_repeat ();
Index: mi/mi-getopt.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-getopt.c,v
retrieving revision 1.10
diff -u -p -r1.10 mi-getopt.c
--- mi/mi-getopt.c 23 Dec 2005 18:57:46 -0000 1.10
+++ mi/mi-getopt.c 28 Dec 2006 19:42:04 -0000
@@ -82,7 +82,7 @@ mi_valid_noargs (const char *prefix, int
char *optarg;
static struct mi_opt opts[] =
{
- 0
+ { 0, 0, 0 }
};
if (mi_getopt (prefix, argc, argv, opts, &optind, &optarg) == -1)
Index: mi/mi-main.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-main.c,v
retrieving revision 1.86
diff -u -p -r1.86 mi-main.c
--- mi/mi-main.c 17 Nov 2006 19:30:41 -0000 1.86
+++ mi/mi-main.c 28 Dec 2006 19:42:04 -0000
@@ -773,7 +773,7 @@ mi_cmd_data_read_memory (char *command,
static struct mi_opt opts[] =
{
{"o", OFFSET_OPT, 1},
- 0
+ { 0, 0, 0 }
};
while (1)
@@ -973,7 +973,7 @@ mi_cmd_data_write_memory (char *command,
static struct mi_opt opts[] =
{
{"o", OFFSET_OPT, 1},
- 0
+ { 0, 0, 0 }
};
while (1)
Index: signals/signals.c
===================================================================
RCS file: /cvs/src/src/gdb/signals/signals.c,v
retrieving revision 1.11
diff -u -p -r1.11 signals.c
--- signals/signals.c 28 Nov 2006 19:45:07 -0000 1.11
+++ signals/signals.c 28 Dec 2006 19:42:04 -0000
@@ -219,7 +219,7 @@ static struct {
char *
target_signal_to_string (enum target_signal sig)
{
- if ((sig >= TARGET_SIGNAL_FIRST) && (sig <= TARGET_SIGNAL_LAST))
+ if (sig <= TARGET_SIGNAL_LAST)
return signals[sig].string;
else
return signals[TARGET_SIGNAL_UNKNOWN].string;
@@ -229,8 +229,7 @@ target_signal_to_string (enum target_sig
char *
target_signal_to_name (enum target_signal sig)
{
- if ((sig >= TARGET_SIGNAL_FIRST) && (sig <= TARGET_SIGNAL_LAST)
- && signals[sig].name != NULL)
+ if (sig <= TARGET_SIGNAL_LAST && signals[sig].name != NULL)
return signals[sig].name;
else
/* I think the code which prints this will always print it along
Index: tui/tui-layout.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tui-layout.c,v
retrieving revision 1.22
diff -u -p -r1.22 tui-layout.c
--- tui/tui-layout.c 23 Dec 2005 19:10:02 -0000 1.22
+++ tui/tui-layout.c 28 Dec 2006 19:42:04 -0000
@@ -47,7 +47,7 @@
********************************/
static void show_layout (enum tui_layout_type);
static void init_gen_win_info (struct tui_gen_win_info *, enum tui_win_type, int, int, int, int);
-static void init_and_make_win (void **, enum tui_win_type, int, int, int, int, int);
+static void *init_and_make_win (void *, enum tui_win_type, int, int, int, int, int);
static void show_source_or_disasm_and_command (enum tui_layout_type);
static void make_source_or_disasm_window (struct tui_win_info * *, enum tui_win_type, int, int);
static void make_command_window (struct tui_win_info * *, int, int);
@@ -640,13 +640,13 @@ prev_layout (void)
static void
make_command_window (struct tui_win_info * * win_info_ptr, int height, int origin_y)
{
- init_and_make_win ((void **) win_info_ptr,
- CMD_WIN,
- height,
- tui_term_width (),
- 0,
- origin_y,
- DONT_BOX_WINDOW);
+ *win_info_ptr = init_and_make_win (*win_info_ptr,
+ CMD_WIN,
+ height,
+ tui_term_width (),
+ 0,
+ origin_y,
+ DONT_BOX_WINDOW);
(*win_info_ptr)->can_highlight = FALSE;
}
@@ -679,13 +679,13 @@ make_disasm_window (struct tui_win_info
static void
make_data_window (struct tui_win_info * * win_info_ptr, int height, int origin_y)
{
- init_and_make_win ((void **) win_info_ptr,
- DATA_WIN,
- height,
- tui_term_width (),
- 0,
- origin_y,
- BOX_WINDOW);
+ *win_info_ptr = init_and_make_win (*win_info_ptr,
+ DATA_WIN,
+ height,
+ tui_term_width (),
+ 0,
+ origin_y,
+ BOX_WINDOW);
}
@@ -751,13 +751,13 @@ show_source_disasm_command (void)
if (TUI_DISASM_WIN == NULL)
{
make_disasm_window (&TUI_DISASM_WIN, asm_height, src_height - 1);
- init_and_make_win ((void **) & locator,
- LOCATOR_WIN,
- 2 /* 1 */ ,
- tui_term_width (),
- 0,
- (src_height + asm_height) - 1,
- DONT_BOX_WINDOW);
+ locator = init_and_make_win (locator,
+ LOCATOR_WIN,
+ 2 /* 1 */ ,
+ tui_term_width (),
+ 0,
+ (src_height + asm_height) - 1,
+ DONT_BOX_WINDOW);
}
else
{
@@ -844,13 +844,13 @@ show_data (enum tui_layout_type new_layo
make_source_window (&tui_win_list[win_type], src_height, data_height - 1);
else
make_disasm_window (&tui_win_list[win_type], src_height, data_height - 1);
- init_and_make_win ((void **) & locator,
- LOCATOR_WIN,
- 2 /* 1 */ ,
- tui_term_width (),
- 0,
- total_height - 1,
- DONT_BOX_WINDOW);
+ locator = init_and_make_win (locator,
+ LOCATOR_WIN,
+ 2 /* 1 */ ,
+ tui_term_width (),
+ 0,
+ total_height - 1,
+ DONT_BOX_WINDOW);
}
else
{
@@ -911,11 +911,11 @@ init_gen_win_info (struct tui_gen_win_in
/*
** init_and_make_win().
*/
-static void
-init_and_make_win (void ** win_info_ptr, enum tui_win_type win_type,
- int height, int width, int origin_x, int origin_y, int box_it)
+static void *
+init_and_make_win (void *opaque_win_info, enum tui_win_type win_type,
+ int height, int width, int origin_x, int origin_y,
+ int box_it)
{
- void *opaque_win_info = *win_info_ptr;
struct tui_gen_win_info * generic;
if (opaque_win_info == NULL)
@@ -942,7 +942,7 @@ init_and_make_win (void ** win_info_ptr,
}
tui_make_window (generic, box_it);
}
- *win_info_ptr = opaque_win_info;
+ return opaque_win_info;
}
@@ -959,23 +959,23 @@ make_source_or_disasm_window (struct tui
execution_info = tui_source_exec_info_win_ptr ();
else
execution_info = tui_disassem_exec_info_win_ptr ();
- init_and_make_win ((void **) & execution_info,
- EXEC_INFO_WIN,
- height,
- 3,
- 0,
- origin_y,
- DONT_BOX_WINDOW);
+ execution_info = init_and_make_win (execution_info,
+ EXEC_INFO_WIN,
+ height,
+ 3,
+ 0,
+ origin_y,
+ DONT_BOX_WINDOW);
/*
** Now create the source window.
*/
- init_and_make_win ((void **) win_info_ptr,
- type,
- height,
- tui_term_width () - execution_info->width,
- execution_info->width,
- origin_y,
- BOX_WINDOW);
+ *win_info_ptr = init_and_make_win (*win_info_ptr,
+ type,
+ height,
+ tui_term_width () - execution_info->width,
+ execution_info->width,
+ origin_y,
+ BOX_WINDOW);
(*win_info_ptr)->detail.source_info.execution_info = execution_info;
}
@@ -1009,13 +1009,13 @@ show_source_or_disasm_and_command (enum
make_source_window (win_info_ptr, src_height - 1, 0);
else
make_disasm_window (win_info_ptr, src_height - 1, 0);
- init_and_make_win ((void **) & locator,
- LOCATOR_WIN,
- 2 /* 1 */ ,
- tui_term_width (),
- 0,
- src_height - 1,
- DONT_BOX_WINDOW);
+ locator = init_and_make_win (locator,
+ LOCATOR_WIN,
+ 2 /* 1 */ ,
+ tui_term_width (),
+ 0,
+ src_height - 1,
+ DONT_BOX_WINDOW);
}
else
{
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: RFC: Warning fixes
2006-12-28 19:58 RFC: Warning fixes Daniel Jacobowitz
@ 2006-12-28 22:56 ` Mark Kettenis
2006-12-28 23:08 ` Andreas Schwab
2006-12-28 23:09 ` Daniel Jacobowitz
0 siblings, 2 replies; 8+ messages in thread
From: Mark Kettenis @ 2006-12-28 22:56 UTC (permalink / raw)
To: drow; +Cc: gdb-patches
> Date: Thu, 28 Dec 2006 14:58:28 -0500
> From: Daniel Jacobowitz <drow@false.org>
>
> Any comments on these, or shall I commit them? Regardless of the configure
> patch, we might as well fix the bugs.
Some of these are really scary. Can you check for regressions on i386 Linux?
The only thing that bothers me is this one:
> Index: signals/signals.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/signals/signals.c,v
> retrieving revision 1.11
> diff -u -p -r1.11 signals.c
> --- signals/signals.c 28 Nov 2006 19:45:07 -0000 1.11
> +++ signals/signals.c 28 Dec 2006 19:42:04 -0000
> @@ -219,7 +219,7 @@ static struct {
> char *
> target_signal_to_string (enum target_signal sig)
> {
> - if ((sig >= TARGET_SIGNAL_FIRST) && (sig <= TARGET_SIGNAL_LAST))
> + if (sig <= TARGET_SIGNAL_LAST)
> return signals[sig].string;
> else
> return signals[TARGET_SIGNAL_UNKNOWN].string;
> @@ -229,8 +229,7 @@ target_signal_to_string (enum target_sig
> char *
> target_signal_to_name (enum target_signal sig)
> {
> - if ((sig >= TARGET_SIGNAL_FIRST) && (sig <= TARGET_SIGNAL_LAST)
> - && signals[sig].name != NULL)
> + if (sig <= TARGET_SIGNAL_LAST && signals[sig].name != NULL)
> return signals[sig].name;
> else
> /* I think the code which prints this will always print it along
ISO C clearly states that enumeration constants have type 'int', so
sig could be negative, and we defenitely want to catch that case. If
GCC thinks it knows that (sig >= TARGET_SIGNAL_FIRST), I think it is
being too smart for its own good.
Mark
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: RFC: Warning fixes
2006-12-28 22:56 ` Mark Kettenis
@ 2006-12-28 23:08 ` Andreas Schwab
2006-12-28 23:09 ` Daniel Jacobowitz
1 sibling, 0 replies; 8+ messages in thread
From: Andreas Schwab @ 2006-12-28 23:08 UTC (permalink / raw)
To: Mark Kettenis; +Cc: drow, gdb-patches
Mark Kettenis <mark.kettenis@xs4all.nl> writes:
> ISO C clearly states that enumeration constants have type 'int', so
> sig could be negative, and we defenitely want to catch that case. If
> GCC thinks it knows that (sig >= TARGET_SIGNAL_FIRST), I think it is
> being too smart for its own good.
The compiler can chose any signed or unsigned type for the enumeration
_type_ to be compatible with, provided that the type can represent all
members of it. So it is perfectly valid for the compiler to chose an
unsigned type for an emumeration that only consists of non-negative
values. This is independent of the type of the enum constants itself.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, MaxfeldstraÃe 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: RFC: Warning fixes
2006-12-28 22:56 ` Mark Kettenis
2006-12-28 23:08 ` Andreas Schwab
@ 2006-12-28 23:09 ` Daniel Jacobowitz
2006-12-29 3:48 ` Daniel Jacobowitz
2006-12-29 12:15 ` Eli Zaretskii
1 sibling, 2 replies; 8+ messages in thread
From: Daniel Jacobowitz @ 2006-12-28 23:09 UTC (permalink / raw)
To: Mark Kettenis; +Cc: gdb-patches
On Thu, Dec 28, 2006 at 11:56:06PM +0100, Mark Kettenis wrote:
> > Date: Thu, 28 Dec 2006 14:58:28 -0500
> > From: Daniel Jacobowitz <drow@false.org>
> >
> > Any comments on these, or shall I commit them? Regardless of the configure
> > patch, we might as well fix the bugs.
>
> Some of these are really scary. Can you check for regressions on i386 Linux?
I haven't yet, but definitely will before checking them in.
> > - if ((sig >= TARGET_SIGNAL_FIRST) && (sig <= TARGET_SIGNAL_LAST))
> > + if (sig <= TARGET_SIGNAL_LAST)
> ISO C clearly states that enumeration constants have type 'int', so
> sig could be negative, and we defenitely want to catch that case. If
> GCC thinks it knows that (sig >= TARGET_SIGNAL_FIRST), I think it is
> being too smart for its own good.
If you want to catch that case, then it's a good thing you had this
warning here to look after you, because the old code might not do it
either :-) Though it always works out, after promotion, because of
the second test.
This happens because TARGET_SIGNAL_FIRST is an "int", but "sig" is
an enum. The choice of compatible integer type for an enum is
implementation defined, and GCC documents:
* `The integer type compatible with each enumerated type (C90
6.5.2.2, C99 6.7.2.2).'
Normally, the type is `unsigned int' if there are no negative
values in the enumeration, otherwise `int'. If `-fshort-enums' is
specified, then if there are negative values it is the first of
`signed char', `short' and `int' that can represent all the
values, otherwise it is the first of `unsigned char', `unsigned
short' and `unsigned int' that can represent all the values.
There's nothing negative in the enum, ergo GCC chooses unsigned int.
And therefore TARGET_SIGNAL_FIRST is promoted to unsigned int.
The warning is a bit annoying, though. We can't portably tell whether
the type of sig will be signed or unsigned. Perhaps we should force
sig to be an int before bounds checking, instead, and I should file a
GCC bug report. How's that sound to you?
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: RFC: Warning fixes
2006-12-28 23:09 ` Daniel Jacobowitz
@ 2006-12-29 3:48 ` Daniel Jacobowitz
2007-01-03 19:01 ` Daniel Jacobowitz
2006-12-29 12:15 ` Eli Zaretskii
1 sibling, 1 reply; 8+ messages in thread
From: Daniel Jacobowitz @ 2006-12-29 3:48 UTC (permalink / raw)
To: Mark Kettenis, gdb-patches
On Thu, Dec 28, 2006 at 06:09:26PM -0500, Daniel Jacobowitz wrote:
> > Some of these are really scary. Can you check for regressions on i386 Linux?
>
> I haven't yet, but definitely will before checking them in.
Done now (with the below copy). No regressions.
> The warning is a bit annoying, though. We can't portably tell whether
> the type of sig will be signed or unsigned. Perhaps we should force
> sig to be an int before bounds checking, instead, and I should file a
> GCC bug report. How's that sound to you?
Not sure about the bug report, but anyway, here's the revised patch.
This looks saner.
--
Daniel Jacobowitz
CodeSourcery
2006-12-28 Daniel Jacobowitz <dan@codesourcery.com>
* ada-lang.c (find_struct_field): Initialize *byte_offset_p.
* breakpoint.c (do_enable_breakpoint): Ignore both mem_cnt and i.
* c-typeprint.c (c_type_print_varspec_suffix): Don't test length
greater than or equal to zero.
* m2-typeprint.c (m2_array): Likewise.
* p-typeprint.c (pascal_type_print_varspec_prefix): Likewise.
* gdbtypes.c (copy_type_recursive): Correct == typo.
* i386-tdep.c (i386_skip_prologue): Remove stray semicolon.
* linux-nat.c (linux_nat_info_proc_cmd): Don't compare a pointer
greater than zero.
* macroscope.c (sal_macro_scope): Don't name a local variable "main".
(default_macro_scope): Remove unused variable.
* prologue-value.h (pv_area_find_reg): Don't name an argument
"register".
* remote-fileio.c (remote_fio_func_map): Add missing braces.
* remote.c (sigint_remote_twice_token, sigint_remote_token): Change
type.
(cleanup_sigint_signal_handler): Remove casts.
* valprint.c (val_print): Use a volatile local for the modified
argument.
* varobj.c (languages): Remove extra array dimension.
(varobj_create): Correct access to languages array.
* mi/mi-cmd-break.c (mi_cmd_break_insert, mi_cmd_break_watch): Add
missing braces.
* mi/mi-cmd-disas.c (mi_cmd_disassemble): Likewise.
* mi/mi-cmd-env.c (mi_cmd_env_path, mi_cmd_env_dir): Likewise.
* mi/mi-getopt.c (mi_valid_noargs): Likewise.
* mi/mi-main.c (mi_cmd_data_read_memory): Likewise.
(mi_cmd_data_write_memory): Likewise.
* signals/signals.c (target_signal_to_string): Cast to int before
comparing.
* tui/tui-layout.c (init_and_make_win): Take and return a void *.
Update all callers.
Index: ada-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/ada-lang.c,v
retrieving revision 1.85
diff -u -p -r1.85 ada-lang.c
--- ada-lang.c 1 Dec 2006 00:32:29 -0000 1.85
+++ ada-lang.c 29 Dec 2006 03:23:44 -0000
@@ -5628,7 +5628,7 @@ find_struct_field (char *name, struct ty
if (field_type_p != NULL)
*field_type_p = NULL;
if (byte_offset_p != NULL)
- *byte_offset_p;
+ *byte_offset_p = 0;
if (bit_offset_p != NULL)
*bit_offset_p = 0;
if (bit_size_p != NULL)
Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.234
diff -u -p -r1.234 breakpoint.c
--- breakpoint.c 18 Dec 2006 22:10:13 -0000 1.234
+++ breakpoint.c 29 Dec 2006 03:23:44 -0000
@@ -7610,7 +7610,7 @@ is valid is not currently in scope.\n"),
int mem_cnt = can_use_hardware_watchpoint (bpt->val);
/* Hack around 'unused var' error for some targets here */
- (void) mem_cnt, i;
+ (void) mem_cnt, (void) i;
target_resources_ok = TARGET_CAN_USE_HARDWARE_WATCHPOINT (
bpt->type, i + mem_cnt, other_type_used);
/* we can consider of type is bp_hardware_watchpoint, convert to
Index: c-typeprint.c
===================================================================
RCS file: /cvs/src/src/gdb/c-typeprint.c,v
retrieving revision 1.33
diff -u -p -r1.33 c-typeprint.c
--- c-typeprint.c 17 Dec 2005 22:33:59 -0000 1.33
+++ c-typeprint.c 29 Dec 2006 03:23:45 -0000
@@ -537,7 +537,7 @@ c_type_print_varspec_suffix (struct type
fprintf_filtered (stream, ")");
fprintf_filtered (stream, "[");
- if (TYPE_LENGTH (type) >= 0 && TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0
+ if (TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0
&& TYPE_ARRAY_UPPER_BOUND_TYPE (type) != BOUND_CANNOT_BE_DETERMINED)
fprintf_filtered (stream, "%d",
(TYPE_LENGTH (type)
Index: gdbtypes.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtypes.c,v
retrieving revision 1.108
diff -u -p -r1.108 gdbtypes.c
--- gdbtypes.c 6 Dec 2006 20:15:19 -0000 1.108
+++ gdbtypes.c 29 Dec 2006 03:23:45 -0000
@@ -3284,7 +3284,7 @@ copy_type_recursive (struct objfile *obj
can't, but at the moment it is not needed. */
if (TYPE_CODE (type) == TYPE_CODE_FLT)
- TYPE_FLOATFORMAT (new_type) == TYPE_FLOATFORMAT (type);
+ TYPE_FLOATFORMAT (new_type) = TYPE_FLOATFORMAT (type);
else if (TYPE_CODE (type) == TYPE_CODE_STRUCT
|| TYPE_CODE (type) == TYPE_CODE_UNION
|| TYPE_CODE (type) == TYPE_CODE_TEMPLATE
Index: i386-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-tdep.c,v
retrieving revision 1.225
diff -u -p -r1.225 i386-tdep.c
--- i386-tdep.c 8 Aug 2006 21:36:46 -0000 1.225
+++ i386-tdep.c 29 Dec 2006 03:23:45 -0000
@@ -874,7 +874,7 @@ i386_skip_prologue (CORE_ADDR start_pc)
/* addl y,%ebx */
if (delta > 0 && op == 0x81
- && read_memory_unsigned_integer (pc + delta + 1, 1) == 0xc3);
+ && read_memory_unsigned_integer (pc + delta + 1, 1) == 0xc3)
{
pc += delta + 6;
}
Index: linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/linux-nat.c,v
retrieving revision 1.51
diff -u -p -r1.51 linux-nat.c
--- linux-nat.c 20 Nov 2006 21:47:06 -0000 1.51
+++ linux-nat.c 29 Dec 2006 03:23:46 -0000
@@ -2790,7 +2790,7 @@ linux_nat_info_proc_cmd (char *args, int
if (cmdline_f || all)
{
sprintf (fname1, "/proc/%lld/cmdline", pid);
- if ((procfile = fopen (fname1, "r")) > 0)
+ if ((procfile = fopen (fname1, "r")) != NULL)
{
fgets (buffer, sizeof (buffer), procfile);
printf_filtered ("cmdline = '%s'\n", buffer);
@@ -2820,7 +2820,7 @@ linux_nat_info_proc_cmd (char *args, int
if (mappings_f || all)
{
sprintf (fname1, "/proc/%lld/maps", pid);
- if ((procfile = fopen (fname1, "r")) > 0)
+ if ((procfile = fopen (fname1, "r")) != NULL)
{
long long addr, endaddr, size, offset, inode;
char permissions[8], device[8], filename[MAXPATHLEN];
@@ -2880,7 +2880,7 @@ linux_nat_info_proc_cmd (char *args, int
if (status_f || all)
{
sprintf (fname1, "/proc/%lld/status", pid);
- if ((procfile = fopen (fname1, "r")) > 0)
+ if ((procfile = fopen (fname1, "r")) != NULL)
{
while (fgets (buffer, sizeof (buffer), procfile) != NULL)
puts_filtered (buffer);
@@ -2892,7 +2892,7 @@ linux_nat_info_proc_cmd (char *args, int
if (stat_f || all)
{
sprintf (fname1, "/proc/%lld/stat", pid);
- if ((procfile = fopen (fname1, "r")) > 0)
+ if ((procfile = fopen (fname1, "r")) != NULL)
{
int itmp;
char ctmp;
Index: m2-typeprint.c
===================================================================
RCS file: /cvs/src/src/gdb/m2-typeprint.c,v
retrieving revision 1.8
diff -u -p -r1.8 m2-typeprint.c
--- m2-typeprint.c 27 May 2006 17:39:28 -0000 1.8
+++ m2-typeprint.c 29 Dec 2006 03:23:46 -0000
@@ -210,7 +210,7 @@ static void m2_array (struct type *type,
int show, int level)
{
fprintf_filtered (stream, "ARRAY [");
- if (TYPE_LENGTH (type) >= 0 && TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0
+ if (TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0
&& TYPE_ARRAY_UPPER_BOUND_TYPE (type) != BOUND_CANNOT_BE_DETERMINED)
{
if (TYPE_INDEX_TYPE (type) != 0)
Index: macroscope.c
===================================================================
RCS file: /cvs/src/src/gdb/macroscope.c,v
retrieving revision 1.9
diff -u -p -r1.9 macroscope.c
--- macroscope.c 17 Dec 2005 22:34:01 -0000 1.9
+++ macroscope.c 29 Dec 2006 03:23:46 -0000
@@ -33,7 +33,7 @@
struct macro_scope *
sal_macro_scope (struct symtab_and_line sal)
{
- struct macro_source_file *main, *inclusion;
+ struct macro_source_file *main_file, *inclusion;
struct macro_scope *ms;
if (! sal.symtab
@@ -42,8 +42,8 @@ sal_macro_scope (struct symtab_and_line
ms = (struct macro_scope *) xmalloc (sizeof (*ms));
- main = macro_main (sal.symtab->macro_table);
- inclusion = macro_lookup_inclusion (main, sal.symtab->filename);
+ main_file = macro_main (sal.symtab->macro_table);
+ inclusion = macro_lookup_inclusion (main_file, sal.symtab->filename);
if (inclusion)
{
@@ -66,7 +66,7 @@ sal_macro_scope (struct symtab_and_line
For the time being, though, we'll just treat these as
occurring at the end of the main source file. */
- ms->file = main;
+ ms->file = main_file;
ms->line = -1;
complaint (&symfile_complaints,
@@ -83,7 +83,6 @@ struct macro_scope *
default_macro_scope (void)
{
struct symtab_and_line sal;
- struct macro_source_file *main;
struct macro_scope *ms;
/* If there's a selected frame, use its PC. */
Index: p-typeprint.c
===================================================================
RCS file: /cvs/src/src/gdb/p-typeprint.c,v
retrieving revision 1.15
diff -u -p -r1.15 p-typeprint.c
--- p-typeprint.c 17 Dec 2005 22:34:01 -0000 1.15
+++ p-typeprint.c 29 Dec 2006 03:23:46 -0000
@@ -265,7 +265,7 @@ pascal_type_print_varspec_prefix (struct
if (passed_a_ptr)
fprintf_filtered (stream, "(");
fprintf_filtered (stream, "array ");
- if (TYPE_LENGTH (type) >= 0 && TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0
+ if (TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0
&& TYPE_ARRAY_UPPER_BOUND_TYPE (type) != BOUND_CANNOT_BE_DETERMINED)
fprintf_filtered (stream, "[%d..%d] ",
TYPE_ARRAY_LOWER_BOUND_VALUE (type),
Index: prologue-value.h
===================================================================
RCS file: /cvs/src/src/gdb/prologue-value.h,v
retrieving revision 1.2
diff -u -p -r1.2 prologue-value.h
--- prologue-value.h 28 Mar 2006 19:19:16 -0000 1.2
+++ prologue-value.h 29 Dec 2006 03:23:46 -0000
@@ -285,7 +285,7 @@ int pv_area_store_would_trash (struct pv
instead, and collecting all your information in one pass. */
int pv_area_find_reg (struct pv_area *area,
struct gdbarch *gdbarch,
- int register,
+ int reg,
CORE_ADDR *offset_p);
Index: remote-fileio.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-fileio.c,v
retrieving revision 1.21
diff -u -p -r1.21 remote-fileio.c
--- remote-fileio.c 15 Dec 2006 23:17:56 -0000 1.21
+++ remote-fileio.c 29 Dec 2006 03:23:46 -0000
@@ -1332,19 +1332,19 @@ static struct {
char *name;
void (*func)(char *);
} remote_fio_func_map[] = {
- "open", remote_fileio_func_open,
- "close", remote_fileio_func_close,
- "read", remote_fileio_func_read,
- "write", remote_fileio_func_write,
- "lseek", remote_fileio_func_lseek,
- "rename", remote_fileio_func_rename,
- "unlink", remote_fileio_func_unlink,
- "stat", remote_fileio_func_stat,
- "fstat", remote_fileio_func_fstat,
- "gettimeofday", remote_fileio_func_gettimeofday,
- "isatty", remote_fileio_func_isatty,
- "system", remote_fileio_func_system,
- NULL, NULL
+ { "open", remote_fileio_func_open },
+ { "close", remote_fileio_func_close },
+ { "read", remote_fileio_func_read },
+ { "write", remote_fileio_func_write },
+ { "lseek", remote_fileio_func_lseek },
+ { "rename", remote_fileio_func_rename },
+ { "unlink", remote_fileio_func_unlink },
+ { "stat", remote_fileio_func_stat },
+ { "fstat", remote_fileio_func_fstat },
+ { "gettimeofday", remote_fileio_func_gettimeofday },
+ { "isatty", remote_fileio_func_isatty },
+ { "system", remote_fileio_func_system },
+ { NULL, NULL }
};
static int
Index: remote.c
===================================================================
RCS file: /cvs/src/src/gdb/remote.c,v
retrieving revision 1.241
diff -u -p -r1.241 remote.c
--- remote.c 28 Nov 2006 22:14:31 -0000 1.241
+++ remote.c 29 Dec 2006 03:23:46 -0000
@@ -996,8 +996,8 @@ static int use_threadinfo_query;
static int use_threadextra_query;
/* Tokens for use by the asynchronous signal handlers for SIGINT. */
-static void *sigint_remote_twice_token;
-static void *sigint_remote_token;
+static struct async_signal_handler *sigint_remote_twice_token;
+static struct async_signal_handler *sigint_remote_token;
/* These are pointers to hook functions that may be set in order to
modify resume/wait behavior for a particular architecture. */
@@ -2945,11 +2945,9 @@ cleanup_sigint_signal_handler (void *dum
{
signal (SIGINT, handle_sigint);
if (sigint_remote_twice_token)
- delete_async_signal_handler ((struct async_signal_handler **)
- &sigint_remote_twice_token);
+ delete_async_signal_handler (&sigint_remote_twice_token);
if (sigint_remote_token)
- delete_async_signal_handler ((struct async_signal_handler **)
- &sigint_remote_token);
+ delete_async_signal_handler (&sigint_remote_token);
}
/* Send ^C to target to halt it. Target will respond, and send us a
Index: valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/valprint.c,v
retrieving revision 1.62
diff -u -p -r1.62 valprint.c
--- valprint.c 22 Aug 2006 21:36:05 -0000 1.62
+++ valprint.c 29 Dec 2006 03:23:47 -0000
@@ -207,13 +207,12 @@ val_print (struct type *type, const gdb_
int deref_ref, int recurse, enum val_prettyprint pretty)
{
volatile struct gdb_exception except;
+ volatile enum val_prettyprint real_pretty = pretty;
int ret = 0;
struct type *real_type = check_typedef (type);
if (pretty == Val_pretty_default)
- {
- pretty = prettyprint_structs ? Val_prettyprint : Val_no_prettyprint;
- }
+ real_pretty = prettyprint_structs ? Val_prettyprint : Val_no_prettyprint;
QUIT;
@@ -231,7 +230,7 @@ val_print (struct type *type, const gdb_
TRY_CATCH (except, RETURN_MASK_ERROR)
{
ret = LA_VAL_PRINT (type, valaddr, embedded_offset, address,
- stream, format, deref_ref, recurse, pretty);
+ stream, format, deref_ref, recurse, real_pretty);
}
if (except.reason < 0)
fprintf_filtered (stream, _("<error reading variable>"));
Index: varobj.c
===================================================================
RCS file: /cvs/src/src/gdb/varobj.c,v
retrieving revision 1.65
diff -u -p -r1.65 varobj.c
--- varobj.c 8 Dec 2006 22:06:04 -0000 1.65
+++ varobj.c 29 Dec 2006 03:23:47 -0000
@@ -325,8 +325,7 @@ struct language_specific
};
/* Array of known source language routines. */
-static struct language_specific
- languages[vlang_end][sizeof (struct language_specific)] = {
+static struct language_specific languages[vlang_end] = {
/* Unknown (try treating as C */
{
vlang_unknown,
@@ -517,7 +516,7 @@ varobj_create (char *objname,
/* Set language info */
lang = variable_language (var);
- var->root->lang = languages[lang];
+ var->root->lang = &languages[lang];
/* Set ourselves as our root */
var->root->rootvar = var;
Index: mi/mi-cmd-break.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-cmd-break.c,v
retrieving revision 1.13
diff -u -p -r1.13 mi-cmd-break.c
--- mi/mi-cmd-break.c 23 Dec 2005 18:57:46 -0000 1.13
+++ mi/mi-cmd-break.c 29 Dec 2006 03:23:47 -0000
@@ -90,7 +90,7 @@ mi_cmd_break_insert (char *command, char
{"c", CONDITION_OPT, 1},
{"i", IGNORE_COUNT_OPT, 1},
{"p", THREAD_OPT, 1},
- 0
+ { 0, 0, 0 }
};
/* Parse arguments. It could be -r or -h or -t, <location> or ``--''
@@ -196,7 +196,7 @@ mi_cmd_break_watch (char *command, char
{
{"r", READ_OPT, 0},
{"a", ACCESS_OPT, 0},
- 0
+ { 0, 0, 0 }
};
/* Parse arguments. */
Index: mi/mi-cmd-disas.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-cmd-disas.c,v
retrieving revision 1.22
diff -u -p -r1.22 mi-cmd-disas.c
--- mi/mi-cmd-disas.c 23 Dec 2005 18:57:46 -0000 1.22
+++ mi/mi-cmd-disas.c 29 Dec 2006 03:23:47 -0000
@@ -84,7 +84,7 @@ mi_cmd_disassemble (char *command, char
{"n", NUM_OPT, 1},
{"s", START_OPT, 1},
{"e", END_OPT, 1},
- 0
+ { 0, 0, 0 }
};
/* Get the options with their arguments. Keep track of what we
Index: mi/mi-cmd-env.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-cmd-env.c,v
retrieving revision 1.10
diff -u -p -r1.10 mi-cmd-env.c
--- mi/mi-cmd-env.c 23 Dec 2005 18:57:46 -0000 1.10
+++ mi/mi-cmd-env.c 29 Dec 2006 03:23:47 -0000
@@ -126,7 +126,7 @@ mi_cmd_env_path (char *command, char **a
static struct mi_opt opts[] =
{
{"r", RESET_OPT, 0},
- 0
+ { 0, 0, 0 }
};
dont_repeat ();
@@ -198,7 +198,7 @@ mi_cmd_env_dir (char *command, char **ar
static struct mi_opt opts[] =
{
{"r", RESET_OPT, 0},
- 0
+ { 0, 0, 0 }
};
dont_repeat ();
Index: mi/mi-getopt.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-getopt.c,v
retrieving revision 1.10
diff -u -p -r1.10 mi-getopt.c
--- mi/mi-getopt.c 23 Dec 2005 18:57:46 -0000 1.10
+++ mi/mi-getopt.c 29 Dec 2006 03:23:47 -0000
@@ -82,7 +82,7 @@ mi_valid_noargs (const char *prefix, int
char *optarg;
static struct mi_opt opts[] =
{
- 0
+ { 0, 0, 0 }
};
if (mi_getopt (prefix, argc, argv, opts, &optind, &optarg) == -1)
Index: mi/mi-main.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-main.c,v
retrieving revision 1.86
diff -u -p -r1.86 mi-main.c
--- mi/mi-main.c 17 Nov 2006 19:30:41 -0000 1.86
+++ mi/mi-main.c 29 Dec 2006 03:23:47 -0000
@@ -773,7 +773,7 @@ mi_cmd_data_read_memory (char *command,
static struct mi_opt opts[] =
{
{"o", OFFSET_OPT, 1},
- 0
+ { 0, 0, 0 }
};
while (1)
@@ -973,7 +973,7 @@ mi_cmd_data_write_memory (char *command,
static struct mi_opt opts[] =
{
{"o", OFFSET_OPT, 1},
- 0
+ { 0, 0, 0 }
};
while (1)
Index: signals/signals.c
===================================================================
RCS file: /cvs/src/src/gdb/signals/signals.c,v
retrieving revision 1.11
diff -u -p -r1.11 signals.c
--- signals/signals.c 28 Nov 2006 19:45:07 -0000 1.11
+++ signals/signals.c 29 Dec 2006 03:23:47 -0000
@@ -1,6 +1,6 @@
/* Target signal translation functions for GDB.
Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002 Free Software Foundation, Inc.
+ 2000, 2001, 2002, 2003, 2006 Free Software Foundation, Inc.
Contributed by Cygnus Support.
This file is part of GDB.
@@ -219,7 +219,7 @@ static struct {
char *
target_signal_to_string (enum target_signal sig)
{
- if ((sig >= TARGET_SIGNAL_FIRST) && (sig <= TARGET_SIGNAL_LAST))
+ if ((int) sig >= TARGET_SIGNAL_FIRST && (int) sig <= TARGET_SIGNAL_LAST)
return signals[sig].string;
else
return signals[TARGET_SIGNAL_UNKNOWN].string;
@@ -229,7 +229,7 @@ target_signal_to_string (enum target_sig
char *
target_signal_to_name (enum target_signal sig)
{
- if ((sig >= TARGET_SIGNAL_FIRST) && (sig <= TARGET_SIGNAL_LAST)
+ if ((int) sig >= TARGET_SIGNAL_FIRST && (int) sig <= TARGET_SIGNAL_LAST
&& signals[sig].name != NULL)
return signals[sig].name;
else
Index: tui/tui-layout.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tui-layout.c,v
retrieving revision 1.22
diff -u -p -r1.22 tui-layout.c
--- tui/tui-layout.c 23 Dec 2005 19:10:02 -0000 1.22
+++ tui/tui-layout.c 29 Dec 2006 03:23:47 -0000
@@ -47,7 +47,7 @@
********************************/
static void show_layout (enum tui_layout_type);
static void init_gen_win_info (struct tui_gen_win_info *, enum tui_win_type, int, int, int, int);
-static void init_and_make_win (void **, enum tui_win_type, int, int, int, int, int);
+static void *init_and_make_win (void *, enum tui_win_type, int, int, int, int, int);
static void show_source_or_disasm_and_command (enum tui_layout_type);
static void make_source_or_disasm_window (struct tui_win_info * *, enum tui_win_type, int, int);
static void make_command_window (struct tui_win_info * *, int, int);
@@ -640,13 +640,13 @@ prev_layout (void)
static void
make_command_window (struct tui_win_info * * win_info_ptr, int height, int origin_y)
{
- init_and_make_win ((void **) win_info_ptr,
- CMD_WIN,
- height,
- tui_term_width (),
- 0,
- origin_y,
- DONT_BOX_WINDOW);
+ *win_info_ptr = init_and_make_win (*win_info_ptr,
+ CMD_WIN,
+ height,
+ tui_term_width (),
+ 0,
+ origin_y,
+ DONT_BOX_WINDOW);
(*win_info_ptr)->can_highlight = FALSE;
}
@@ -679,13 +679,13 @@ make_disasm_window (struct tui_win_info
static void
make_data_window (struct tui_win_info * * win_info_ptr, int height, int origin_y)
{
- init_and_make_win ((void **) win_info_ptr,
- DATA_WIN,
- height,
- tui_term_width (),
- 0,
- origin_y,
- BOX_WINDOW);
+ *win_info_ptr = init_and_make_win (*win_info_ptr,
+ DATA_WIN,
+ height,
+ tui_term_width (),
+ 0,
+ origin_y,
+ BOX_WINDOW);
}
@@ -751,13 +751,13 @@ show_source_disasm_command (void)
if (TUI_DISASM_WIN == NULL)
{
make_disasm_window (&TUI_DISASM_WIN, asm_height, src_height - 1);
- init_and_make_win ((void **) & locator,
- LOCATOR_WIN,
- 2 /* 1 */ ,
- tui_term_width (),
- 0,
- (src_height + asm_height) - 1,
- DONT_BOX_WINDOW);
+ locator = init_and_make_win (locator,
+ LOCATOR_WIN,
+ 2 /* 1 */ ,
+ tui_term_width (),
+ 0,
+ (src_height + asm_height) - 1,
+ DONT_BOX_WINDOW);
}
else
{
@@ -844,13 +844,13 @@ show_data (enum tui_layout_type new_layo
make_source_window (&tui_win_list[win_type], src_height, data_height - 1);
else
make_disasm_window (&tui_win_list[win_type], src_height, data_height - 1);
- init_and_make_win ((void **) & locator,
- LOCATOR_WIN,
- 2 /* 1 */ ,
- tui_term_width (),
- 0,
- total_height - 1,
- DONT_BOX_WINDOW);
+ locator = init_and_make_win (locator,
+ LOCATOR_WIN,
+ 2 /* 1 */ ,
+ tui_term_width (),
+ 0,
+ total_height - 1,
+ DONT_BOX_WINDOW);
}
else
{
@@ -911,11 +911,11 @@ init_gen_win_info (struct tui_gen_win_in
/*
** init_and_make_win().
*/
-static void
-init_and_make_win (void ** win_info_ptr, enum tui_win_type win_type,
- int height, int width, int origin_x, int origin_y, int box_it)
+static void *
+init_and_make_win (void *opaque_win_info, enum tui_win_type win_type,
+ int height, int width, int origin_x, int origin_y,
+ int box_it)
{
- void *opaque_win_info = *win_info_ptr;
struct tui_gen_win_info * generic;
if (opaque_win_info == NULL)
@@ -942,7 +942,7 @@ init_and_make_win (void ** win_info_ptr,
}
tui_make_window (generic, box_it);
}
- *win_info_ptr = opaque_win_info;
+ return opaque_win_info;
}
@@ -959,23 +959,23 @@ make_source_or_disasm_window (struct tui
execution_info = tui_source_exec_info_win_ptr ();
else
execution_info = tui_disassem_exec_info_win_ptr ();
- init_and_make_win ((void **) & execution_info,
- EXEC_INFO_WIN,
- height,
- 3,
- 0,
- origin_y,
- DONT_BOX_WINDOW);
+ execution_info = init_and_make_win (execution_info,
+ EXEC_INFO_WIN,
+ height,
+ 3,
+ 0,
+ origin_y,
+ DONT_BOX_WINDOW);
/*
** Now create the source window.
*/
- init_and_make_win ((void **) win_info_ptr,
- type,
- height,
- tui_term_width () - execution_info->width,
- execution_info->width,
- origin_y,
- BOX_WINDOW);
+ *win_info_ptr = init_and_make_win (*win_info_ptr,
+ type,
+ height,
+ tui_term_width () - execution_info->width,
+ execution_info->width,
+ origin_y,
+ BOX_WINDOW);
(*win_info_ptr)->detail.source_info.execution_info = execution_info;
}
@@ -1009,13 +1009,13 @@ show_source_or_disasm_and_command (enum
make_source_window (win_info_ptr, src_height - 1, 0);
else
make_disasm_window (win_info_ptr, src_height - 1, 0);
- init_and_make_win ((void **) & locator,
- LOCATOR_WIN,
- 2 /* 1 */ ,
- tui_term_width (),
- 0,
- src_height - 1,
- DONT_BOX_WINDOW);
+ locator = init_and_make_win (locator,
+ LOCATOR_WIN,
+ 2 /* 1 */ ,
+ tui_term_width (),
+ 0,
+ src_height - 1,
+ DONT_BOX_WINDOW);
}
else
{
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: RFC: Warning fixes
2006-12-28 23:09 ` Daniel Jacobowitz
2006-12-29 3:48 ` Daniel Jacobowitz
@ 2006-12-29 12:15 ` Eli Zaretskii
2007-01-03 18:47 ` Daniel Jacobowitz
1 sibling, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2006-12-29 12:15 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: mark.kettenis, gdb-patches
> Date: Thu, 28 Dec 2006 18:09:26 -0500
> From: Daniel Jacobowitz <drow@false.org>
> Cc: gdb-patches@sourceware.org
>
> The warning is a bit annoying, though. We can't portably tell whether
> the type of sig will be signed or unsigned. Perhaps we should force
> sig to be an int before bounds checking, instead, and I should file a
> GCC bug report. How's that sound to you?
A GCC bug report is in order, I agree: the compiler shouldn't punish
the programmer for its choice of data type.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: RFC: Warning fixes
2006-12-29 12:15 ` Eli Zaretskii
@ 2007-01-03 18:47 ` Daniel Jacobowitz
0 siblings, 0 replies; 8+ messages in thread
From: Daniel Jacobowitz @ 2007-01-03 18:47 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: mark.kettenis, gdb-patches
On Fri, Dec 29, 2006 at 02:15:01PM +0200, Eli Zaretskii wrote:
> > Date: Thu, 28 Dec 2006 18:09:26 -0500
> > From: Daniel Jacobowitz <drow@false.org>
> > Cc: gdb-patches@sourceware.org
> >
> > The warning is a bit annoying, though. We can't portably tell whether
> > the type of sig will be signed or unsigned. Perhaps we should force
> > sig to be an int before bounds checking, instead, and I should file a
> > GCC bug report. How's that sound to you?
>
> A GCC bug report is in order, I agree: the compiler shouldn't punish
> the programmer for its choice of data type.
I filed the moral equivalent of a bug report by asking Joseph (C front
end maintainer) about this. His reply was:
> This sort of thing is why such warnings belong in -Wextra not -Wall.
> (And not on unconditionally, as some such warnings are.)
So the warning is performing quirkily as designed, and we have a choice
whether to adapt our code to GCC's periodic quirks to use -Wextra, or
to avoid -Wextra. We decided, in the thread following my other patch,
to avoid it.
I'm going to check in the fix for this one anyway, since it's just a
single cast, in case someone wants to survey the results with -Wextra
for another target later. I'm sure it will have plenty to complain
about.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: RFC: Warning fixes
2006-12-29 3:48 ` Daniel Jacobowitz
@ 2007-01-03 19:01 ` Daniel Jacobowitz
0 siblings, 0 replies; 8+ messages in thread
From: Daniel Jacobowitz @ 2007-01-03 19:01 UTC (permalink / raw)
To: gdb-patches
On Thu, Dec 28, 2006 at 10:47:53PM -0500, Daniel Jacobowitz wrote:
> On Thu, Dec 28, 2006 at 06:09:26PM -0500, Daniel Jacobowitz wrote:
> > > Some of these are really scary. Can you check for regressions on i386 Linux?
> >
> > I haven't yet, but definitely will before checking them in.
>
> Done now (with the below copy). No regressions.
Tested again and checked in.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-01-03 19:01 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-28 19:58 RFC: Warning fixes Daniel Jacobowitz
2006-12-28 22:56 ` Mark Kettenis
2006-12-28 23:08 ` Andreas Schwab
2006-12-28 23:09 ` Daniel Jacobowitz
2006-12-29 3:48 ` Daniel Jacobowitz
2007-01-03 19:01 ` Daniel Jacobowitz
2006-12-29 12:15 ` Eli Zaretskii
2007-01-03 18:47 ` Daniel Jacobowitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox