diff options
author | Nathan Sidwell <nathan@acm.org> | 2020-05-20 11:15:34 -0700 |
---|---|---|
committer | Nathan Sidwell <nathan@acm.org> | 2020-05-20 11:17:52 -0700 |
commit | c22027a00ede06e3f53170a82aa5b6af8697ddc4 (patch) | |
tree | f4ca1067bcafb8009bd9ed8db4c065d37c53f1c4 /gcc | |
parent | 2a8565fa1182ed326721a50c700f9f5275355d40 (diff) | |
download | gcc-c22027a00ede06e3f53170a82aa5b6af8697ddc4.zip gcc-c22027a00ede06e3f53170a82aa5b6af8697ddc4.tar.gz gcc-c22027a00ede06e3f53170a82aa5b6af8697ddc4.tar.bz2 |
preprocessor: cleanups in c-common handling
* c-common.c (try_to_locate_new_include_insertion_point): Use
strcmp to compare filenames.
* c-lex.c (init_c_lex): Move declaration to initialization.
* c-opts.c (handle_deferred_opts): Move cpp_get_deps call into
deferred count loop.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/c-family/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/c-family/c-common.c | 3 | ||||
-rw-r--r-- | gcc/c-family/c-lex.c | 3 | ||||
-rw-r--r-- | gcc/c-family/c-opts.c | 15 |
4 files changed, 18 insertions, 11 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index da4be41..90f022c 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,11 @@ +2020-05-20 Nathan Sidwell <nathan@acm.org> + + * c-common.c (try_to_locate_new_include_insertion_point): Use + strcmp to compare filenames. + * c-lex.c (init_c_lex): Move declaration to initialization. + * c-opts.c (handle_deferred_opts): Move cpp_get_deps call into + deferred count loop. + 2020-05-15 Jason Merrill <jason@redhat.com> * c-opts.c (set_std_cxx20): Set flag_coroutines. diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index b1379fa..10c0353 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -8708,7 +8708,8 @@ try_to_locate_new_include_insertion_point (const char *file, location_t loc) last_ord_map_after_include = NULL; } - if (ord_map->to_file == file) + if (0 == strcmp (ord_map->to_file, file) + && ord_map->to_line) { if (!first_ord_map_in_file) first_ord_map_in_file = ord_map; diff --git a/gcc/c-family/c-lex.c b/gcc/c-family/c-lex.c index f0fa968..b1cef23 100644 --- a/gcc/c-family/c-lex.c +++ b/gcc/c-family/c-lex.c @@ -60,7 +60,6 @@ static void cb_undef (cpp_reader *, unsigned int, cpp_hashnode *); void init_c_lex (void) { - struct cpp_callbacks *cb; struct c_fileinfo *toplevel; /* The get_fileinfo data structure must be initialized before @@ -73,7 +72,7 @@ init_c_lex (void) toplevel->time = body_time; } - cb = cpp_get_callbacks (parse_in); + struct cpp_callbacks *cb = cpp_get_callbacks (parse_in); cb->line_change = cb_line_change; cb->ident = cb_ident; diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c index 7695e88..8a5131b 100644 --- a/gcc/c-family/c-opts.c +++ b/gcc/c-family/c-opts.c @@ -1317,15 +1317,14 @@ handle_deferred_opts (void) if (!deps_seen) return; - mkdeps *deps = cpp_get_deps (parse_in); - - for (size_t i = 0; i < deferred_count; i++) - { - struct deferred_opt *opt = &deferred_opts[i]; + if (mkdeps *deps = cpp_get_deps (parse_in)) + for (unsigned i = 0; i < deferred_count; i++) + { + struct deferred_opt *opt = &deferred_opts[i]; - if (opt->code == OPT_MT || opt->code == OPT_MQ) - deps_add_target (deps, opt->arg, opt->code == OPT_MQ); - } + if (opt->code == OPT_MT || opt->code == OPT_MQ) + deps_add_target (deps, opt->arg, opt->code == OPT_MQ); + } } /* These settings are appropriate for GCC, but not necessarily so for |