public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* make conflicting help text an error
@ 2012-05-13  9:05 Manuel López-Ibáñez
  2012-05-13 11:03 ` Joseph S. Myers
  2022-03-30 20:42 ` options: Fix "Multiple different help strings" error diagnostic " Thomas Schwinge
  0 siblings, 2 replies; 6+ messages in thread
From: Manuel López-Ibáñez @ 2012-05-13  9:05 UTC (permalink / raw)
  To: Gcc Patch List; +Cc: Joseph S. Myers, Arnaud Charlet

[-- Attachment #1: Type: text/plain, Size: 835 bytes --]

Hi,

These warnings are invisible when building but they may help to detect
if an option is duplicated somewhere else with different purpose , so
it would be better to make this an error,

Only 2 options in Ada trigger this warning, and their help text has no
effect, since it gest overridden by the ones in c.opt. Fixing this
properly would require language-specific namespace, so two options
with the same name in different languages can have completely
different help text (and Init() and other flags). Not something I am
planning to work on in the future.

OK?

2012-05-13  Manuel López-Ibáñez  <manu@gcc.gnu.org>

gcc/
	* optc-gen.awk: Error instead of warning for conflicting help.
ada/
	* gcc-interface/lang.opt (I): Comment out help text with no effect.
	(nostdinc): Comment out help text with no effect.

[-- Attachment #2: p.diff --]
[-- Type: application/octet-stream, Size: 1572 bytes --]

Index: gcc/optc-gen.awk
===================================================================
--- gcc/optc-gen.awk	(revision 187427)
+++ gcc/optc-gen.awk	(working copy)
@@ -186,13 +186,13 @@ for (i = 0; i < n_opts; i++) {
 	while( i + 1 != n_opts && opts[i] == opts[i + 1] ) {
 		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])
-			print "warning: multiple different help strings for " \
-				opts[i] ":\n\t" help[i] "\n\t" help[i + 1] \
-				| "cat 1>&2"
+			print "#error Multiple different help strings for " \
+				opts[i] ":\n\t" help[i] "\n\t" help[i + 1]
+				
 		i++;
 		back_chain[i] = "N_OPTS";
 		indices[opts[i]] = j;
 	}
 	j++;
Index: gcc/ada/gcc-interface/lang.opt
===================================================================
--- gcc/ada/gcc-interface/lang.opt	(revision 187427)
+++ gcc/ada/gcc-interface/lang.opt	(working copy)
@@ -46,11 +46,11 @@ Ada AdaWhy Alias(nostdinc)
 -no-standard-libraries
 Ada AdaWhy Alias(nostdlib)
 
 I
 Ada AdaWhy Joined Separate
--I <dir>.	Add <dir> to the end of the main source path
+; Documented in C but it should be: -I <dir>.	Add <dir> to the end of the main source path
 
 Wall
 Ada AdaWhy
 Enable most warning messages
 
@@ -58,11 +58,11 @@ k8
 Driver
 Synonym of -gnatk8
 
 nostdinc
 Ada AdaWhy RejectNegative
-Do not look for source files in standard path
+; Documented in C but it should be: Do not look for source files in standard path
 
 nostdlib
 Ada AdaWhy
 Do not look for object files in standard path
 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: make conflicting help text an error
  2012-05-13  9:05 make conflicting help text an error Manuel López-Ibáñez
@ 2012-05-13 11:03 ` Joseph S. Myers
  2022-03-30 21:09   ` options: Clarifications around option definition records' help texts (was: make conflicting help text an error) Thomas Schwinge
  2022-03-30 20:42 ` options: Fix "Multiple different help strings" error diagnostic " Thomas Schwinge
  1 sibling, 1 reply; 6+ messages in thread
From: Joseph S. Myers @ 2012-05-13 11:03 UTC (permalink / raw)
  To: Manuel López-Ibáñez; +Cc: Gcc Patch List, Arnaud Charlet

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: TEXT/PLAIN; charset=X-UNKNOWN, Size: 943 bytes --]

On Sun, 13 May 2012, Manuel López-Ibáñez wrote:

> Hi,
> 
> These warnings are invisible when building but they may help to detect
> if an option is duplicated somewhere else with different purpose , so
> it would be better to make this an error,
> 
> Only 2 options in Ada trigger this warning, and their help text has no
> effect, since it gest overridden by the ones in c.opt. Fixing this
> properly would require language-specific namespace, so two options
> with the same name in different languages can have completely
> different help text (and Init() and other flags). Not something I am
> planning to work on in the future.
> 
> OK?

This is OK.  I don't think we want to support different help strings for 
different languages; if an option is supported for multiple languages, we 
should have a generic description of that option that is correct for all 
of them.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* options: Fix "Multiple different help strings" error diagnostic (was: make conflicting help text an error)
  2012-05-13  9:05 make conflicting help text an error Manuel López-Ibáñez
  2012-05-13 11:03 ` Joseph S. Myers
@ 2022-03-30 20:42 ` Thomas Schwinge
  2022-03-31 17:17   ` Joseph Myers
  1 sibling, 1 reply; 6+ messages in thread
From: Thomas Schwinge @ 2022-03-30 20:42 UTC (permalink / raw)
  To: gcc-patches, Joseph S. Myers; +Cc: Manuel López-Ibáñez

[-- Attachment #1: Type: text/plain, Size: 1201 bytes --]

Hi!

On 2012-05-13T11:04:36+0200, Manuel López-Ibáñez <lopezibanez@gmail.com> wrote:
> These warnings are invisible when building but they may help to detect
> if an option is duplicated somewhere else with different purpose , so
> it would be better to make this an error,

ACK.

> --- gcc/optc-gen.awk  (revision 187427)
> +++ gcc/optc-gen.awk  (working copy)

>               else if (help[i] != "" && help[i + 1] != help[i])
> -                     print "warning: multiple different help strings for " \
> -                             opts[i] ":\n\t" help[i] "\n\t" help[i + 1] \
> -                             | "cat 1>&2"
> +                     print "#error Multiple different help strings for " \
> +                             opts[i] ":\n\t" help[i] "\n\t" help[i + 1]
> +

OK to push the attached 'options: Fix "Multiple different help strings"
error diagnostic'?


Grüße
 Thomas


-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-options-Fix-Multiple-different-help-strings-error-di.patch --]
[-- Type: text/x-diff, Size: 2572 bytes --]

From ab2f8ed4631ca94138ed0007a22e97a37f0311d3 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Wed, 30 Mar 2022 22:22:49 +0200
Subject: [PATCH] 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 71caddc5568f59a5990f39226f60979a7fe953ef
"optc-gen.awk: Error instead of warning for conflicting help".

	gcc/
	* optc-gen.awk <END>: Fix "Multiple different help strings" error
	diagnostic.
---
 gcc/optc-gen.awk | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/gcc/optc-gen.awk b/gcc/optc-gen.awk
index 8a66126141a..7774dfc38df 100644
--- a/gcc/optc-gen.awk
+++ b/gcc/optc-gen.awk
@@ -270,9 +270,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";
-- 
2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* options: Clarifications around option definition records' help texts (was: make conflicting help text an error)
  2012-05-13 11:03 ` Joseph S. Myers
@ 2022-03-30 21:09   ` Thomas Schwinge
  2022-03-31 17:18     ` Joseph Myers
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Schwinge @ 2022-03-30 21:09 UTC (permalink / raw)
  To: gcc-patches, Joseph S. Myers; +Cc: Manuel López-Ibáñez

[-- Attachment #1: Type: text/plain, Size: 1258 bytes --]

Hi!

On 2012-05-13T11:03:36+0000, "Joseph S. Myers" <joseph@codesourcery.com> wrote:
> On Sun, 13 May 2012, Manuel Lpez-Ibez wrote:
>> [an option is duplicated somewhere else]
>>
>> Only 2 options in Ada trigger this warning, and their help text has no
>> effect, since it gest overridden by the ones in c.opt. Fixing this
>> properly would require language-specific namespace, so two options
>> with the same name in different languages can have completely
>> different help text (and Init() and other flags). Not something I am
>> planning to work on in the future.

;-)

> I don't think we want to support different help strings for
> different languages; if an option is supported for multiple languages, we
> should have a generic description of that option that is correct for all
> of them.

To not just bury that in the email archives: OK to push the attached
"options: Clarifications around option definition records' help texts"?


Grüße
 Thomas


-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-options-Clarifications-around-option-definition-reco.patch --]
[-- Type: text/x-diff, Size: 1476 bytes --]

From d9cc0118898a7abdd1b7de515f0cc02b752aebec Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Wed, 30 Mar 2022 23:00:28 +0200
Subject: [PATCH] options: Clarifications around option definition records'
 help texts

	gcc/
	* doc/options.texi (Option file format): Clarifications around
	option definition records' help texts.
---
 gcc/doc/options.texi | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/gcc/doc/options.texi b/gcc/doc/options.texi
index d552b64d1f4..94dceaafbc5 100644
--- a/gcc/doc/options.texi
+++ b/gcc/doc/options.texi
@@ -160,6 +160,17 @@ used instead of the option's name and the text to the right of the
 tab forms the help text.  This allows you to elaborate on what type
 of argument the option takes.
 
+There is no support for different help texts for different languages.
+If an option is supported for multiple languages, use a generic
+description that is correct for all of them.
+
+If an option has multiple option definition records (in different
+front ends' @file{*.opt} files, and/or @file{gcc/common.opt}, for
+example), convention is to not duplicate the help text for each of
+them, but instead put a comment like @code{; documented in common.opt}
+in place of the help text for all but one of the multiple option
+definition records.
+
 @item
 A target mask record.  These records have one field of the form
 @samp{Mask(@var{x})}.  The options-processing script will automatically
-- 
2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: options: Fix "Multiple different help strings" error diagnostic (was: make conflicting help text an error)
  2022-03-30 20:42 ` options: Fix "Multiple different help strings" error diagnostic " Thomas Schwinge
@ 2022-03-31 17:17   ` Joseph Myers
  0 siblings, 0 replies; 6+ messages in thread
From: Joseph Myers @ 2022-03-31 17:17 UTC (permalink / raw)
  To: Thomas Schwinge; +Cc: gcc-patches, Manuel López-Ibáñez

On Wed, 30 Mar 2022, Thomas Schwinge wrote:

> > --- gcc/optc-gen.awk  (revision 187427)
> > +++ gcc/optc-gen.awk  (working copy)
> 
> >               else if (help[i] != "" && help[i + 1] != help[i])
> > -                     print "warning: multiple different help strings for " \
> > -                             opts[i] ":\n\t" help[i] "\n\t" help[i + 1] \
> > -                             | "cat 1>&2"
> > +                     print "#error Multiple different help strings for " \
> > +                             opts[i] ":\n\t" help[i] "\n\t" help[i + 1]
> > +
> 
> OK to push the attached 'options: Fix "Multiple different help strings"
> error diagnostic'?

OK.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: options: Clarifications around option definition records' help texts (was: make conflicting help text an error)
  2022-03-30 21:09   ` options: Clarifications around option definition records' help texts (was: make conflicting help text an error) Thomas Schwinge
@ 2022-03-31 17:18     ` Joseph Myers
  0 siblings, 0 replies; 6+ messages in thread
From: Joseph Myers @ 2022-03-31 17:18 UTC (permalink / raw)
  To: Thomas Schwinge; +Cc: gcc-patches, Manuel López-Ibáñez

On Wed, 30 Mar 2022, Thomas Schwinge wrote:

> > I don't think we want to support different help strings for
> > different languages; if an option is supported for multiple languages, we
> > should have a generic description of that option that is correct for all
> > of them.
> 
> To not just bury that in the email archives: OK to push the attached
> "options: Clarifications around option definition records' help texts"?

OK.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-03-31 17:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-13  9:05 make conflicting help text an error Manuel López-Ibáñez
2012-05-13 11:03 ` Joseph S. Myers
2022-03-30 21:09   ` options: Clarifications around option definition records' help texts (was: make conflicting help text an error) Thomas Schwinge
2022-03-31 17:18     ` Joseph Myers
2022-03-30 20:42 ` options: Fix "Multiple different help strings" error diagnostic " Thomas Schwinge
2022-03-31 17:17   ` Joseph Myers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).