options: Fix "Multiple different help strings" error diagnostic

This currently causes a confusing litany, for example:

    options.cc:3245:2: error: #error Multiple different help strings for Wunused-result:
     #error Multiple different help strings for Wunused-result:
      ^
    options.cc:3246:2: error: 'Warn' was not declared in this scope
      Warn if a caller of a function, marked with attribute warn_unused_result, does not use its return value.
      ^
    options.cc:3246:7: error: expected '}' before 'if'
      Warn if a caller of a function, marked with attribute warn_unused_result, does not use its return value.
           ^
    options.cc:3246:7: error: expected ',' or ';' before 'if'
    options.cc:3256:54: error: expected unqualified-id before ',' token
         (unsigned short) -1, 0, CLVC_INTEGER, 0, -1, -1 },
                                                          ^
    [going on for several thousands of lines]

Fixed:

    options.cc:3245:2: error: #error Multiple different help strings for Wunused-result:
     #error Multiple different help strings for Wunused-result:
      ^
    options.cc:3246:2: error: #error Warn if a caller of a function, marked with attribute warn_unused_result, does not use its return value.
     #error   Warn if a caller of a function, marked with attribute warn_unused_result, does not use its return value.
      ^
    options.cc:3247:2: error: #error TEST.
     #error   TEST.
      ^

Fix-up for r187437/commit 71caddc556
"optc-gen.awk: Error instead of warning for conflicting help".

	gcc/
	* optc-gen.awk <END>: Fix "Multiple different help strings" error
	diagnostic.
This commit is contained in:
Thomas Schwinge 2022-03-30 22:22:49 +02:00
parent 562d014efa
commit 6c0e264593
1 changed files with 5 additions and 2 deletions

View File

@ -316,9 +316,12 @@ for (i = 0; i < n_opts; i++) {
flags[i + 1] = flags[i] " " flags[i + 1];
if (help[i + 1] == "")
help[i + 1] = help[i]
else if (help[i] != "" && help[i + 1] != help[i])
else if (help[i] != "" && help[i + 1] != help[i]) {
print "#error Multiple different help strings for " \
opts[i] ":\n\t" help[i] "\n\t" help[i + 1]
opts[i] ":"
print "#error " help[i]
print "#error " help[i + 1]
}
i++;
back_chain[i] = "N_OPTS";