From a8a6296417eba911db1840408e1738bea53deeb6 Mon Sep 17 00:00:00 2001 From: Dave Bort Date: Thu, 28 Sep 2023 17:52:46 -0700 Subject: [PATCH] [executorch] Work around an old GCC bug in memory_manager.h We were hitting https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81429 "maybe_unused attribute triggers syntax error when used on first argument to a constructor" when building with older versions of GCC, like v8.5.0 on our devvms. Rather than changing things everywhere by modifying compiler.h to avoid using `[[maybe_unused]]`, patch this one spot. It's deprecated anyway, and should go away soon. Differential Revision: [D49759354](https://our.internmc.facebook.com/intern/diff/D49759354/) [ghstack-poisoned] --- runtime/executor/memory_manager.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/runtime/executor/memory_manager.h b/runtime/executor/memory_manager.h index 778ec24b1fb..a080e3ef20e 100644 --- a/runtime/executor/memory_manager.h +++ b/runtime/executor/memory_manager.h @@ -63,7 +63,11 @@ class MemoryManager final { * TODO(T162089316): Remove this once all users migrate to the new ctor. */ __ET_DEPRECATED MemoryManager( - __ET_UNUSED MemoryAllocator* constant_allocator, + // We would normally use __ET_UNUSED here, but GCC older than 9.3 has a + // bug that triggers a syntax error when using [[maybe_unused]] on the + // first parameter of a constructor: + // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81429 + __attribute__((unused)) MemoryAllocator* constant_allocator, HierarchicalAllocator* non_constant_allocator, MemoryAllocator* runtime_allocator, MemoryAllocator* kernel_temporary_allocator)