mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 18:57:19 +02:00
Merge branch 'bugfix/linux_target_mac_v5.3' into 'release/v5.3'
fix(linux): fixed build errors on MacOS (v5.3) See merge request espressif/esp-idf!32919
This commit is contained in:
@ -6,7 +6,13 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
// getentropy live in different header files on Mac and Linux
|
||||||
|
#if (defined(__APPLE__) && defined(__MACH__))
|
||||||
|
#include <sys/random.h>
|
||||||
|
#else
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
|
|
||||||
|
@ -12,6 +12,20 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#if (defined(__APPLE__) && defined(__MACH__))
|
||||||
|
// MacOS
|
||||||
|
|
||||||
|
#if !defined(__containerof)
|
||||||
|
#define __containerof(ptr, type, member) ({ \
|
||||||
|
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
|
||||||
|
(type *)( (char *)__mptr - offsetof(type,member) );})
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include_next <sys/cdefs.h> // include the actual cdefs.h (which does not contain containerof)
|
||||||
|
|
||||||
|
#else
|
||||||
|
// Linux
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
// We need a define. We can't typedef here since, depending on the include order,
|
// We need a define. We can't typedef here since, depending on the include order,
|
||||||
@ -20,3 +34,5 @@
|
|||||||
|
|
||||||
#include_next <sys/cdefs.h>
|
#include_next <sys/cdefs.h>
|
||||||
#include <bsd/sys/cdefs.h>
|
#include <bsd/sys/cdefs.h>
|
||||||
|
|
||||||
|
#endif
|
Reference in New Issue
Block a user