From 7d71283c1ab34e906016b1ddfb74750c0594689d Mon Sep 17 00:00:00 2001 From: "Kaveh R. Ghazi" Date: Fri, 27 Jun 2008 16:55:06 +0000 Subject: [PATCH] ada-tree.h (SET_TYPE_LANG_SPECIFIC, [...]): Fix -Wc++-compat warnings. * ada-tree.h (SET_TYPE_LANG_SPECIFIC, SET_DECL_LANG_SPECIFIC): Fix -Wc++-compat warnings. * adaint.c (__gnat_locate_regular_file, __gnat_locate_exec, __gnat_locate_exec_on_path): Likewise. * decl.c (annotate_value): Likewise. * misc.c (gnat_handle_option): Likewise. * trans.c (gnat_to_gnu, extract_encoding, decode_name, post_error_ne_tree): Likewise. From-SVN: r137192 --- gcc/ada/ChangeLog | 11 +++++++++++ gcc/ada/ada-tree.h | 4 ++-- gcc/ada/adaint.c | 8 ++++---- gcc/ada/decl.c | 2 +- gcc/ada/misc.c | 4 ++-- gcc/ada/trans.c | 8 ++++---- 6 files changed, 24 insertions(+), 13 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 8b4389ae121..15ad6dcd4a2 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,14 @@ +2008-06-27 Kaveh R. Ghazi + + * ada-tree.h (SET_TYPE_LANG_SPECIFIC, SET_DECL_LANG_SPECIFIC): Fix + -Wc++-compat warnings. + * adaint.c (__gnat_locate_regular_file, __gnat_locate_exec, + __gnat_locate_exec_on_path): Likewise. + * decl.c (annotate_value): Likewise. + * misc.c (gnat_handle_option): Likewise. + * trans.c (gnat_to_gnu, extract_encoding, decode_name, + post_error_ne_tree): Likewise. + 2008-06-27 Eric Botcazou * utils.c (convert) : When converting it to a packable diff --git a/gcc/ada/ada-tree.h b/gcc/ada/ada-tree.h index 008a5a496e5..044cea811b3 100644 --- a/gcc/ada/ada-tree.h +++ b/gcc/ada/ada-tree.h @@ -39,7 +39,7 @@ struct lang_type GTY(()) {tree t; }; #define SET_TYPE_LANG_SPECIFIC(NODE, X) \ (TYPE_LANG_SPECIFIC (NODE) \ = (TYPE_LANG_SPECIFIC (NODE) \ - ? TYPE_LANG_SPECIFIC (NODE) : ggc_alloc (sizeof (struct lang_type)))) \ + ? TYPE_LANG_SPECIFIC (NODE) : GGC_NEW (struct lang_type))) \ ->t = X; #define GET_DECL_LANG_SPECIFIC(NODE) \ @@ -47,7 +47,7 @@ struct lang_type GTY(()) {tree t; }; #define SET_DECL_LANG_SPECIFIC(NODE, VALUE) \ (DECL_LANG_SPECIFIC (NODE) \ = (DECL_LANG_SPECIFIC (NODE) \ - ? DECL_LANG_SPECIFIC (NODE) : ggc_alloc (sizeof (struct lang_decl)))) \ + ? DECL_LANG_SPECIFIC (NODE) : GGC_NEW (struct lang_decl))) \ ->t = VALUE; /* Flags added to GCC type nodes. */ diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c index 391a424a094..8ace0a1c827 100644 --- a/gcc/ada/adaint.c +++ b/gcc/ada/adaint.c @@ -2147,7 +2147,7 @@ char * __gnat_locate_regular_file (char *file_name, char *path_val) { char *ptr; - char *file_path = alloca (strlen (file_name) + 1); + char *file_path = (char *) alloca (strlen (file_name) + 1); int absolute; /* Return immediately if file_name is empty */ @@ -2196,7 +2196,7 @@ __gnat_locate_regular_file (char *file_name, char *path_val) { /* The result has to be smaller than path_val + file_name. */ - char *file_path = alloca (strlen (path_val) + strlen (file_name) + 2); + char *file_path = (char *) alloca (strlen (path_val) + strlen (file_name) + 2); for (;;) { @@ -2245,7 +2245,7 @@ __gnat_locate_exec (char *exec_name, char *path_val) if (!strstr (exec_name, HOST_EXECUTABLE_SUFFIX)) { char *full_exec_name - = alloca (strlen (exec_name) + strlen (HOST_EXECUTABLE_SUFFIX) + 1); + = (char *) alloca (strlen (exec_name) + strlen (HOST_EXECUTABLE_SUFFIX) + 1); strcpy (full_exec_name, exec_name); strcat (full_exec_name, HOST_EXECUTABLE_SUFFIX); @@ -2298,7 +2298,7 @@ __gnat_locate_exec_on_path (char *exec_name) char *path_val = getenv ("PATH"); #endif if (path_val == NULL) return NULL; - apath_val = alloca (strlen (path_val) + 1); + apath_val = (char *) alloca (strlen (path_val) + 1); strcpy (apath_val, path_val); return __gnat_locate_exec (exec_name, apath_val); #endif diff --git a/gcc/ada/decl.c b/gcc/ada/decl.c index ff2927fe642..e6865d292bc 100644 --- a/gcc/ada/decl.c +++ b/gcc/ada/decl.c @@ -6774,7 +6774,7 @@ annotate_value (tree gnu_size) /* Save the result in the cache. */ if (h) { - *h = ggc_alloc (sizeof (struct tree_int_map)); + *h = GGC_NEW (struct tree_int_map); (*h)->base.from = gnu_size; (*h)->to = ret; } diff --git a/gcc/ada/misc.c b/gcc/ada/misc.c index f8137242175..85dd22e8bb3 100644 --- a/gcc/ada/misc.c +++ b/gcc/ada/misc.c @@ -232,7 +232,7 @@ gnat_handle_option (size_t scode, const char *arg, int value) switch (code) { case OPT_I: - q = xmalloc (sizeof("-I") + strlen (arg)); + q = XNEWVEC (char, sizeof("-I") + strlen (arg)); strcpy (q, "-I"); strcat (q, arg); gnat_argv[gnat_argc] = q; @@ -289,7 +289,7 @@ gnat_handle_option (size_t scode, const char *arg, int value) case OPT_gnat: /* Recopy the switches without the 'gnat' prefix. */ - gnat_argv[gnat_argc] = xmalloc (strlen (arg) + 2); + gnat_argv[gnat_argc] = XNEWVEC (char, strlen (arg) + 2); gnat_argv[gnat_argc][0] = '-'; strcpy (gnat_argv[gnat_argc] + 1, arg); gnat_argc++; diff --git a/gcc/ada/trans.c b/gcc/ada/trans.c index fd69b3eb7aa..89b10c695da 100644 --- a/gcc/ada/trans.c +++ b/gcc/ada/trans.c @@ -3273,7 +3273,7 @@ gnat_to_gnu (Node_Id gnat_node) int i; char *string; if (length >= ALLOCA_THRESHOLD) - string = xmalloc (length + 1); /* in case of large strings */ + string = XNEWVEC (char, length + 1); /* in case of large strings */ else string = (char *) alloca (length + 1); @@ -6922,7 +6922,7 @@ set_expr_location_from_node (tree node, Node_Id gnat_node) static const char * extract_encoding (const char *name) { - char *encoding = ggc_alloc (strlen (name)); + char *encoding = GGC_NEWVEC (char, strlen (name)); get_encoding (name, encoding); @@ -6934,7 +6934,7 @@ extract_encoding (const char *name) static const char * decode_name (const char *name) { - char *decoded = ggc_alloc (strlen (name) * 2 + 60); + char *decoded = GGC_NEWVEC (char, strlen (name) * 2 + 60); __gnat_decode (name, decoded, 0); @@ -6998,7 +6998,7 @@ post_error_ne_num (const char *msg, Node_Id node, Entity_Id ent, int n) void post_error_ne_tree (const char *msg, Node_Id node, Entity_Id ent, tree t) { - char *newmsg = alloca (strlen (msg) + 1); + char *newmsg = XALLOCAVEC (char, strlen (msg) + 1); String_Template temp = {1, 0}; Fat_Pointer fp; char start_yes, end_yes, start_no, end_no; -- 2.30.2