On 8/2/19 8:04 AM, Martin Liška wrote: > On 8/2/19 7:45 AM, Martin Liška wrote: >> I agree with that approach. > > I'm sending an example how it would look like for something > bigger: > > $ git diff > e8a3be407068bfb9c82f0f6656b30d26cc2f484a~15..e8a3be407068bfb9c82f0f6656b30d26cc2f484a > > patch && ./contrib/mklog patch > changelog.txt > > Thoughts? > > Martin >
Hello. I've reconsidered the ChangeLog format and I would like to "revert" my decision. I prefer to stay with the current format because: 1) each changelog entry can directly be copied to a ChangeLog file; no need for appending PRxxx and authors from the changelog 2) I have a working script that applies such patches to SVN: https://github.com/marxin/gcc-util/blob/master/boilerplate/applypatch.py If there's an interest, I can clean it up and suggest to contrib 3) I also have a script that extracts patch and changelog entries back to email message: https://github.com/marxin/script-misc/blob/master/gcc-extract-backport-patches.py That's handy for backporting where one wants to not have a ChangeLog collisions. Then I use applypatch.py --backport to apply extracted changes with 'Backport from mainline' header. What others do for patch application and back extracting for backport testing? I'm sending an example of patch backport for 2a245bc81b9e09cba4930d12d0417da229c37d67. Martin
>From 2a245bc81b9e09cba4930d12d0417da229c37d67 Mon Sep 17 00:00:00 2001 From: marxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Mon, 22 Jul 2019 07:34:10 +0000 Subject: Backport r273660 gcc/ChangeLog: 2019-07-22 Martin Liska <mli...@suse.cz> PR driver/91172 * opts-common.c (decode_cmdline_option): Decode argument of -Werror and check it for a wrong language. * opts-global.c (complain_wrong_lang): Remove such case. gcc/testsuite/ChangeLog: 2019-07-22 Martin Liska <mli...@suse.cz> PR driver/91172 * gcc.dg/pr91172.c: New test. --- diff --git a/gcc/opts-common.c b/gcc/opts-common.c index 660dfe63858..e3f9c549b10 100644 --- a/gcc/opts-common.c +++ b/gcc/opts-common.c @@ -537,7 +537,8 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask, extra_args = 0; - opt_index = find_opt (argv[0] + 1, lang_mask); + const char *opt_value = argv[0] + 1; + opt_index = find_opt (opt_value, lang_mask); i = 0; while (opt_index == OPT_SPECIAL_unknown && i < ARRAY_SIZE (option_map)) @@ -745,6 +746,23 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask, /* Check if this is a switch for a different front end. */ if (!option_ok_for_language (option, lang_mask)) errors |= CL_ERR_WRONG_LANG; + else if (strcmp (option->opt_text, "-Werror=") == 0 + && strchr (opt_value, ',') == NULL) + { + /* Verify that -Werror argument is a valid warning + for a language. */ + char *werror_arg = xstrdup (opt_value + 6); + werror_arg[0] = 'W'; + + size_t warning_index = find_opt (werror_arg, lang_mask); + if (warning_index != OPT_SPECIAL_unknown) + { + const struct cl_option *warning_option + = &cl_options[warning_index]; + if (!option_ok_for_language (warning_option, lang_mask)) + errors |= CL_ERR_WRONG_LANG; + } + } /* Convert the argument to lowercase if appropriate. */ if (arg && option->cl_tolower) diff --git a/gcc/opts-global.c b/gcc/opts-global.c index bf4db775928..7c5bd16c7ea 100644 --- a/gcc/opts-global.c +++ b/gcc/opts-global.c @@ -103,10 +103,14 @@ complain_wrong_lang (const struct cl_decoded_option *decoded, text, bad_lang); else if (lang_mask == CL_DRIVER) gcc_unreachable (); - else + else if (ok_langs[0] != '\0') /* Eventually this should become a hard error IMO. */ warning (0, "command-line option %qs is valid for %s but not for %s", text, ok_langs, bad_lang); + else + /* Happens for -Werror=warning_name. */ + warning (0, "%<-Werror=%> argument %qs is not valid for %s", + text, bad_lang); free (ok_langs); free (bad_lang); diff --git a/gcc/testsuite/gcc.dg/pr91172.c b/gcc/testsuite/gcc.dg/pr91172.c new file mode 100644 index 00000000000..a38a0580f4a --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr91172.c @@ -0,0 +1,3 @@ +/* { dg-do compile } */ +/* { dg-options "-Werror=target-lifetime" } */ +/* { dg-warning "'-Werror\=' argument '-Werror=target-lifetime' is not valid for C" "" { target *-*-* } 0 } */ -- 2.22.0