summaryrefslogtreecommitdiff
path: root/gcc/toplev.c
diff options
context:
space:
mode:
authorgdr <gdr@138bc75d-0d04-0410-961f-82ee72b054a4>2006-01-29 15:37:20 +0000
committergdr <gdr@138bc75d-0d04-0410-961f-82ee72b054a4>2006-01-29 15:37:20 +0000
commiteb59413abc005b759d6c752b1d64e1f46aed9d72 (patch)
tree2c06dbf9a00955bfff48b2107bb0728a1f445bf1 /gcc/toplev.c
parentaa26ba4e29c7ab00bf36f1ace03f38b6a4c86a9b (diff)
downloadgcc-eb59413abc005b759d6c752b1d64e1f46aed9d72.tar.gz
* toplev.c (floor_log2, exact_log2): Don't define if __cplusplus.
(push_srcloc): Use XNEW. (init_asm_output, default_get_pch_validity): Use XNEWVEC. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@110372 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/toplev.c')
-rw-r--r--gcc/toplev.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/gcc/toplev.c b/gcc/toplev.c
index b03e91dc999..62c9b4ff937 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -516,6 +516,12 @@ read_integral_parameter (const char *p, const char *pname, const int defval)
return atoi (p);
}
+/* When compiling with a recent enough GCC, we use the GNU C "extern inline"
+ for floor_log2 and exact_log2; see toplev.h. That construct, however,
+ conflicts with the ISO C++ One Definition Rule. */
+
+#if !defined (__cplusplus)
+
/* Given X, an unsigned number, return the largest int Y such that 2**Y <= X.
If X is 0, return -1. */
@@ -566,6 +572,8 @@ exact_log2 (unsigned HOST_WIDE_INT x)
#endif
}
+#endif /* !defined (__cplusplus) */
+
/* Handler for fatal signals, such as SIGSEGV. These are transformed
into ICE messages, which is much more user friendly. In case the
error printer crashes, reset the signal to prevent infinite recursion. */
@@ -942,7 +950,7 @@ push_srcloc (const char *file, int line)
{
struct file_stack *fs;
- fs = xmalloc (sizeof (struct file_stack));
+ fs = XNEW (struct file_stack);
fs->location = input_location;
fs->next = input_file_stack;
#ifdef USE_MAPPED_LOCATION
@@ -1233,7 +1241,7 @@ init_asm_output (const char *name)
if (asm_file_name == 0)
{
int len = strlen (dump_base_name);
- char *dumpname = xmalloc (len + 6);
+ char *dumpname = XNEWVEC (char, len + 6);
memcpy (dumpname, dump_base_name, len + 1);
strip_off_ending (dumpname, len);
strcat (dumpname, ".s");
@@ -1299,7 +1307,7 @@ default_get_pch_validity (size_t *len)
if (option_affects_pch_p (i, &state))
*len += state.size;
- result = r = xmalloc (*len);
+ result = r = XNEWVEC (char, *len);
r[0] = flag_pic;
r[1] = flag_pie;
r += 2;