aboutsummaryrefslogtreecommitdiff
path: root/gcc/cpplib.c
diff options
context:
space:
mode:
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>1999-01-18 08:53:41 +0000
committerKaveh Ghazi <ghazi@gcc.gnu.org>1999-01-18 08:53:41 +0000
commit87e11268b6574b6002b6a8b9ba28531e4173273e (patch)
treeda93e20e14614c525df0a055e8e04e6c1e3306ba /gcc/cpplib.c
parent6b106e7db721422dc10e5efed084ffb146a1257e (diff)
downloadgcc-87e11268b6574b6002b6a8b9ba28531e4173273e.zip
gcc-87e11268b6574b6002b6a8b9ba28531e4173273e.tar.gz
gcc-87e11268b6574b6002b6a8b9ba28531e4173273e.tar.bz2
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
Diffstat (limited to 'gcc/cpplib.c')
-rw-r--r--gcc/cpplib.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/gcc/cpplib.c b/gcc/cpplib.c
index 1c0b6c5..aa343f5 100644
--- a/gcc/cpplib.c
+++ b/gcc/cpplib.c
@@ -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: