From 15cd8be93e617f0ebee4e21ffa659193d8eff5bc Mon Sep 17 00:00:00 2001 From: Michael Hitchens Date: Mon, 2 May 2022 21:49:25 +0000 Subject: [PATCH] style: Update guidance on #include Can `#include ` in order to use `std::lock_guard`. However, the other types in this header aren't guaranteed to work for a given toolchain or OS. For types like std::mutex, pw_sync alternatives should be preferred. Bug: b/230744747 Change-Id: I782b02175e21a7729efd255a797ee8549541b03f Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/93221 Reviewed-by: Keir Mierle Reviewed-by: Wyatt Hepler Commit-Queue: Keir Mierle --- docs/style_guide.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/style_guide.rst b/docs/style_guide.rst index 0cb1aa9ac4..19a9996933 100644 --- a/docs/style_guide.rst +++ b/docs/style_guide.rst @@ -128,6 +128,7 @@ Permitted Headers * ```` -- not all MCUs natively support atomic operations * ```` -- conversions to or from strings are disallowed * ```` -- do **not** use ``std::function`` + * ```` -- can use ``std::lock_guard``, prefer :ref:`module-pw_sync` * ```` -- for placement new * ```` -- be wary of code size with multiple template instantiations @@ -137,7 +138,7 @@ Permitted Headers * Dynamic containers (````, ````, ````, ````, etc.) * Streams (````, ````, ````, etc.) * ```` - * ````, ````, ```` + * ````, ```` * ```` * ```` * ````