summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Keeler <dkeeler@mozilla.com>2017-03-14 15:58:04 -0700
committerDavid Keeler <dkeeler@mozilla.com>2017-03-14 15:58:04 -0700
commit8bcf512031e1cb1bfbd7119f6b57faa3f912dc63 (patch)
tree8bd461d0a9ee9d4da97dc27b05fbd6cb8257b5b3
parentdab73d77c9ffac01cd07a899f61ada48fccad2ab (diff)
downloadnss-hg-8bcf512031e1cb1bfbd7119f6b57faa3f912dc63.tar.gz
bug 1339921 - disable clang's shadowed field warning in a mozilla::pkix gtest class r=Cykesiopka,dholbert
pkixocsp_VerifyEncodedResponse_GetCertTrust has a field trustDomain that deliberately shadows the field it inherits from so that code doesn't use it by accident. MozReview-Commit-ID: 1Y4W6sA7lHD
-rw-r--r--lib/mozpkix/test/gtest/pkixocsp_VerifyEncodedOCSPResponse.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/mozpkix/test/gtest/pkixocsp_VerifyEncodedOCSPResponse.cpp b/lib/mozpkix/test/gtest/pkixocsp_VerifyEncodedOCSPResponse.cpp
index d7dab09d9..859698f5d 100644
--- a/lib/mozpkix/test/gtest/pkixocsp_VerifyEncodedOCSPResponse.cpp
+++ b/lib/mozpkix/test/gtest/pkixocsp_VerifyEncodedOCSPResponse.cpp
@@ -999,7 +999,23 @@ public:
TrustLevel certTrustLevel;
};
+// trustDomain deliberately shadows the inherited field so that it isn't used
+// by accident. See bug 1339921.
+// Unfortunately GCC can't parse __has_warning("-Wshadow-field") even if it's
+// the latter part of a conjunction that would evaluate to false, so we have to
+// wrap it in a separate preprocessor conditional rather than using &&.
+#if defined(__clang__)
+ #if __has_warning("-Wshadow-field")
+ #pragma clang diagnostic push
+ #pragma clang diagnostic ignored "-Wshadow-field"
+ #endif
+#endif
TrustDomain trustDomain;
+#if defined(__clang__)
+ #if __has_warning("-Wshadow-field")
+ #pragma clang diagnostic pop
+ #endif
+#endif
ByteString signerCertDER;
ByteString responseString;
Input response; // references data in responseString