Add compiler_support.h (#25274)

This commit is contained in:
Pablo Martínez 2025-05-22 15:31:15 +02:00 committed by GitHub
parent fa24b0fcce
commit 955809bd5a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
36 changed files with 142 additions and 81 deletions

View file

@ -15,17 +15,19 @@
*/
#pragma once
#include "compiler_support.h"
// Macro to help make GPIO and other controls atomic.
#ifndef IGNORE_ATOMIC_BLOCK
# if __has_include_next("atomic_util.h")
# include_next "atomic_util.h" /* Include the platforms atomic.h */
# else
# define ATOMIC_BLOCK _Static_assert(0, "ATOMIC_BLOCK not implemented")
# define ATOMIC_BLOCK_RESTORESTATE _Static_assert(0, "ATOMIC_BLOCK_RESTORESTATE not implemented")
# define ATOMIC_BLOCK_FORCEON _Static_assert(0, "ATOMIC_BLOCK_FORCEON not implemented")
# define ATOMIC_FORCEON _Static_assert(0, "ATOMIC_FORCEON not implemented")
# define ATOMIC_RESTORESTATE _Static_assert(0, "ATOMIC_RESTORESTATE not implemented")
# define ATOMIC_BLOCK STATIC_ASSERT(0, "ATOMIC_BLOCK not implemented")
# define ATOMIC_BLOCK_RESTORESTATE STATIC_ASSERT(0, "ATOMIC_BLOCK_RESTORESTATE not implemented")
# define ATOMIC_BLOCK_FORCEON STATIC_ASSERT(0, "ATOMIC_BLOCK_FORCEON not implemented")
# define ATOMIC_FORCEON STATIC_ASSERT(0, "ATOMIC_FORCEON not implemented")
# define ATOMIC_RESTORESTATE STATIC_ASSERT(0, "ATOMIC_RESTORESTATE not implemented")
# endif
#else /* do nothing atomic macro */
# define ATOMIC_BLOCK(t) for (uint8_t __ToDo = 1; __ToDo; __ToDo = 0)