mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-17 05:12:57 +01:00
drivers/periph_cpuid: Minor cleanup
Avoid use of `memcpy` altogether to work around false positive of `-Warray-bounds` in newer GCC versions.
This commit is contained in:
parent
ad345eea4b
commit
697448e51c
@ -28,15 +28,15 @@
|
|||||||
|
|
||||||
#include "periph/cpuid.h"
|
#include "periph/cpuid.h"
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint8_t id[CPUID_LEN];
|
||||||
|
} cpuid_t;
|
||||||
|
|
||||||
#ifdef CPUID_ADDR
|
#ifdef CPUID_ADDR
|
||||||
void cpuid_get(void *id)
|
void cpuid_get(void *id)
|
||||||
{
|
{
|
||||||
/* gcc 11.2.0 builtin bounds checking raises the following false positive warnings */
|
cpuid_t *dest = id;
|
||||||
#pragma GCC diagnostic push
|
const volatile cpuid_t *src = (const void *)CPUID_ADDR;
|
||||||
#pragma GCC diagnostic ignored "-Wpragmas" /* silence the CI due to unknown -Wstringop-overread */
|
*dest = *src;
|
||||||
#pragma GCC diagnostic ignored "-Warray-bounds"
|
|
||||||
#pragma GCC diagnostic ignored "-Wstringop-overread"
|
|
||||||
memcpy(id, (void *)CPUID_ADDR, CPUID_LEN);
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user