Fix build with GCC 12 (standard attributes in middle of decl-specifiers)

"static Q_REQUIRED_RESULT foo bar()" -> "Q_REQUIRED_RESULT static foo bar()"

(cherry picked from commit 0c2240f9)
2 jobs for release/21.12 in 3 minutes and 5 seconds (queued for 3 minutes and 3 seconds)