Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/boringssl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Smith <brian@briansmith.org>2015-01-30 02:03:18 +0300
committerAdam Langley <agl@google.com>2015-04-13 23:32:26 +0300
commita039d702709621cd629a87b0f0836f8834c0b61a (patch)
treee7713391a7b5c44788e8eef70f3a2a0afacd122c /crypto/internal.h
parent1a9bc441270732fd89e2a2d268c122ade759d7f9 (diff)
Enable MSVC warning C4701, use of potentially uninitialized variable.
C4701 is "potentially uninitialized local variable 'buf' used". It sometimes results in false positives, which can now be suppressed using the macro OPENSSL_SUPPRESS_POTENTIALLY_UNINITIALIZED_WARNINGS. Change-Id: I15068b5a48e1c704702e7752982b9ead855e7633 Reviewed-on: https://boringssl-review.googlesource.com/3160 Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'crypto/internal.h')
-rw-r--r--crypto/internal.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/crypto/internal.h b/crypto/internal.h
index 38f9820e..e8f4ef7a 100644
--- a/crypto/internal.h
+++ b/crypto/internal.h
@@ -120,6 +120,27 @@ extern "C" {
#endif
+/* MSVC's C4701 warning about the use of *potentially*--as opposed to
+ * *definitely*--uninitialized values sometimes has false positives. Usually
+ * the false positives can and should be worked around by simplifying the
+ * control flow. When that is not practical, annotate the function containing
+ * the code that triggers the warning with
+ * OPENSSL_SUPPRESS_POTENTIALLY_UNINITIALIZED_WARNINGS after its parameters:
+ *
+ * void f() OPENSSL_SUPPRESS_POTENTIALLY_UNINITIALIZED_WARNINGS {
+ * ...
+ * }
+ *
+ * Note that MSVC's control flow analysis seems to operate on a whole-function
+ * basis, so the annotation must be placed on the entire function, not just a
+ * block within the function. */
+#if defined(_MSC_VER)
+#define OPENSSL_SUPPRESS_POTENTIALLY_UNINITIALIZED_WARNINGS \
+ __pragma(warning(suppress:4701))
+#else
+#define OPENSSL_SUPPRESS_POTENTIALLY_UNINITIALIZED_WARNINGS
+#endif
+
/* MSVC will sometimes correctly detect unreachable code and issue a warning,
* which breaks the build since we treat errors as warnings, in some rare cases
* where we want to allow the dead code to continue to exist. In these