Index: webrtc/base/annotations.h |
diff --git a/webrtc/base/annotations.h b/webrtc/base/annotations.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1097c5e68045fc18f607698a2bbd9641e18824aa |
--- /dev/null |
+++ b/webrtc/base/annotations.h |
@@ -0,0 +1,27 @@ |
+/* |
+ * Copyright 2017 The WebRTC Project Authors. All rights reserved. |
+ * |
+ * Use of this source code is governed by a BSD-style license |
+ * that can be found in the LICENSE file in the root of the source |
+ * tree. An additional intellectual property rights grant can be found |
+ * in the file PATENTS. All contributing project authors may |
+ * be found in the AUTHORS file in the root of the source tree. |
+ */ |
+ |
+#ifndef WEBRTC_BASE_ANNOTATIONS_H_ |
the sun
2017/03/14 20:07:00
Please introduce this in a separate CL so we can d
kwiberg-webrtc
2017/03/16 10:24:12
Would do, except I think following some of your ot
|
+#define WEBRTC_BASE_ANNOTATIONS_H_ |
+ |
+// Annotate function return values with this if you want to force callers to do |
+// something with the return value: |
+// |
+// RTC_WARN_UNUSED_RESULT(bool) SomethingThatMayFail(); |
+// ... |
+// SomethingThatMayFail(); // Warning! Ignoring the return value. |
+// if (SomethingThatMayFail()) { // OK! |
+#if defined(__GNUC__) |
+#define RTC_WARN_UNUSED_RESULT(t) t __attribute__((__warn_unused_result__)) |
+#else |
+#define RTC_WARN_UNUSED_RESULT(t) t |
+#endif |
+ |
+#endif // WEBRTC_BASE_ANNOTATIONS_H_ |