/* Implement grant-file output & seize-file input for CHILL.
- Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998,
- 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
+ Free Software Foundation, Inc.
This file is part of GNU CC.
#include "tasking.h"
#include "toplev.h"
#include "output.h"
+#include "target.h"
#define APPEND(X,Y) X = append (X, Y)
#define PREPEND(X,Y) X = prepend (X, Y);
return result;
case REAL_CST:
-#ifndef REAL_IS_NOT_DOUBLE
- sprintf (wrk, "%.20g", TREE_REAL_CST (val));
-#else
REAL_VALUE_TO_DECIMAL (TREE_REAL_CST (val), "%.20g", wrk);
-#endif
APPEND (result, wrk);
return result;
if (!TREE_PUBLIC (decl) && DECL_NAME (decl) &&
(TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == FUNCTION_DECL))
{
- extern FILE *asm_out_file;
- extern char *first_global_object_name;
- const char *name = XSTR (XEXP (DECL_RTL (decl), 0), 0);
+ const char *name = XSTR (XEXP (DECL_RTL (decl), 0), 0);
if (!first_global_object_name)
first_global_object_name = name + (name[0] == '*');
fb = fopen (grant_file_name, "w");
if (fb == NULL)
- pfatal_with_name (grant_file_name);
+ fatal_io_error ("can't open %s", grant_file_name);
/* write file. Due to problems with record sizes on VAX/VMS
write string to '\n' */
if (write (fileno (fb), gstring->str, gstring->len) < 0)
{
int save_errno = errno;
+
unlink (grant_file_name);
errno = save_errno;
- pfatal_with_name (grant_file_name);
+ fatal_io_error ("can't write to %s", grant_file_name);
}
#endif
fclose (fb);
void
set_default_grant_file ()
{
- char *p, *tmp, *fname;
+ char *p, *tmp;
+ const char *fname;
if (dump_base_name)
fname = dump_base_name; /* Probably invoked via gcc */
}
/* this nerver should happen */
- error_with_decl (decl, "function \"really_grant_this\" called for `%s'.");
+ error_with_decl (decl, "function \"really_grant_this\" called for `%s'");
return 1;
}
\f
Perhaps rewrite this so nothing is done in pass 1. */
if (pass == 1)
{
- extern char *first_global_object_name;
/* If we don't do this spoof, we get the name of the first
tasking_code variable, and not the file name. */
- char *tmp = first_global_object_name;
-
+ char *q;
+ const char *tmp = first_global_object_name;
first_global_object_name = NULL;
chill_init_name = get_file_function_name ('I');
first_global_object_name = tmp;
+
/* strip off the file's extension, if any. */
- tmp = strrchr (IDENTIFIER_POINTER (chill_init_name), '.');
- if (tmp)
- *tmp = '\0';
+ q = strrchr (IDENTIFIER_POINTER (chill_init_name), '.');
+ if (q)
+ *q = '\0';
}
start_chill_function (chill_init_name, void_type_node, NULL_TREE,
finish_chill_function ();
- if (pass == 2)
- {
- assemble_constructor (IDENTIFIER_POINTER (chill_init_name));
- globalize_decl (chill_init_function);
- }
+ if (pass == 2 && targetm.have_ctors_dtors)
+ (* targetm.asm_out.constructor)
+ (XEXP (DECL_RTL (chill_init_function), 0), DEFAULT_INIT_PRIORITY);
/* ready now to link decls onto this list in pass 2. */
module_init_list = NULL_TREE;