This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] Remove unnecessary casts in gcc/ada
- From: Jens-Michael Hoffmann <jensmh at gmx dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sat, 16 Nov 2002 03:51:27 +0100
- Subject: [patch] Remove unnecessary casts in gcc/ada
- Organization: Hoffmann Information Services GmbH
Hi,
attached is a patch to remove unnecessary casts.
Bootstrapped and regtested on i686-pc-linux-gnu.
2002-11-15 Jens-Michael Hoffmann <jensmh@gmx.de>
* adaint.c: Remove unnecessary casts.
* decl.c: Likewise.
* gnatbl.c: Likewise.
* init.c: Likewise.
* misc.c: Likewise.
* trans.c: Likewise.
* utils.c: Likewise.
Index: gcc/ada/adaint.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/ada/adaint.c,v
retrieving revision 1.12
diff -c -3 -p -r1.12 adaint.c
*** gcc/ada/adaint.c 13 Nov 2002 21:48:22 -0000 1.12
--- gcc/ada/adaint.c 15 Nov 2002 21:18:05 -0000
*************** __gnat_set_env_value (name, value)
*** 1209,1215 ****
int size = strlen (name) + strlen (value) + 2;
char *expression;
! expression = (char *) xmalloc (size * sizeof (char));
sprintf (expression, "%s=%s", name, value);
putenv (expression);
--- 1209,1215 ----
int size = strlen (name) + strlen (value) + 2;
char *expression;
! expression = xmalloc (size * sizeof (char));
sprintf (expression, "%s=%s", name, value);
putenv (expression);
*************** __gnat_get_libraries_from_registry ()
*** 1264,1270 ****
{
char *old_result = result;
! result = (char *) xmalloc (strlen (old_result) + value_size + 2);
strcpy (result, old_result);
strcat (result, value);
strcat (result, ";");
--- 1264,1270 ----
{
char *old_result = result;
! result = xmalloc (strlen (old_result) + value_size + 2);
strcpy (result, old_result);
strcat (result, value);
strcat (result, ";");
*************** add_handle (h)
*** 1473,1479 ****
{
Process_List *pl;
! pl = (Process_List *) xmalloc (sizeof (Process_List));
plist_enter();
--- 1473,1479 ----
{
Process_List *pl;
! pl = xmalloc (sizeof (Process_List));
plist_enter();
*************** win32_no_block_spawn (command, args)
*** 1541,1547 ****
k++;
}
! full_command = (char *) xmalloc (csize);
/* Startup info. */
SI.cb = sizeof (STARTUPINFO);
--- 1541,1547 ----
k++;
}
! full_command = xmalloc (csize);
/* Startup info. */
SI.cb = sizeof (STARTUPINFO);
*************** win32_wait (status)
*** 1602,1608 ****
return -1;
}
! hl = (HANDLE *) xmalloc (sizeof (HANDLE) * plist_length);
k = 0;
plist_enter();
--- 1602,1608 ----
return -1;
}
! hl = xmalloc (sizeof (HANDLE) * plist_length);
k = 0;
plist_enter();
*************** wildcard_translate_unix (name)
*** 1873,1879 ****
if (new_canonical_filelist_in_use == new_canonical_filelist_allocated)
{
new_canonical_filelist_allocated += NEW_CANONICAL_FILELIST_INCREMENT;
! new_canonical_filelist = (char **) xrealloc
(new_canonical_filelist,
new_canonical_filelist_allocated * sizeof (char *));
}
--- 1873,1879 ----
if (new_canonical_filelist_in_use == new_canonical_filelist_allocated)
{
new_canonical_filelist_allocated += NEW_CANONICAL_FILELIST_INCREMENT;
! new_canonical_filelist = xrealloc
(new_canonical_filelist,
new_canonical_filelist_allocated * sizeof (char *));
}
Index: gcc/ada/decl.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/ada/decl.c,v
retrieving revision 1.14
diff -c -3 -p -r1.14 decl.c
*** gcc/ada/decl.c 23 Oct 2002 07:33:22 -0000 1.14
--- gcc/ada/decl.c 15 Nov 2002 21:18:13 -0000
*************** gnat_to_gnu_entity (gnat_entity, gnu_exp
*** 1411,1418 ****
= (Convention (gnat_entity) == Convention_Fortran) ? ndim - 1 : 0;
int nextdim
= (Convention (gnat_entity) == Convention_Fortran) ? - 1 : 1;
! tree *gnu_index_types = (tree *) alloca (ndim * sizeof (tree *));
! tree *gnu_temp_fields = (tree *) alloca (ndim * sizeof (tree *));
tree gnu_comp_size = 0;
tree gnu_max_size = size_one_node;
tree gnu_max_size_unit;
--- 1411,1418 ----
= (Convention (gnat_entity) == Convention_Fortran) ? ndim - 1 : 0;
int nextdim
= (Convention (gnat_entity) == Convention_Fortran) ? - 1 : 1;
! tree *gnu_index_types = alloca (ndim * sizeof (tree *));
! tree *gnu_temp_fields = alloca (ndim * sizeof (tree *));
tree gnu_comp_size = 0;
tree gnu_max_size = size_one_node;
tree gnu_max_size_unit;
*************** gnat_to_gnu_entity (gnat_entity, gnu_exp
*** 1687,1693 ****
Entity_Id gnat_ind_subtype;
Entity_Id gnat_ind_base_subtype;
tree gnu_base_type = gnu_type;
! tree *gnu_index_type = (tree *) alloca (array_dim * sizeof (tree *));
tree gnu_comp_size = 0;
tree gnu_max_size = size_one_node;
tree gnu_max_size_unit;
--- 1687,1693 ----
Entity_Id gnat_ind_subtype;
Entity_Id gnat_ind_base_subtype;
tree gnu_base_type = gnu_type;
! tree *gnu_index_type = alloca (array_dim * sizeof (tree *));
tree gnu_comp_size = 0;
tree gnu_max_size = size_one_node;
tree gnu_max_size_unit;
*************** gnat_to_gnu_entity (gnat_entity, gnu_exp
*** 2691,2698 ****
fill it in later. */
if (! definition && defer_incomplete_level != 0)
{
! struct incomplete *p
! = (struct incomplete *) xmalloc (sizeof (struct incomplete));
gnu_type
= build_pointer_type
--- 2691,2697 ----
fill it in later. */
if (! definition && defer_incomplete_level != 0)
{
! struct incomplete *p = xmalloc (sizeof (struct incomplete));
gnu_type
= build_pointer_type
*************** gnat_to_gnu_entity (gnat_entity, gnu_exp
*** 2940,2947 ****
gnat_to_gnu_type (gnat_desig_type));
else
{
! struct incomplete *p
! = (struct incomplete *) xmalloc (sizeof (struct incomplete));
p->old_type = gnu_old_type;
p->full_type = gnat_desig_type;
--- 2939,2945 ----
gnat_to_gnu_type (gnat_desig_type));
else
{
! struct incomplete *p = xmalloc (sizeof (struct incomplete));
p->old_type = gnu_old_type;
p->full_type = gnat_desig_type;
*************** gnat_to_gnu_entity (gnat_entity, gnu_exp
*** 2993,3000 ****
elaborate it later. */
if (! definition && defer_incomplete_level != 0)
{
! struct incomplete *p
! = (struct incomplete *) xmalloc (sizeof (struct incomplete));
tree gnu_ptr_type
= build_pointer_type
(make_dummy_type (Directly_Designated_Type (gnat_entity)));
--- 2991,2997 ----
elaborate it later. */
if (! definition && defer_incomplete_level != 0)
{
! struct incomplete *p = xmalloc (sizeof (struct incomplete));
tree gnu_ptr_type
= build_pointer_type
(make_dummy_type (Directly_Designated_Type (gnat_entity)));
*************** gnat_to_gnu_entity (gnat_entity, gnu_exp
*** 3383,3390 ****
if (Convention (gnat_entity) == Convention_Stdcall)
{
! struct attrib *attr
! = (struct attrib *) xmalloc (sizeof (struct attrib));
attr->next = attr_list;
attr->type = ATTR_MACHINE_ATTRIBUTE;
--- 3380,3386 ----
if (Convention (gnat_entity) == Convention_Stdcall)
{
! struct attrib *attr = xmalloc (sizeof (struct attrib));
attr->next = attr_list;
attr->type = ATTR_MACHINE_ATTRIBUTE;
*************** build_attr_list (gnat_entity)
*** 4186,4192 ****
continue;
}
! attr = (struct attrib *) xmalloc (sizeof (struct attrib));
attr->next = attr_list;
attr->type = etype;
attr->name = gnu_arg0;
--- 4182,4188 ----
continue;
}
! attr = xmalloc (sizeof (struct attrib));
attr->next = attr_list;
attr->type = etype;
attr->name = gnu_arg0;
*************** components_to_record (gnu_record_type, c
*** 5217,5223 ****
tree gnu_rep_type
= gnu_field_list == 0 ? gnu_record_type : make_node (RECORD_TYPE);
int len = list_length (gnu_our_rep_list);
! tree *gnu_arr = (tree *) alloca (sizeof (tree) * len);
int i;
/* Set DECL_SECTION_NAME to increasing integers so we have a
--- 5213,5219 ----
tree gnu_rep_type
= gnu_field_list == 0 ? gnu_record_type : make_node (RECORD_TYPE);
int len = list_length (gnu_our_rep_list);
! tree *gnu_arr = alloca (sizeof (tree) * len);
int i;
/* Set DECL_SECTION_NAME to increasing integers so we have a
Index: gcc/ada/gnatbl.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/ada/gnatbl.c,v
retrieving revision 1.4
diff -c -3 -p -r1.4 gnatbl.c
*** gcc/ada/gnatbl.c 23 Oct 2002 07:33:25 -0000 1.4
--- gcc/ada/gnatbl.c 15 Nov 2002 21:18:13 -0000
*************** addarg (str)
*** 85,91 ****
if (++link_arg_index >= link_arg_max)
{
char **new_link_args
! = (char **) xcalloc (link_arg_max + 1000, sizeof (char *));
for (i = 0; i <= link_arg_max; i++)
new_link_args[i] = link_args[i];
--- 85,91 ----
if (++link_arg_index >= link_arg_max)
{
char **new_link_args
! = xcalloc (link_arg_max + 1000, sizeof (char *));
for (i = 0; i <= link_arg_max; i++)
new_link_args[i] = link_args[i];
Index: gcc/ada/init.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/ada/init.c,v
retrieving revision 1.11
diff -c -3 -p -r1.11 init.c
*** gcc/ada/init.c 23 Oct 2002 07:33:26 -0000 1.11
--- gcc/ada/init.c 15 Nov 2002 21:18:15 -0000
*************** __gnat_error_handler (sig, code, sc)
*** 1046,1052 ****
mstate = (*Get_Machine_State_Addr)();
if (mstate != 0)
! memcpy ((void *) mstate, (const void *) sc, sizeof (sigcontext_t));
Raise_From_Signal_Handler (exception, msg);
--- 1046,1052 ----
mstate = (*Get_Machine_State_Addr)();
if (mstate != 0)
! memcpy (mstate, sc, sizeof (sigcontext_t));
Raise_From_Signal_Handler (exception, msg);
*************** __gnat_install_handler ()
*** 1461,1467 ****
long prvhnd;
char *c;
! c = (char *) xmalloc (2049);
__gnat_error_prehandler_stack = &c[2048];
--- 1461,1467 ----
long prvhnd;
char *c;
! c = xmalloc (2049);
__gnat_error_prehandler_stack = &c[2048];
Index: gcc/ada/misc.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/ada/misc.c,v
retrieving revision 1.44
diff -c -3 -p -r1.44 misc.c
*** gcc/ada/misc.c 30 Oct 2002 17:42:53 -0000 1.44
--- gcc/ada/misc.c 15 Nov 2002 21:18:16 -0000
*************** gnat_decode_option (argc, argv)
*** 240,246 ****
{
/* Recopy the switches without the 'gnat' prefix */
! gnat_argv[gnat_argc] = (char *) xmalloc (strlen (p) - 3);
gnat_argv[gnat_argc][0] = '-';
strcpy (gnat_argv[gnat_argc] + 1, p + 5);
gnat_argc ++;
--- 240,246 ----
{
/* Recopy the switches without the 'gnat' prefix */
! gnat_argv[gnat_argc] = xmalloc (strlen (p) - 3);
gnat_argv[gnat_argc][0] = '-';
strcpy (gnat_argv[gnat_argc] + 1, p + 5);
gnat_argc ++;
*************** static void
*** 281,287 ****
gnat_init_options ()
{
/* Initialize gnat_argv with save_argv size */
! gnat_argv = (char **) xmalloc ((save_argc + 1) * sizeof (gnat_argv[0]));
gnat_argv[0] = save_argv[0]; /* name of the command */
gnat_argc = 1;
}
--- 281,287 ----
gnat_init_options ()
{
/* Initialize gnat_argv with save_argv size */
! gnat_argv = xmalloc ((save_argc + 1) * sizeof (gnat_argv[0]));
gnat_argv[0] = save_argv[0]; /* name of the command */
gnat_argc = 1;
}
Index: gcc/ada/trans.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/ada/trans.c,v
retrieving revision 1.22
diff -c -3 -p -r1.22 trans.c
*** gcc/ada/trans.c 5 Nov 2002 00:49:44 -0000 1.22
--- gcc/ada/trans.c 15 Nov 2002 21:18:22 -0000
*************** tree_transform (gnat_node)
*** 608,614 ****
by the expander. */
String_Id gnat_string = Strval (gnat_node);
int length = String_Length (gnat_string);
! char *string = (char *) alloca (length + 1);
int i;
/* Build the string with the characters in the literal. Note
--- 608,614 ----
by the expander. */
String_Id gnat_string = Strval (gnat_node);
int length = String_Length (gnat_string);
! char *string = alloca (length + 1);
int i;
/* Build the string with the characters in the literal. Note
*************** tree_transform (gnat_node)
*** 848,854 ****
ndim++, gnu_type = TREE_TYPE (gnu_type))
;
! gnat_expr_array = (Node_Id *) alloca (ndim * sizeof (Node_Id));
if (TYPE_CONVENTION_FORTRAN_P (TREE_TYPE (gnu_array_object)))
for (i = ndim - 1, gnat_temp = First (Expressions (gnat_node));
--- 848,854 ----
ndim++, gnu_type = TREE_TYPE (gnu_type))
;
! gnat_expr_array = alloca (ndim * sizeof (Node_Id));
if (TYPE_CONVENTION_FORTRAN_P (TREE_TYPE (gnu_array_object)))
for (i = ndim - 1, gnat_temp = First (Expressions (gnat_node));
Index: gcc/ada/utils.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/ada/utils.c,v
retrieving revision 1.22
diff -c -3 -p -r1.22 utils.c
*** gcc/ada/utils.c 23 Oct 2002 07:33:34 -0000 1.22
--- gcc/ada/utils.c 15 Nov 2002 21:18:26 -0000
*************** build_vms_descriptor (type, mech, gnat_e
*** 2245,2251 ****
ndim++, inner_type = TREE_TYPE (inner_type))
;
! idx_arr = (tree *) alloca (ndim * sizeof (tree));
if (mech != By_Descriptor_NCA
&& TREE_CODE (type) == ARRAY_TYPE && TYPE_CONVENTION_FORTRAN_P (type))
--- 2245,2251 ----
ndim++, inner_type = TREE_TYPE (inner_type))
;
! idx_arr = alloca (ndim * sizeof (tree));
if (mech != By_Descriptor_NCA
&& TREE_CODE (type) == ARRAY_TYPE && TYPE_CONVENTION_FORTRAN_P (type))