From 86373e7e611eed40d1d72b9cd34e4789c464c1ee Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Sat, 12 Sep 2009 15:46:45 -0400 Subject: [PATCH] dbgcnt.c (dbg_cnt_process_single_pair): constify. gcc/ * dbgcnt.c (dbg_cnt_process_single_pair): constify. * opts.c (common_handle_option): constify. gcc/cp/ * repo.c (extract_string, get_base_filename, init_repo): constify. libcpp/ * directives.c (cpp_define): constify. From-SVN: r151661 --- gcc/ChangeLog | 5 +++++ gcc/cp/ChangeLog | 4 ++++ gcc/cp/repo.c | 17 +++++++++-------- gcc/dbgcnt.c | 2 +- gcc/opts.c | 2 +- libcpp/ChangeLog | 4 ++++ libcpp/directives.c | 3 ++- 7 files changed, 26 insertions(+), 11 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 46c3f98..9a4cf3f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2009-09-10 Jason Merrill + + * dbgcnt.c (dbg_cnt_process_single_pair): constify. + * opts.c (common_handle_option): constify. + 2009-09-12 Gerald Pfeifer * doc/install.texi (avr): Remove obsolete reference site. diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index db2a892..d98d415 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +2009-09-10 Jason Merrill + + * repo.c (extract_string, get_base_filename, init_repo): constify. + 2009-09-09 Jason Merrill * error.c (find_typenames_r): Also add decltypes. diff --git a/gcc/cp/repo.c b/gcc/cp/repo.c index 0f531e2..aa97078 100644 --- a/gcc/cp/repo.c +++ b/gcc/cp/repo.c @@ -37,7 +37,7 @@ along with GCC; see the file COPYING3. If not see #include "diagnostic.h" #include "flags.h" -static char *extract_string (char **); +static const char *extract_string (const char **); static const char *get_base_filename (const char *); static FILE *open_repo_file (const char *); static char *afgets (FILE *); @@ -53,10 +53,10 @@ static bool temporary_obstack_initialized_p; /* Parse a reasonable subset of shell quoting syntax. */ -static char * -extract_string (char **pp) +static const char * +extract_string (const char **pp) { - char *p = *pp; + const char *p = *pp; int backquote = 0; int inside = 0; @@ -89,13 +89,13 @@ extract_string (char **pp) static const char * get_base_filename (const char *filename) { - char *p = getenv ("COLLECT_GCC_OPTIONS"); + const char *p = getenv ("COLLECT_GCC_OPTIONS"); const char *output = NULL; int compiling = 0; while (p && *p) { - char *q = extract_string (&p); + const char *q = extract_string (&p); if (strcmp (q, "-o") == 0) { @@ -161,6 +161,7 @@ void init_repo (void) { char *buf; + const char *p; FILE *repo_file; if (! flag_use_repository) @@ -212,8 +213,8 @@ init_repo (void) fclose (repo_file); if (old_args && !get_random_seed (true) - && (buf = strstr (old_args, "'-frandom-seed="))) - set_random_seed (extract_string (&buf) + strlen ("-frandom-seed=")); + && (p = strstr (old_args, "'-frandom-seed="))) + set_random_seed (extract_string (&p) + strlen ("-frandom-seed=")); } static FILE * diff --git a/gcc/dbgcnt.c b/gcc/dbgcnt.c index 0c496b3..3fe3485 100644 --- a/gcc/dbgcnt.c +++ b/gcc/dbgcnt.c @@ -101,7 +101,7 @@ dbg_cnt_set_limit_by_name (const char *name, int len, int value) static const char * dbg_cnt_process_single_pair (const char *arg) { - char *colon = strchr (arg, ':'); + const char *colon = strchr (arg, ':'); char *endptr = NULL; int value; diff --git a/gcc/opts.c b/gcc/opts.c index 601132e..878635f8 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -1512,7 +1512,7 @@ common_handle_option (size_t scode, const char *arg, int value, { NULL, 0 } }; unsigned int * pflags; - char * comma; + const char * comma; unsigned int lang_flag, specific_flag; unsigned int len; unsigned int i; diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 1b020ac..0331063 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,7 @@ +2009-09-10 Jason Merrill + + * directives.c (cpp_define): constify. + 2009-09-02 Ian Lance Taylor * macro.c (stringify_arg): Escape CPP_WCHAR tokens. diff --git a/libcpp/directives.c b/libcpp/directives.c index 9c988df..c5a1895 100644 --- a/libcpp/directives.c +++ b/libcpp/directives.c @@ -2156,7 +2156,8 @@ do_unassert (cpp_reader *pfile) void cpp_define (cpp_reader *pfile, const char *str) { - char *buf, *p; + char *buf; + const char *p; size_t count; /* Copy the entire option so we can modify it. -- 2.7.4