You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe
Currently, the compiler options edit box is empty, but there are some flags that may be useful to prefill. For instance:
Some compilers like rustc default to the oldest edition of the Rust language for backwards compatibility, while I would presume most folks would like to have access to the latest by default.
Other compilers use a language version default that changes over time (i.e. with different compiler versions) and also enables extensions by default, e.g. GCC for C. In particular, since GCC is the default C and C++ compiler, it may be best to be explicit and compile the language in its standard form.
There are other flags like warnings or optimizations that may be useful for the majority of users.
If a user needs other flags, then it is arguably faster to change the prefilled ones than type them from scratch (plus it serves as a quick reminder for those not using a particular toolchain every day and/or newcomers to a language).
On top of that, different users, depending on their use case / environment, may prefer different prefilled options. For instance, even if Compiler Explorer decided to provide a default set of C/C++ diagnostic flags like -Wall -Wextra, a given user may almost always want to enable -Wpedantic too.
This user-configurable aspect is useful for "general" usage (i.e. setting up the flags that one often uses for a given compiler/language across projects), as well as for usage tied to a particular project (where a user may want to match the flags their project uses, e.g. someone may set up a development environment with a browser with CE's config preset to match their current project).
Describe the solution you'd like
Prefilling the compiler options edit box with a predefined string per language/compiler from the user's config. The default string for that setting could be provided in the CE settings, e.g. Rust could prefill the edition (like it currently does implicitly via the overrides):
default_user_options=--edition 2021
Groups of options that may be worth considering for the default sets:
Standard / edition / language flags.
Warning / diagnostic flags.
Optimization flags.
For instance:
C (GCC, Clang, icc, icx...): -std=c17 -Wall -Wextra -O2
C++ (GCC, Clang, icc, icx...): -std=c++20 -Wall -Wextra -O2
C (MSVC): /std:c17 /permissive- /W4 /O2
C++ (MSVC): /std:c++20 /permissive- /W4 /O2
Rust (rustc): --edition=2021 -O
Different set of flags are not provided per version. If a user switches to another compiler version that may not support a given flag (typically flags like --edition, -std=, /std...), then the flags stay unchanged, a compiler error will be generated, and the user can decide to change the flags manually as needed. This avoids potential unexpected changed or confusion (e.g. #5349 and #3765 (comment)).
Describe alternatives you've considered
Not applicable.
Additional context
#3765 suggested prefilling --edition 2021 for Rust (only).
User-configurability of pre-filling was suggested in the (currently ongoing) discussion around flags, overrides and pre-filling at #3765 (comment) and then added here.
The text was updated successfully, but these errors were encountered:
It seems that #5001 addresses setting the C++ std version for Clang and GCC, but it doesn't work for MSVC. I would love it if there was a way I could set default std versions for all (major) compilers and not have to change the incompatible flags every time I change compilers.
ojeda
changed the title
[REQUEST]: Prefill compiler options edit box
[REQUEST]: Pre-fill user-configurable compiler options edit box
Aug 20, 2023
Yeah, I think letting users edit these defaults would be nice (even if the defaults are the empty set in many cases). There is an ongoing discussion about flags, overrides and pre-filling where I mentioned that a couple weeks ago (#3765 (comment)).
I have edited OP to include the user-editable parts and simplified the wording of the proposal.
Is your feature request related to a problem? Please describe
Currently, the compiler options edit box is empty, but there are some flags that may be useful to prefill. For instance:
Some compilers like
rustc
default to the oldest edition of the Rust language for backwards compatibility, while I would presume most folks would like to have access to the latest by default.Other compilers use a language version default that changes over time (i.e. with different compiler versions) and also enables extensions by default, e.g. GCC for C. In particular, since GCC is the default C and C++ compiler, it may be best to be explicit and compile the language in its standard form.
There are other flags like warnings or optimizations that may be useful for the majority of users.
If a user needs other flags, then it is arguably faster to change the prefilled ones than type them from scratch (plus it serves as a quick reminder for those not using a particular toolchain every day and/or newcomers to a language).
On top of that, different users, depending on their use case / environment, may prefer different prefilled options. For instance, even if Compiler Explorer decided to provide a default set of C/C++ diagnostic flags like
-Wall -Wextra
, a given user may almost always want to enable-Wpedantic
too.This user-configurable aspect is useful for "general" usage (i.e. setting up the flags that one often uses for a given compiler/language across projects), as well as for usage tied to a particular project (where a user may want to match the flags their project uses, e.g. someone may set up a development environment with a browser with CE's config preset to match their current project).
Describe the solution you'd like
Prefilling the compiler options edit box with a predefined string per language/compiler from the user's config. The default string for that setting could be provided in the CE settings, e.g. Rust could prefill the edition (like it currently does implicitly via the overrides):
default_user_options=--edition 2021
Groups of options that may be worth considering for the default sets:
For instance:
-std=c17 -Wall -Wextra -O2
-std=c++20 -Wall -Wextra -O2
/std:c17 /permissive- /W4 /O2
/std:c++20 /permissive- /W4 /O2
rustc
):--edition=2021 -O
Different set of flags are not provided per version. If a user switches to another compiler version that may not support a given flag (typically flags like
--edition
,-std=
,/std
...), then the flags stay unchanged, a compiler error will be generated, and the user can decide to change the flags manually as needed. This avoids potential unexpected changed or confusion (e.g. #5349 and #3765 (comment)).Describe alternatives you've considered
Not applicable.
Additional context
#3765 suggested prefilling
--edition 2021
for Rust (only).#5001 implemented overrides, which then triggered #5349 and #3765 (comment).
User-configurability of pre-filling was suggested in the (currently ongoing) discussion around flags, overrides and pre-filling at #3765 (comment) and then added here.
The text was updated successfully, but these errors were encountered: