1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +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:
Marian Buschsieweke 2022-04-11 10:05:45 +02:00
parent ad345eea4b
commit 697448e51c
No known key found for this signature in database
GPG Key ID: CB8E3238CE715A94

View File

@ -28,15 +28,15 @@
#include "periph/cpuid.h"
typedef struct {
uint8_t id[CPUID_LEN];
} cpuid_t;
#ifdef CPUID_ADDR
void cpuid_get(void *id)
{
/* gcc 11.2.0 builtin bounds checking raises the following false positive warnings */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpragmas" /* silence the CI due to unknown -Wstringop-overread */
#pragma GCC diagnostic ignored "-Warray-bounds"
#pragma GCC diagnostic ignored "-Wstringop-overread"
memcpy(id, (void *)CPUID_ADDR, CPUID_LEN);
#pragma GCC diagnostic pop
cpuid_t *dest = id;
const volatile cpuid_t *src = (const void *)CPUID_ADDR;
*dest = *src;
}
#endif