Rust: 1.27.0 Compiler Options: no-redzone option (Is the explanation backwards?)

Created on 20 Jun 2018  路  3Comments  路  Source: rust-lang/rust

In the 1.27.0 release of the "Rustc Book", the command-line option "no-redzone" is described as follows:

no-redzone

This flag allows you to disable the red zone. This flag can be passed many options:

To enable the red zone: y, yes or on.

To disable it: n, no, or off.

This sounds backwards. Should it be "no-redzone=yes" would disable the RedZone and "no-redzone=no" would enable the "RedZone"? If not, it seems like the command-line option is misnamed and should be "redzone" rather than "no-redzone".

C-enhancement P-medium T-compiler T-doc

Most helpful comment

I think we should name it redzone=yes/no _anyway_, a negative flag makes sense if it's a simple boolean with no arguments whose existence always means "no", but this is a flag to which you pass a yes/no, so it should either be -Cno-redzone, _or_ -Credzone=no/-Credzone=yes.

All 3 comments

And related, the target spec uses disable-redzone https://github.com/intermezzOS/kernel/blob/master/intermezzos.json#L12

I think we should name it redzone=yes/no _anyway_, a negative flag makes sense if it's a simple boolean with no arguments whose existence always means "no", but this is a flag to which you pass a yes/no, so it should either be -Cno-redzone, _or_ -Credzone=no/-Credzone=yes.

I personally believe a -Cno-redzone boolean flag would be the best way to go, as it clearly indicates that the default is that the redzone is present.

Was this page helpful?
0 / 5 - 0 ratings