summaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@redhat.com>2006-02-14 18:45:14 +0000
committerAlexandre Oliva <aoliva@redhat.com>2006-02-14 18:45:14 +0000
commita37c9caee8309853750295de513544d8298ccbc3 (patch)
tree174e0505fa3193f6f1d7c0dcb27cf325701c417d /gdb
parentf420e9d42b00cb209e6ca3e9f4b13379451490a3 (diff)
downloadgdb-a37c9caee8309853750295de513544d8298ccbc3.tar.gz
* doublest.h (DOUBLEST): Use long double only if we can scan
it in. Undefine HAVE_LONG_DOUBLE otherwise. (DOUBLEST_FORMAT): New. * c-exp.y (parse_number): Use it. * jv-exp.y (parse_number): Likewise. * objc-exp.y (parse_number): Likewise. * p-exp.y (parse_number): Likewise. * varobj.c (free_variable): Silence type-punning warnings. * tui/tui-data.h (struct tui_list): Change type of list member. * tui/tui-data.c: Remove no-longer-needed type casts. (source_windows): Silence type-punning warnings. * tui/tui-stack.c, tui/tui-win.c, tui/tui-winsource.c: Likewise.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog15
-rw-r--r--gdb/c-exp.y20
-rw-r--r--gdb/doublest.h7
-rw-r--r--gdb/jv-exp.y19
-rw-r--r--gdb/objc-exp.y19
-rw-r--r--gdb/p-exp.y19
-rw-r--r--gdb/tui/tui-data.c6
-rw-r--r--gdb/tui/tui-data.h2
-rw-r--r--gdb/tui/tui-stack.c4
-rw-r--r--gdb/tui/tui-win.c10
-rw-r--r--gdb/tui/tui-winsource.c4
-rw-r--r--gdb/varobj.c2
12 files changed, 43 insertions, 84 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b0fefb14d4e..c70577db6df 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,18 @@
+2006-02-14 Alexandre Oliva <aoliva@redhat.com>
+
+ * doublest.h (DOUBLEST): Use long double only if we can scan
+ it in. Undefine HAVE_LONG_DOUBLE otherwise.
+ (DOUBLEST_FORMAT): New.
+ * c-exp.y (parse_number): Use it.
+ * jv-exp.y (parse_number): Likewise.
+ * objc-exp.y (parse_number): Likewise.
+ * p-exp.y (parse_number): Likewise.
+ * varobj.c (free_variable): Silence type-punning warnings.
+ * tui/tui-data.h (struct tui_list): Change type of list member.
+ * tui/tui-data.c: Remove no-longer-needed type casts.
+ (source_windows): Silence type-punning warnings.
+ * tui/tui-stack.c, tui/tui-win.c, tui/tui-winsource.c: Likewise.
+
2006-02-13 Mark Kettenis <kettenis@gnu.org>
Fix PR breakpoints/2080.
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 8758a7dc0b0..b56613fa98f 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -1080,24 +1080,8 @@ parse_number (p, len, parsed_float, putithere)
char saved_char = p[len];
p[len] = 0; /* null-terminate the token */
-
- if (sizeof (putithere->typed_val_float.dval) <= sizeof (float))
- num = sscanf (p, "%g%s", (float *) &putithere->typed_val_float.dval,s);
- else if (sizeof (putithere->typed_val_float.dval) <= sizeof (double))
- num = sscanf (p, "%lg%s", (double *) &putithere->typed_val_float.dval,s);
- else
- {
-#ifdef SCANF_HAS_LONG_DOUBLE
- num = sscanf (p, "%Lg%s", &putithere->typed_val_float.dval,s);
-#else
- /* Scan it into a double, then assign it to the long double.
- This at least wins with values representable in the range
- of doubles. */
- double temp;
- num = sscanf (p, "%lg%s", &temp,s);
- putithere->typed_val_float.dval = temp;
-#endif
- }
+ num = sscanf (p, DOUBLEST_FORMAT "%s",
+ &putithere->typed_val_float.dval, s);
p[len] = saved_char; /* restore the input stream */
if (num == 1)
diff --git a/gdb/doublest.h b/gdb/doublest.h
index c10b3ea9c0b..1a479b86719 100644
--- a/gdb/doublest.h
+++ b/gdb/doublest.h
@@ -48,10 +48,15 @@ struct floatformat;
host's `long double'. In general, we'll probably reduce the precision of
any such values and print a warning. */
-#ifdef HAVE_LONG_DOUBLE
+#if defined HAVE_LONG_DOUBLE && defined SCANF_HAS_LONG_DOUBLE
typedef long double DOUBLEST;
+# define DOUBLEST_FORMAT "%Lg"
#else
typedef double DOUBLEST;
+# define DOUBLEST_FORMAT "%g"
+/* If we can't scan or print long double, we don't want to use it
+ anywhere. */
+# undef HAVE_LONG_DOUBLE
#endif
extern void floatformat_to_doublest (const struct floatformat *,
diff --git a/gdb/jv-exp.y b/gdb/jv-exp.y
index 4f9e77f205b..1ed027c059f 100644
--- a/gdb/jv-exp.y
+++ b/gdb/jv-exp.y
@@ -713,23 +713,8 @@ parse_number (p, len, parsed_float, putithere)
char saved_char = p[len];
p[len] = 0; /* null-terminate the token */
- if (sizeof (putithere->typed_val_float.dval) <= sizeof (float))
- num = sscanf (p, "%g%c", (float *) &putithere->typed_val_float.dval, &c);
- else if (sizeof (putithere->typed_val_float.dval) <= sizeof (double))
- num = sscanf (p, "%lg%c", (double *) &putithere->typed_val_float.dval, &c);
- else
- {
-#ifdef SCANF_HAS_LONG_DOUBLE
- num = sscanf (p, "%Lg%c", &putithere->typed_val_float.dval, &c);
-#else
- /* Scan it into a double, then assign it to the long double.
- This at least wins with values representable in the range
- of doubles. */
- double temp;
- num = sscanf (p, "%lg%c", &temp, &c);
- putithere->typed_val_float.dval = temp;
-#endif
- }
+ num = sscanf (p, DOUBLEST_FORMAT "%c",
+ &putithere->typed_val_float.dval, &c);
p[len] = saved_char; /* restore the input stream */
if (num != 1) /* check scanf found ONLY a float ... */
return ERROR;
diff --git a/gdb/objc-exp.y b/gdb/objc-exp.y
index 93ccea336df..f1503136d23 100644
--- a/gdb/objc-exp.y
+++ b/gdb/objc-exp.y
@@ -1025,23 +1025,8 @@ parse_number (p, len, parsed_float, putithere)
/* It's a float since it contains a point or an exponent. */
- if (sizeof (putithere->typed_val_float.dval) <= sizeof (float))
- sscanf (p, "%g", (float *)&putithere->typed_val_float.dval);
- else if (sizeof (putithere->typed_val_float.dval) <= sizeof (double))
- sscanf (p, "%lg", (double *)&putithere->typed_val_float.dval);
- else
- {
-#ifdef PRINTF_HAS_LONG_DOUBLE
- sscanf (p, "%Lg", &putithere->typed_val_float.dval);
-#else
- /* Scan it into a double, then assign it to the long double.
- This at least wins with values representable in the range
- of doubles. */
- double temp;
- sscanf (p, "%lg", &temp);
- putithere->typed_val_float.dval = temp;
-#endif
- }
+ sscanf (p, DOUBLEST_FORMAT "%c",
+ &putithere->typed_val_float.dval, &c);
/* See if it has `f' or `l' suffix (float or long double). */
diff --git a/gdb/p-exp.y b/gdb/p-exp.y
index 68d8c08e6cd..37558b40e1d 100644
--- a/gdb/p-exp.y
+++ b/gdb/p-exp.y
@@ -799,23 +799,8 @@ parse_number (p, len, parsed_float, putithere)
char saved_char = p[len];
p[len] = 0; /* null-terminate the token */
- if (sizeof (putithere->typed_val_float.dval) <= sizeof (float))
- num = sscanf (p, "%g%c", (float *) &putithere->typed_val_float.dval,&c);
- else if (sizeof (putithere->typed_val_float.dval) <= sizeof (double))
- num = sscanf (p, "%lg%c", (double *) &putithere->typed_val_float.dval,&c);
- else
- {
-#ifdef SCANF_HAS_LONG_DOUBLE
- num = sscanf (p, "%Lg%c", &putithere->typed_val_float.dval,&c);
-#else
- /* Scan it into a double, then assign it to the long double.
- This at least wins with values representable in the range
- of doubles. */
- double temp;
- num = sscanf (p, "%lg%c", &temp,&c);
- putithere->typed_val_float.dval = temp;
-#endif
- }
+ num = sscanf (p, DOUBLEST_FORMAT "%c",
+ &putithere->typed_val_float.dval, &c);
p[len] = saved_char; /* restore the input stream */
if (num != 1) /* check scanf found ONLY a float ... */
return ERROR;
diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c
index 71c16f94bf0..9ef342a0ebf 100644
--- a/gdb/tui/tui-data.c
+++ b/gdb/tui/tui-data.c
@@ -44,7 +44,7 @@ static int term_height, term_width;
static struct tui_gen_win_info _locator;
static struct tui_gen_win_info exec_info[2];
static struct tui_win_info * src_win_list[2];
-static struct tui_list source_windows = {(void **) src_win_list, 0};
+static struct tui_list source_windows = {src_win_list, 0};
static int default_tab_len = DEFAULT_TAB_LEN;
static struct tui_win_info * win_with_focus = (struct tui_win_info *) NULL;
static struct tui_layout_def layout_def =
@@ -182,7 +182,7 @@ tui_clear_source_windows_detail (void)
int i;
for (i = 0; i < (tui_source_windows ())->count; i++)
- tui_clear_win_detail ((struct tui_win_info *) (tui_source_windows ())->list[i]);
+ tui_clear_win_detail ((tui_source_windows ())->list[i]);
}
@@ -782,7 +782,7 @@ tui_free_all_source_wins_content (void)
for (i = 0; i < (tui_source_windows ())->count; i++)
{
- struct tui_win_info * win_info = (struct tui_win_info *) (tui_source_windows ())->list[i];
+ struct tui_win_info * win_info = (tui_source_windows ())->list[i];
if (win_info != NULL)
{
diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h
index ba9f3fabcd1..67f2ff5e024 100644
--- a/gdb/tui/tui-data.h
+++ b/gdb/tui/tui-data.h
@@ -110,7 +110,7 @@ enum tui_scroll_direction
/* General list struct. */
struct tui_list
{
- void **list;
+ struct tui_win_info **list;
int count;
};
diff --git a/gdb/tui/tui-stack.c b/gdb/tui/tui-stack.c
index bb6eeda1839..a1e972c61ca 100644
--- a/gdb/tui/tui-stack.c
+++ b/gdb/tui/tui-stack.c
@@ -343,7 +343,7 @@ tui_show_frame_info (struct frame_info *fi)
for (i = 0; i < (tui_source_windows ())->count; i++)
{
union tui_which_element *item;
- win_info = (struct tui_win_info *) (tui_source_windows ())->list[i];
+ win_info = (tui_source_windows ())->list[i];
item = &((struct tui_win_element *) locator->content[0])->which_element;
if (win_info == TUI_SRC_WIN)
@@ -401,7 +401,7 @@ tui_show_frame_info (struct frame_info *fi)
tui_show_locator_content ();
for (i = 0; i < (tui_source_windows ())->count; i++)
{
- win_info = (struct tui_win_info *) (tui_source_windows ())->list[i];
+ win_info = (tui_source_windows ())->list[i];
tui_clear_source_content (win_info, EMPTY_SOURCE_PROMPT);
tui_update_exec_info (win_info);
}
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index 87ab9254f74..9dd7d4afb33 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -1119,7 +1119,7 @@ tui_adjust_win_heights (struct tui_win_info * primary_win_info, int new_height)
make_invisible_and_set_new_height (primary_win_info, new_height);
if (primary_win_info->generic.type == CMD_WIN)
{
- win_info = (struct tui_win_info *) (tui_source_windows ())->list[0];
+ win_info = (tui_source_windows ())->list[0];
src_win_info = win_info;
}
else
@@ -1148,7 +1148,7 @@ tui_adjust_win_heights (struct tui_win_info * primary_win_info, int new_height)
else
{
first_win = TUI_DATA_WIN;
- second_win = (struct tui_win_info *) (tui_source_windows ())->list[0];
+ second_win = (tui_source_windows ())->list[0];
}
if (primary_win_info == TUI_CMD_WIN)
{ /*
@@ -1393,7 +1393,7 @@ new_height_ok (struct tui_win_info * primary_win_info, int new_height)
struct tui_win_info * win_info;
if (primary_win_info == TUI_CMD_WIN)
- win_info = (struct tui_win_info *) (tui_source_windows ())->list[0];
+ win_info = (tui_source_windows ())->list[0];
else
win_info = TUI_CMD_WIN;
ok = ((new_height +
@@ -1414,7 +1414,7 @@ new_height_ok (struct tui_win_info * primary_win_info, int new_height)
else
{
first_win = TUI_DATA_WIN;
- second_win = (struct tui_win_info *) (tui_source_windows ())->list[0];
+ second_win = (tui_source_windows ())->list[0];
}
/*
** We could simply add all the heights to obtain the same result
@@ -1543,7 +1543,7 @@ parse_scrolling_args (char *arg, struct tui_win_info * * win_to_scroll,
error (_("Invalid window specified. \n\
The window name specified must be valid and visible.\n"));
else if (*win_to_scroll == TUI_CMD_WIN)
- *win_to_scroll = (struct tui_win_info *) (tui_source_windows ())->list[0];
+ *win_to_scroll = (tui_source_windows ())->list[0];
}
xfree (buf);
}
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index 5b498dffb27..ca084edaa6b 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -160,7 +160,7 @@ tui_update_source_windows_with_addr (CORE_ADDR addr)
for (i = 0; i < (tui_source_windows ())->count; i++)
{
- struct tui_win_info * win_info = (struct tui_win_info *) (tui_source_windows ())->list[i];
+ struct tui_win_info * win_info = (tui_source_windows ())->list[i];
tui_clear_source_content (win_info, EMPTY_SOURCE_PROMPT);
tui_clear_exec_info_content (win_info);
@@ -384,7 +384,7 @@ tui_update_all_breakpoint_info (void)
for (i = 0; i < list->count; i++)
{
- struct tui_win_info * win = (struct tui_win_info *) list->list[i];
+ struct tui_win_info * win = list->list[i];
if (tui_update_breakpoint_info (win, FALSE))
{
diff --git a/gdb/varobj.c b/gdb/varobj.c
index c4e4309e198..d4c1fbf725c 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -1374,7 +1374,7 @@ free_variable (struct varobj *var)
/* Free the expression if this is a root variable. */
if (var->root->rootvar == var)
{
- free_current_contents ((char **) &var->root->exp);
+ free_current_contents (&var->root->exp);
xfree (var->root);
}