Hi! On 2025-06-05T10:42:00+0200, Tobias Burnus <tbur...@baylibre.com> wrote: > Currently, using the ISO version of C and C++ will disable the > OpenMP and OpenACC intrinsics, which is rather surprising. The > reason is that those imply -fno-nonansi-builtins and the > OpenMP/OpenACC are marked as non-ansi builtins. > > While the latter is true, -fopenmp/-fopenacc seems to be rather > orthogonal and should be regarded as category of their own, > uneffected by -std=c23 vs. -std=gnu23 or -std=c++23 vs. -std=gnu++23.
That rationale appears to make sense to me; this intends to handle these OpenACC, OpenMP ones similar to 'DEF_GCC_BUILTIN', 'DEF_SYNC_BUILTIN', for example. > Comments before I commit this patch? Can we please get test cases added for this? > builtins.def: Enable OpenMP/OpenACC builtins also with -fno-nonansi-builtins > > The -std=c.. and -std=c++.. imply -fno-nonansi-builtins, which disabled the > OpenMP/OpenACC intrinsics - but -fopenmp/-fopenacc builtin use should be > rather othogonal to the user's choice between -std=c... and -std=gnuc... > --- a/gcc/builtins.def > +++ b/gcc/builtins.def > @@ -217,6 +217,8 @@ along with GCC; see the file COPYING3. If not see > DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE, \ > false, true, true, ATTRS, false, \ > flag_openacc) > +/* Set NONANSI_P = false to enable the builtins also with > -fno-nonansi-builtins > + as -std=c++23 (which implies the former) and -fopenacc should be > othogonal. */ > #undef DEF_GOACC_BUILTIN_COMPILER > #define DEF_GOACC_BUILTIN_COMPILER(ENUM, NAME, TYPE, ATTRS) \ > DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE, \ You add the comment, but don't actually "Set NONANSI_P = false" here? > @@ -232,10 +234,12 @@ along with GCC; see the file COPYING3. If not see > (flag_openacc \ > || flag_openmp \ > || flag_tree_parallelize_loops > 1)) > +/* Set NONANSI_P = false to enable the builtins also with > -fno-nonansi-builtins > + as -std=c++23 (which implies the former) and -fopenmp should be > othogonal. */ > #undef DEF_GOMP_BUILTIN_COMPILER > #define DEF_GOMP_BUILTIN_COMPILER(ENUM, NAME, TYPE, ATTRS) \ > DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE, \ > - flag_openmp, true, true, ATTRS, false, flag_openmp) > + flag_openmp, true, false, ATTRS, false, flag_openmp) (... like you do here.) Also, is this really applicable to 'DEF_GOACC_BUILTIN_COMPILER', 'DEF_GOMP_BUILTIN_COMPILER' only, but not the other ones: 'DEF_GOACC_BUILTIN', 'DEF_GOACC_BUILTIN_ONLY', 'DEF_GOMP_BUILTIN'? Grüße Thomas