On Thu, Dec 15, 2022 at 11:14:10AM +0100, Thomas Schwinge wrote: > Hi! > > On 2022-12-15T08:53:13+0100, Richard Biener <richard.guent...@gmail.com> > wrote: > > On Wed, Dec 14, 2022 at 11:58 PM Thomas Schwinge > > <tho...@codesourcery.com> wrote: > >> On 2022-12-13T14:40:36+0100, Arthur Cohen <arthur.co...@embecosm.com> > >> wrote: > >> > We've also added one more commit, which only affects files inside the > >> > Rust front-end folder. This commit adds an experimental flag, which > >> > blocks the compilation of Rust code when not used. > >> > >> (That's commit r13-4675-gb07ef39ffbf4e77a586605019c64e2e070915ac3 > >> "gccrs: Add fatal_error when experimental flag is not present".) > >> > >> I noticed that GCC/Rust recently lost all LTO variants in torture > >> testing -- due to this commit. :-O > >> > >> OK to push the attached > >> "Make '-frust-incomplete-and-experimental-compiler-do-not-use' a 'Common' > >> option", > >> or should this be done differently? > > > > Just add 'LTO' to the option in lang.opt, like > > > > frust-incomplete-and-experimental-compiler-do-not-use > > Rust LTO Var(flag_rust_experimental) > > Enable experimental compilation of Rust files at your own risk > > That doesn't work; it's 'cc1' that is complaining here.
In that case it is a testsuite issue. I really think making such Rust option a common option is very much undesirable. We seem to have a problem in other testsuites too: grep ' valid for .*but not for' */*.log | sort -u gcc/gcc.log:/home/jakub/src/gcc/gcc/testsuite/gcc.dg/pragma-diag-6.c:2:30: warning: option '-Wnoexcept' is valid for C++/ObjC++ but not for C [-Wpragmas] gdc/gdc.log:cc1plus: warning: command-line option '-fextern-std=c++11' is valid for D but not for C++ gdc/gdc.log:cc1plus: warning: command-line option '-fpreview=in' is valid for D but not for C++ gfortran/gfortran.log:cc1: warning: command-line option '-fcheck=all' is valid for Fortran but not for C g++/g++.log:cc1: warning: command-line option '-nostdinc++' is valid for C++/ObjC++ but not for C g++/g++.log:cc1: warning: command-line option '-std=gnu++11' is valid for C++/ObjC++ but not for C g++/g++.log:cc1: warning: command-line option '-std=gnu++14' is valid for C++/ObjC++ but not for C g++/g++.log:cc1: warning: command-line option '-std=gnu++17' is valid for C++/ObjC++ but not for C g++/g++.log:cc1: warning: command-line option '-std=gnu++20' is valid for C++/ObjC++ but not for C g++/g++.log:cc1: warning: command-line option '-std=gnu++23' is valid for C++/ObjC++ but not for C g++/g++.log:cc1: warning: command-line option '-std=gnu++98' is valid for C++/ObjC++ but not for C rust/rust.log:cc1plus: warning: command-line option '-frust-incomplete-and-experimental-compiler-do-not-use' is valid for Rust but not for C++ rust/rust.log:cc1: warning: command-line option '-frust-incomplete-and-experimental-compiler-do-not-use' is valid for Rust but not for C (of course, some of them could be from tests that this valid for but not for messages work right, that is clearly the case of pragma-diag-6.c). In gcc/testsuite/lib/target-supports.exp (check_compile) we already determine extension for the check_compile snippet based on magic comments with default to .c (Rust nor Modula 2 don't have any, should that be changed?), shouldn't we at that point based on the language filter out known options that will not work? So, given the above, at least when in gdc testsuite and language is not D filter out -fextern-std=* and -fpreview=in, for gfortran testsuite and language not Fortran filter out -fcheck=all, when in g++ testsuite and language is not C++ filter out -nostdinc++, -std=gnu++* and when in rust testsuite and language is not Rust filter out -frust-incomplete-and-experimental-compiler-do-not-use ? Jakub