Commit 87e11268 by Kaveh R. Ghazi Committed by Kaveh Ghazi

cpplib.c (special_symbol): Qualify a char* with the `const' keyword.

        * cpplib.c (special_symbol): Qualify a char* with the `const' keyword.
        Instead of writing to const char *buf directly, use a non-const
        variable `wbuf' to allocate and write a string, then set buf = wbuf.
        * cppulp.c (user_label_prefix): Qualify a char* with the `const'
        keyword.
        * dyn-string.c (dyn_string_append): Likewise.
        * dyn-string.h (dyn_string_append): Likewise.
        * final.c (end_final, output_operand_lossage, asm_fprintf): Likewise.
        * output.h (end_final, output_operand_lossage, asm_fprintf,
        named_section, decode_reg_name, make_decl_rtl, user_label_prefix):
        Likewise.
        * profile.c (init_branch_prob): Likewise.
        * toplev.c (set_target_switch, vmessage,
        v_message_with_file_and_line, v_message_with_decl,
        v_error_with_file_and_line, v_error_with_decl, v_error_for_asm,
        verror, vfatal, v_warning_with_file_and_line, v_warning_with_decl,
        v_warning_for_asm, vwarning, vpedwarn, v_pedwarn_with_decl,
        v_pedwarn_with_file_and_line, vsorry, v_really_sorry,
        open_dump_file, dump_rtl, clean_dump_file,
        print_version, print_single_switch, print_switch_values,
        dump_base_name, debug_args, lang_independent_options,
        user_label_prefix, documented_lang_options, target_switches,
        target_options, print_time, pfatal_with_name, fatal_io_error,
        fatal_insn, default_print_error_function, print_error_function,
        report_error_function, error_with_file_and_line, error_with_decl,
        error_for_asm, error, fatal, warning_with_file_and_line,
        warning_with_decl, warning_for_asm, warning, pedwarn,
        pedwarn_with_decl, pedwarn_with_file_and_line, sorry,
        really_sorry, botch, output_quoted_string, output_file_directive,
        open_dump_file, rest_of_decl_compilation, display_help, main):
        Likewise.
        * toplev.h (print_time, fatal, fatal_io_error, pfatal_with_name,
        fatal_insn, warning, error, pedwarn, pedwarn_with_file_and_line,
        warning_with_file_and_line, error_with_file_and_line, sorry,
        really_sorry, default_print_error_function, report_error_function,
        rest_of_decl_compilation, pedwarn_with_decl, warning_with_decl,
        error_with_decl, error_for_asm, warning_for_asm, output_quoted_string,
        output_file_directive, botch): Likewise.
        * tree.h (make_decl_rtl): Likewise.
        * varasm.c (strip_reg_name, named_section, decode_reg_name,
        make_decl_rtl): Likewise.

From-SVN: r24743
parent 6b106e7d
Mon Jan 18 11:48:28 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* cpplib.c (special_symbol): Qualify a char* with the `const' keyword.
Instead of writing to const char *buf directly, use a non-const
variable `wbuf' to allocate and write a string, then set buf = wbuf.
* cppulp.c (user_label_prefix): Qualify a char* with the `const'
keyword.
* dyn-string.c (dyn_string_append): Likewise.
* dyn-string.h (dyn_string_append): Likewise.
* final.c (end_final, output_operand_lossage, asm_fprintf): Likewise.
* output.h (end_final, output_operand_lossage, asm_fprintf,
named_section, decode_reg_name, make_decl_rtl, user_label_prefix):
Likewise.
* profile.c (init_branch_prob): Likewise.
* toplev.c (set_target_switch, vmessage,
v_message_with_file_and_line, v_message_with_decl,
v_error_with_file_and_line, v_error_with_decl, v_error_for_asm,
verror, vfatal, v_warning_with_file_and_line, v_warning_with_decl,
v_warning_for_asm, vwarning, vpedwarn, v_pedwarn_with_decl,
v_pedwarn_with_file_and_line, vsorry, v_really_sorry,
open_dump_file, dump_rtl, clean_dump_file,
print_version, print_single_switch, print_switch_values,
dump_base_name, debug_args, lang_independent_options,
user_label_prefix, documented_lang_options, target_switches,
target_options, print_time, pfatal_with_name, fatal_io_error,
fatal_insn, default_print_error_function, print_error_function,
report_error_function, error_with_file_and_line, error_with_decl,
error_for_asm, error, fatal, warning_with_file_and_line,
warning_with_decl, warning_for_asm, warning, pedwarn,
pedwarn_with_decl, pedwarn_with_file_and_line, sorry,
really_sorry, botch, output_quoted_string, output_file_directive,
open_dump_file, rest_of_decl_compilation, display_help, main):
Likewise.
* toplev.h (print_time, fatal, fatal_io_error, pfatal_with_name,
fatal_insn, warning, error, pedwarn, pedwarn_with_file_and_line,
warning_with_file_and_line, error_with_file_and_line, sorry,
really_sorry, default_print_error_function, report_error_function,
rest_of_decl_compilation, pedwarn_with_decl, warning_with_decl,
error_with_decl, error_for_asm, warning_for_asm, output_quoted_string,
output_file_directive, botch): Likewise.
* tree.h (make_decl_rtl): Likewise.
* varasm.c (strip_reg_name, named_section, decode_reg_name,
make_decl_rtl): Likewise.
Mon Jan 18 11:35:49 1999 Gavin Romig-Koch <gavin@cygnus.com>
* Makefile.in (TCL_LIBRARY): Use 'cd' to find the library
......
......@@ -2054,7 +2054,8 @@ special_symbol (hp, pfile)
HASHNODE *hp;
cpp_reader *pfile;
{
char *buf;
const char *buf;
char *wbuf;
int len;
int true_indepth;
cpp_buffer *ip = NULL;
......@@ -2108,13 +2109,15 @@ special_symbol (hp, pfile)
if (ip->fname != NULL)
true_indepth++;
buf = (char *) alloca (8); /* Eight bytes ought to be more than enough */
sprintf (buf, "%d", true_indepth - 1);
wbuf = (char *) alloca (8); /* Eight bytes ought to be more than enough*/
sprintf (wbuf, "%d", true_indepth - 1);
buf = wbuf;
break;
case T_VERSION:
buf = (char *) alloca (3 + strlen (version_string));
sprintf (buf, "\"%s\"", version_string);
wbuf = (char *) alloca (3 + strlen (version_string));
sprintf (wbuf, "\"%s\"", version_string);
buf = wbuf;
break;
#ifndef NO_BUILTIN_SIZE_TYPE
......@@ -2142,19 +2145,20 @@ special_symbol (hp, pfile)
break;
case T_CONST:
buf = (char *) alloca (4 * sizeof (int));
sprintf (buf, "%d", hp->value.ival);
wbuf = (char *) alloca (4 * sizeof (int));
sprintf (wbuf, "%d", hp->value.ival);
#ifdef STDC_0_IN_SYSTEM_HEADERS
if (ip->system_header_p
&& hp->length == 8 && bcmp (hp->name, "__STDC__", 8) == 0
&& ! cpp_lookup (pfile, (U_CHAR *) "__STRICT_ANSI__", -1, -1))
strcpy (buf, "0");
strcpy (wbuf, "0");
#endif
#if 0
if (pcp_inside_if && pcp_outfile)
/* Output a precondition for this macro use */
fprintf (pcp_outfile, "#define %s %d\n", hp->name, hp->value.ival);
#endif
buf = wbuf;
break;
case T_SPECLINE:
......@@ -2163,21 +2167,23 @@ special_symbol (hp, pfile)
long col = ip->colno;
adjust_position (CPP_LINE_BASE (ip), ip->cur, &line, &col);
buf = (char *) alloca (10);
sprintf (buf, "%ld", line);
wbuf = (char *) alloca (10);
sprintf (wbuf, "%ld", line);
buf = wbuf;
}
break;
case T_DATE:
case T_TIME:
buf = (char *) alloca (20);
wbuf = (char *) alloca (20);
timebuf = timestamp (pfile);
if (hp->type == T_DATE)
sprintf (buf, "\"%s %2d %4d\"", monthnames[timebuf->tm_mon],
sprintf (wbuf, "\"%s %2d %4d\"", monthnames[timebuf->tm_mon],
timebuf->tm_mday, timebuf->tm_year + 1900);
else
sprintf (buf, "\"%02d:%02d:%02d\"", timebuf->tm_hour, timebuf->tm_min,
sprintf (wbuf, "\"%02d:%02d:%02d\"", timebuf->tm_hour, timebuf->tm_min,
timebuf->tm_sec);
buf = wbuf;
break;
case T_SPEC_DEFINED:
......
/* CPP Library.
Copyright (C) 1986, 87, 89, 92-97, 1998 Free Software Foundation, Inc.
Copyright (C) 1986, 87, 89, 92-98, 1999 Free Software Foundation, Inc.
Contributed by Per Bothner, 1994-95.
Based on CCCP program by Paul Rubin, June 1986
Adapted to ANSI C, Richard Stallman, Jan 1987
......@@ -23,4 +23,4 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "output.h"
char *user_label_prefix = 0;
const char *user_label_prefix = 0;
/* An abstract string datatype.
Copyright (C) 1998 Free Software Foundation, Inc.
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
Contributed by Mark Mitchell (mark@markmitchell.com).
This file is part of GNU CC.
......@@ -62,7 +62,7 @@ dyn_string_delete (ds)
dyn_string_t
dyn_string_append (ds, s)
dyn_string_t ds;
char *s;
const char *s;
{
int len = strlen (s);
dyn_string_resize (ds, ds->length + len + 1 /* '\0' */);
......
/* An abstract string datatype.
Copyright (C) 1998 Free Software Foundation, Inc.
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
Contributed by Mark Mitchell (mark@markmitchell.com).
This file is part of GNU CC.
......@@ -28,5 +28,5 @@ typedef struct dyn_string
extern dyn_string_t dyn_string_new PROTO((int));
extern void dyn_string_delete PROTO((dyn_string_t));
extern dyn_string_t dyn_string_append PROTO((dyn_string_t, char*));
extern dyn_string_t dyn_string_append PROTO((dyn_string_t, const char*));
extern dyn_string_t dyn_string_resize PROTO((dyn_string_t, int));
/* Convert RTL to assembler code and output it, for GNU compiler.
Copyright (C) 1987, 88, 89, 92-97, 1998 Free Software Foundation, Inc.
Copyright (C) 1987, 88, 89, 92-98, 1999 Free Software Foundation, Inc.
This file is part of GNU CC.
......@@ -335,7 +335,7 @@ init_final (filename)
void
end_final (filename)
char *filename;
const char *filename;
{
int i;
......@@ -3300,7 +3300,7 @@ alter_cond (cond)
void
output_operand_lossage (str)
char *str;
const char *str;
{
if (this_is_asm_operands)
error_for_asm (this_is_asm_operands, "invalid `asm': %s", str);
......@@ -3680,11 +3680,11 @@ output_addr_const (file, x)
We handle alternate assembler dialects here, just like output_asm_insn. */
void
asm_fprintf VPROTO((FILE *file, char *p, ...))
asm_fprintf VPROTO((FILE *file, const char *p, ...))
{
#ifndef ANSI_PROTOTYPES
FILE *file;
char *p;
const char *p;
#endif
va_list argptr;
char buf[10];
......@@ -3694,7 +3694,7 @@ asm_fprintf VPROTO((FILE *file, char *p, ...))
#ifndef ANSI_PROTOTYPES
file = va_arg (argptr, FILE *);
p = va_arg (argptr, char *);
p = va_arg (argptr, const char *);
#endif
buf[0] = '%';
......
/* Declarations for insn-output.c. These functions are defined in recog.c,
final.c, and varasm.c.
Copyright (C) 1987, 1991, 1994, 1997, 1998 Free Software Foundation, Inc.
Copyright (C) 1987, 1991, 1994, 97-98, 1999 Free Software Foundation, Inc.
This file is part of GNU CC.
......@@ -24,7 +24,7 @@ extern void init_final PROTO((char *));
/* Called at end of source file,
to output the block-profiling table for this entire compilation. */
extern void end_final PROTO((char *));
extern void end_final PROTO((const char *));
/* Enable APP processing of subsequent output.
Used before the output from an `asm' statement. */
......@@ -77,7 +77,7 @@ extern rtx alter_subreg PROTO((rtx));
/* Report inconsistency between the assembler template and the operands.
In an `asm', it's the user's fault; otherwise, the compiler's fault. */
extern void output_operand_lossage PROTO((char *));
extern void output_operand_lossage PROTO((const char *));
/* Output a string of assembler code, substituting insn operands.
Defined in final.c. */
......@@ -106,7 +106,7 @@ extern void output_addr_const PROTO((FILE *, rtx));
/* Output a string of assembler code, substituting numbers, strings
and fixed syntactic prefixes. */
extern void asm_fprintf PROTO(PVPROTO((FILE *file, char *p, ...)));
extern void asm_fprintf PVPROTO((FILE *file, const char *p, ...));
/* Split up a CONST_DOUBLE or integer constant rtx into two rtx's for single
words. */
......@@ -161,7 +161,7 @@ extern void eh_frame_section PROTO ((void));
If DECL is NULL, just switch to section NAME.
If NAME is NULL, get the name from DECL.
If RELOC is 1, the initializer for DECL contains relocs. */
extern void named_section PROTO((tree, char *, int));
extern void named_section PROTO((tree, const char *, int));
/* Tell assembler to switch to the section for function DECL. */
extern void function_section PROTO((tree));
......@@ -188,7 +188,7 @@ extern void weak_finish PROTO ((void));
or -4 if ASMSPEC is `memory' and is not recognized.
Accept an exact spelling or a decimal number.
Prefixes such as % are optional. */
extern int decode_reg_name PROTO((char *));
extern int decode_reg_name PROTO((const char *));
#ifdef TREE_CODE
/* Create the DECL_RTL for a declaration for a static or external variable
......@@ -198,7 +198,7 @@ extern int decode_reg_name PROTO((char *));
TOP_LEVEL is nonzero if this is a file-scope variable.
This is never called for PARM_DECL nodes. */
extern void make_decl_rtl PROTO((tree, char *, int));
extern void make_decl_rtl PROTO((tree, const char *, int));
/* Make the rtl for variable VAR be volatile.
Use this only for static variables. */
......@@ -487,4 +487,4 @@ extern FILE *rtl_dump_file;
&& ! (RELOC && (flag_pic || DECL_ONE_ONLY (DECL))))
/* User label prefix in effect for this compilation. */
extern char *user_label_prefix;
extern const char *user_label_prefix;
/* Calculate branch probabilities, and basic block execution counts.
Copyright (C) 1990, 91-94, 96, 97, 1998 Free Software Foundation, Inc.
Copyright (C) 1990, 91-94, 96-98, 1999 Free Software Foundation, Inc.
Contributed by James E. Wilson, UC Berkeley/Cygnus Support;
based on some ideas from Dain Samples of UC Berkeley.
Further mangling by Bob Manson, Cygnus Support.
......@@ -1407,7 +1407,7 @@ expand_spanning_tree (block)
void
init_branch_prob (filename)
char *filename;
const char *filename;
{
long len;
int i;
......
/* Register Transfer Language (RTL) definitions for GNU C-Compiler
Copyright (C) 1987, 91-97, 1998 Free Software Foundation, Inc.
Copyright (C) 1987, 91-98, 1999 Free Software Foundation, Inc.
This file is part of GNU CC.
......@@ -1467,7 +1467,7 @@ extern int reload PROTO ((rtx, int, FILE *));
extern void init_caller_save PROTO ((void));
/* In profile.c */
extern void init_branch_prob PROTO ((char *));
extern void init_branch_prob PROTO ((const char *));
#ifdef BUFSIZ
extern void branch_prob PROTO ((rtx, FILE *));
extern void end_branch_prob PROTO ((FILE *));
......
......@@ -28,50 +28,64 @@ struct rtx_def;
extern int count_error PROTO ((int));
extern void strip_off_ending PROTO ((char *, int));
extern void print_time PROTO ((char *, int));
extern void print_time PROTO ((const char *, int));
extern void debug_start_source_file PROTO ((char *));
extern void debug_end_source_file PROTO ((unsigned));
extern void debug_define PROTO ((unsigned, char *));
extern void debug_undef PROTO ((unsigned, char *));
extern void fatal PVPROTO ((char *, ...))
extern void fatal PVPROTO ((const char *, ...))
ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
extern void fatal_io_error PROTO ((char *)) ATTRIBUTE_NORETURN;
extern void pfatal_with_name PROTO ((char *)) ATTRIBUTE_NORETURN;
extern void fatal_io_error PROTO ((const char *))
ATTRIBUTE_NORETURN;
extern void pfatal_with_name PROTO ((const char *))
ATTRIBUTE_NORETURN;
extern void fatal_insn_not_found PROTO ((struct rtx_def *))
ATTRIBUTE_NORETURN;
extern void fatal_insn PROTO ((char *, struct rtx_def *))
extern void fatal_insn PROTO ((const char *, struct rtx_def *))
ATTRIBUTE_NORETURN;
extern void warning PVPROTO ((char *, ...))
ATTRIBUTE_PRINTF_1;
extern void error PVPROTO ((char *, ...))
extern void warning PVPROTO ((const char *, ...))
ATTRIBUTE_PRINTF_1;
extern void pedwarn PVPROTO ((char *, ...))
extern void error PVPROTO ((const char *, ...))
ATTRIBUTE_PRINTF_1;
extern void pedwarn_with_file_and_line PVPROTO ((char *, int, char *, ...))
ATTRIBUTE_PRINTF_3;
extern void warning_with_file_and_line PVPROTO ((char *, int, char *, ...))
ATTRIBUTE_PRINTF_3;
extern void error_with_file_and_line PVPROTO ((char *, int, char *, ...))
ATTRIBUTE_PRINTF_3;
extern void sorry PVPROTO ((char *s, ...))
extern void pedwarn PVPROTO ((const char *, ...))
ATTRIBUTE_PRINTF_1;
extern void really_sorry PVPROTO((char *s, ...))
extern void pedwarn_with_file_and_line PVPROTO ((const char *, int,
const char *, ...))
ATTRIBUTE_PRINTF_3;
extern void warning_with_file_and_line PVPROTO ((const char *, int,
const char *, ...))
ATTRIBUTE_PRINTF_3;
extern void error_with_file_and_line PVPROTO ((const char *, int,
const char *, ...))
ATTRIBUTE_PRINTF_3;
extern void sorry PVPROTO ((const char *, ...))
ATTRIBUTE_PRINTF_1;
extern void really_sorry PVPROTO((const char *, ...))
ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
extern void default_print_error_function PROTO ((char *));
extern void report_error_function PROTO ((char *));
extern void default_print_error_function PROTO ((const char *));
extern void report_error_function PROTO ((const char *));
extern void rest_of_decl_compilation PROTO ((union tree_node *, char *, int, int));
extern void rest_of_decl_compilation PROTO ((union tree_node *,
const char *, int, int));
extern void rest_of_type_compilation PROTO ((union tree_node *, int));
extern void rest_of_compilation PROTO ((union tree_node *));
extern void pedwarn_with_decl PVPROTO ((union tree_node *, char *, ...));
extern void warning_with_decl PVPROTO ((union tree_node *, char *, ...));
extern void error_with_decl PVPROTO ((union tree_node *, char *, ...));
/* The *_with_decl functions aren't suitable for ATTRIBUTE_PRINTF. */
extern void pedwarn_with_decl PVPROTO ((union tree_node *,
const char *, ...));
extern void warning_with_decl PVPROTO ((union tree_node *,
const char *, ...));
extern void error_with_decl PVPROTO ((union tree_node *,
const char *, ...));
extern void announce_function PROTO ((union tree_node *));
extern void error_for_asm PVPROTO((struct rtx_def *, char *, ...))
ATTRIBUTE_PRINTF_2;
extern void warning_for_asm PVPROTO((struct rtx_def *, char *, ...))
ATTRIBUTE_PRINTF_2;
extern void error_for_asm PVPROTO((struct rtx_def *,
const char *, ...))
ATTRIBUTE_PRINTF_2;
extern void warning_for_asm PVPROTO((struct rtx_def *,
const char *, ...))
ATTRIBUTE_PRINTF_2;
#if defined (_JBLEN) || defined (setjmp)
extern void set_float_handler PROTO((jmp_buf));
extern int push_float_handler PROTO((jmp_buf, jmp_buf));
......@@ -79,12 +93,13 @@ extern void pop_float_handler PROTO((int, jmp_buf));
#endif
#ifdef BUFSIZ
extern void output_quoted_string PROTO ((FILE *, char *));
extern void output_file_directive PROTO ((FILE *, char *));
extern void output_quoted_string PROTO ((FILE *, const char *));
extern void output_file_directive PROTO ((FILE *, const char *));
#endif
extern void fancy_abort PROTO ((void)) ATTRIBUTE_NORETURN;
extern void do_abort PROTO ((void)) ATTRIBUTE_NORETURN;
extern void botch PROTO ((char *)) ATTRIBUTE_NORETURN;
extern void botch PROTO ((const char *))
ATTRIBUTE_NORETURN;
#endif /* __GCC_TOPLEV_H */
......@@ -2258,7 +2258,7 @@ extern void set_yydebug PROTO ((int));
extern void fixup_signed_type PROTO ((tree));
/* varasm.c */
extern void make_decl_rtl PROTO ((tree, char *, int));
extern void make_decl_rtl PROTO ((tree, const char *, int));
extern void make_decl_one_only PROTO ((tree));
extern int supports_one_only PROTO ((void));
extern void variable_section PROTO ((tree, int));
......
......@@ -125,7 +125,7 @@ struct constant_descriptor;
struct rtx_const;
struct pool_constant;
static char *strip_reg_name PROTO((char *));
static const char *strip_reg_name PROTO((const char *));
static int contains_pointers_p PROTO((tree));
static void decode_addr_const PROTO((tree, struct addr_const *));
static int const_hash PROTO((tree));
......@@ -263,7 +263,7 @@ in_data_section ()
void
named_section (decl, name, reloc)
tree decl;
char *name;
const char *name;
int reloc;
{
if (decl != NULL_TREE
......@@ -549,9 +549,9 @@ make_function_rtl (decl)
/* Given NAME, a putative register name, discard any customary prefixes. */
static char *
static const char *
strip_reg_name (name)
char *name;
const char *name;
{
#ifdef REGISTER_PREFIX
if (!strncmp (name, REGISTER_PREFIX, strlen (REGISTER_PREFIX)))
......@@ -572,7 +572,7 @@ strip_reg_name (name)
int
decode_reg_name (asmspec)
char *asmspec;
const char *asmspec;
{
if (asmspec != 0)
{
......@@ -601,7 +601,7 @@ decode_reg_name (asmspec)
#ifdef ADDITIONAL_REGISTER_NAMES
{
static struct { char *name; int number; } table[]
static struct { const char *name; int number; } table[]
= ADDITIONAL_REGISTER_NAMES;
for (i = 0; i < (int)(sizeof (table) / sizeof (table[0])); i++)
......@@ -633,7 +633,7 @@ decode_reg_name (asmspec)
void
make_decl_rtl (decl, asmspec, top_level)
tree decl;
char *asmspec;
const char *asmspec;
int top_level;
{
register char *name = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment