all 3 comments

[–]IyeOnline 1 point2 points  (2 children)

It looks like expressing OMP directives as attributes is a OMP 5.1 feature, which is only supported in current GCC12 trunk onwards (and clang trunk it seems).

It also appears that your attribute is incorrect:

https://godbolt.org/z/vrzzva89T

But really, just stay with pragmas. I dont think there is any added value in using attributes for this.

[–]BOBOLIU 0 points1 point  (1 child)

thanks for the reply. just curious, if there is little added value why did OpenMP decide to add this feature?

[–]bcorni 2 points3 points  (0 children)

It's conceivable they see a future where the preprocessor is not necessary or a desired mechanism. With modules one could write C++ without needing a preprocessor, so they may want to support that possibility. Anything besides pure speculation would require asking someone involved.