public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] c++: Fix up -fcontract* options
@ 2022-11-21 23:00 Jakub Jelinek
  2022-11-22 15:09 ` Jason Merrill
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Jelinek @ 2022-11-21 23:00 UTC (permalink / raw)
  To: Jason Merrill; +Cc: gcc-patches

Hi!

I've noticed
+FAIL: compiler driver --help=c++ option(s): "^ +-.*[^:.]\$" absent from output: "  -fcontract-build-level=[off|default|audit] Specify max contract level to generate runtime checks for"
error, this is due to missing dot at the end of the description.

The second part of the first hunk should fix that, but while at it,
I find it weird that some options don't have RejectNegative, yet
for options that accept an argument a negative option looks weird
and isn't really handled.

Though, shall we have those [on|off] options at all?
Those are inconsistent with all other boolean options gcc has.
Every other boolean option is -fwhatever for it being on
and -fno-whatever for it being off, shouldn't the options be
without arguments and accept negatives (-fcontract-assumption-mode
vs. -fno-contract-assumption-mode etc.)?

2022-11-21  Jakub Jelinek  <jakub@redhat.com>

	* c.opt (fcontract-assumption-mode=, fcontract-continuation-mode=,
	fcontract-role=, fcontract-semantic=): Add RejectNegative.
	(fcontract-build-level=): Terminate description with dot.

--- gcc/c-family/c.opt.jj	2022-11-19 09:21:14.314444706 +0100
+++ gcc/c-family/c.opt	2022-11-21 23:51:55.605736499 +0100
@@ -1692,12 +1692,12 @@ EnumValue
 Enum(on_off) String(on) Value(1)
 
 fcontract-assumption-mode=
-C++ Joined
+C++ Joined RejectNegative
 -fcontract-assumption-mode=[on|off]	Enable or disable treating axiom level contracts as assumptions (default on).
 
 fcontract-build-level=
 C++ Joined RejectNegative
--fcontract-build-level=[off|default|audit]	Specify max contract level to generate runtime checks for
+-fcontract-build-level=[off|default|audit]	Specify max contract level to generate runtime checks for.
 
 fcontract-strict-declarations=
 C++ Var(flag_contract_strict_declarations) Enum(on_off) Joined Init(0) RejectNegative
@@ -1708,15 +1708,15 @@ C++ Var(flag_contract_mode) Enum(on_off)
 -fcontract-mode=[on|off]	Enable or disable all contract facilities (default on).
 
 fcontract-continuation-mode=
-C++ Joined
+C++ Joined RejectNegative
 -fcontract-continuation-mode=[on|off]	Enable or disable contract continuation mode (default off).
 
 fcontract-role=
-C++ Joined
+C++ Joined RejectNegative
 -fcontract-role=<name>:<semantics>	Specify the semantics for all levels in a role (default, review), or a custom contract role with given semantics (ex: opt:assume,assume,assume)
 
 fcontract-semantic=
-C++ Joined
+C++ Joined RejectNegative
 -fcontract-semantic=<level>:<semantic>	Specify the concrete semantics for level
 
 fcoroutines

	Jakub


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

* Re: [PATCH] c++: Fix up -fcontract* options
  2022-11-21 23:00 [PATCH] c++: Fix up -fcontract* options Jakub Jelinek
@ 2022-11-22 15:09 ` Jason Merrill
  2022-11-24 10:58   ` [committed] c++: Further -fcontract* option description fixes Jakub Jelinek
  0 siblings, 1 reply; 3+ messages in thread
From: Jason Merrill @ 2022-11-22 15:09 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

On 11/21/22 18:00, Jakub Jelinek wrote:
> Hi!
> 
> I've noticed
> +FAIL: compiler driver --help=c++ option(s): "^ +-.*[^:.]\$" absent from output: "  -fcontract-build-level=[off|default|audit] Specify max contract level to generate runtime checks for"
> error, this is due to missing dot at the end of the description.
> 
> The second part of the first hunk should fix that, but while at it,
> I find it weird that some options don't have RejectNegative, yet
> for options that accept an argument a negative option looks weird
> and isn't really handled.

OK.

> Though, shall we have those [on|off] options at all?
> Those are inconsistent with all other boolean options gcc has.
> Every other boolean option is -fwhatever for it being on
> and -fno-whatever for it being off, shouldn't the options be
> without arguments and accept negatives (-fcontract-assumption-mode
> vs. -fno-contract-assumption-mode etc.)?

True, but I think let's leave them alone for now, they'll probably all 
be replaced as the feature specification evolves.

> 2022-11-21  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* c.opt (fcontract-assumption-mode=, fcontract-continuation-mode=,
> 	fcontract-role=, fcontract-semantic=): Add RejectNegative.
> 	(fcontract-build-level=): Terminate description with dot.
> 
> --- gcc/c-family/c.opt.jj	2022-11-19 09:21:14.314444706 +0100
> +++ gcc/c-family/c.opt	2022-11-21 23:51:55.605736499 +0100
> @@ -1692,12 +1692,12 @@ EnumValue
>   Enum(on_off) String(on) Value(1)
>   
>   fcontract-assumption-mode=
> -C++ Joined
> +C++ Joined RejectNegative
>   -fcontract-assumption-mode=[on|off]	Enable or disable treating axiom level contracts as assumptions (default on).
>   
>   fcontract-build-level=
>   C++ Joined RejectNegative
> --fcontract-build-level=[off|default|audit]	Specify max contract level to generate runtime checks for
> +-fcontract-build-level=[off|default|audit]	Specify max contract level to generate runtime checks for.
>   
>   fcontract-strict-declarations=
>   C++ Var(flag_contract_strict_declarations) Enum(on_off) Joined Init(0) RejectNegative
> @@ -1708,15 +1708,15 @@ C++ Var(flag_contract_mode) Enum(on_off)
>   -fcontract-mode=[on|off]	Enable or disable all contract facilities (default on).
>   
>   fcontract-continuation-mode=
> -C++ Joined
> +C++ Joined RejectNegative
>   -fcontract-continuation-mode=[on|off]	Enable or disable contract continuation mode (default off).
>   
>   fcontract-role=
> -C++ Joined
> +C++ Joined RejectNegative
>   -fcontract-role=<name>:<semantics>	Specify the semantics for all levels in a role (default, review), or a custom contract role with given semantics (ex: opt:assume,assume,assume)
>   
>   fcontract-semantic=
> -C++ Joined
> +C++ Joined RejectNegative
>   -fcontract-semantic=<level>:<semantic>	Specify the concrete semantics for level
>   
>   fcoroutines
> 
> 	Jakub
> 


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

* [committed] c++: Further -fcontract* option description fixes
  2022-11-22 15:09 ` Jason Merrill
@ 2022-11-24 10:58   ` Jakub Jelinek
  0 siblings, 0 replies; 3+ messages in thread
From: Jakub Jelinek @ 2022-11-24 10:58 UTC (permalink / raw)
  To: Jason Merrill; +Cc: gcc-patches

On Tue, Nov 22, 2022 at 10:09:06AM -0500, Jason Merrill wrote:
> > Though, shall we have those [on|off] options at all?
> > Those are inconsistent with all other boolean options gcc has.
> > Every other boolean option is -fwhatever for it being on
> > and -fno-whatever for it being off, shouldn't the options be
> > without arguments and accept negatives (-fcontract-assumption-mode
> > vs. -fno-contract-assumption-mode etc.)?
> 
> True, but I think let's leave them alone for now, they'll probably all be
> replaced as the feature specification evolves.

If we don't want to support them for too long, another possibility
would be to use params for those instead of normal options,
params are understood to be more volatile than normal options and
can be removed easily (while for normal options we typically
keep them but error or them or silently ignore depending on what
the option is about).

Anyway, during testing I've missed my previous patch just changed:
-FAIL: compiler driver --help=c++ option(s): "^ +-.*[^:.]\$" absent from output: "  -fcontract-build-level=[off|default|audit] Specify max contract level to generate runtime checks for"
+FAIL: compiler driver --help=c++ option(s): "^ +-.*[^:.]\$" absent from output: "  -fcontract-role=<name>:<semantics> Specify the semantics for all levels in a role (default, review), or a custom contract role with given semantics (ex: opt:assume,assume,assume)"
rather than actually fixed it, the test only reports the first such problem.

This patch fixes the remaining ones.

Tested with make check-gcc RUNTESTFLAGS=help.exp and committed to trunk
as obvious.

2022-11-24  Jakub Jelinek  <jakub@redhat.com>

	* c.opt (fcontract-role=, fcontract-semantic=): Terminate descriptions
	with a dot.

--- gcc/c-family/c.opt.jj	2022-11-23 09:29:01.083548284 +0100
+++ gcc/c-family/c.opt	2022-11-24 11:42:29.582499720 +0100
@@ -1713,11 +1713,11 @@ C++ Joined RejectNegative
 
 fcontract-role=
 C++ Joined RejectNegative
--fcontract-role=<name>:<semantics>	Specify the semantics for all levels in a role (default, review), or a custom contract role with given semantics (ex: opt:assume,assume,assume)
+-fcontract-role=<name>:<semantics>	Specify the semantics for all levels in a role (default, review), or a custom contract role with given semantics (ex: opt:assume,assume,assume).
 
 fcontract-semantic=
 C++ Joined RejectNegative
--fcontract-semantic=<level>:<semantic>	Specify the concrete semantics for level
+-fcontract-semantic=<level>:<semantic>	Specify the concrete semantics for level.
 
 fcoroutines
 C++ LTO Var(flag_coroutines)

	Jakub


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

end of thread, other threads:[~2022-11-24 10:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-21 23:00 [PATCH] c++: Fix up -fcontract* options Jakub Jelinek
2022-11-22 15:09 ` Jason Merrill
2022-11-24 10:58   ` [committed] c++: Further -fcontract* option description fixes Jakub Jelinek

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).