diff options
author | hjk <hjk@qt.io> | 2022-07-01 12:04:15 +0200 |
---|---|---|
committer | hjk <hjk@qt.io> | 2022-07-07 17:53:23 +0200 |
commit | 6619c9408778b8607948e46079ddb369f750214f (patch) | |
tree | 26ebd534282db2652dd818a8f2a938ce5636fe4e /src | |
parent | e27a0d5a0f8818653ff125409db8187454409749 (diff) |
rcc: Suppress clang's -Wexit-time-destructors
It's an opt-in warning that some people like to use. It was introduced
to clang 3.0.0 in 2011 by
https://github.com/llvm/llvm-project/commit/98766db7858379f61d24d5d93b1b7be39fda0913
However, the feature is intentionally used here and the generated code is legit.
Make both sides happy.
Change-Id: I79335cd3a6a6cc128fa65f77d201a12f67424260
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/tools/rcc/rcc.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp index 1f641dd7e1..0eefeab065 100644 --- a/src/tools/rcc/rcc.cpp +++ b/src/tools/rcc/rcc.cpp @@ -1454,6 +1454,11 @@ bool RCCResourceLibrary::writeInitializer() writeString(" return 1;\n"); writeString("}\n\n"); + // -Wexit-time-destructors was added to clang 3.0.0 in 2011. + writeString("#ifdef __clang__\n" + "# pragma clang diagnostic push\n" + "# pragma clang diagnostic ignored \"-Wexit-time-destructors\"\n" + "#endif\n\n"); writeString("namespace {\n" " struct initializer {\n"); @@ -1466,7 +1471,12 @@ bool RCCResourceLibrary::writeInitializer() " ~initializer() { " + cleanResources + "(); }\n"); } writeString(" } dummy;\n" - "}\n"); + "}\n\n"); + + writeString("#ifdef __clang__\n" + "# pragma clang diagnostic pop\n" + "#endif\n"); + } else if (m_format == Binary) { int i = 4; |