build: check if std-predef.h exists
Fix build on FreeBSD / non-glibc systems Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
85dba1f3c9
commit
41fd229230
|
@ -49,6 +49,10 @@ endif
|
|||
|
||||
add_global_arguments('-D_GNU_SOURCE', language: 'c')
|
||||
|
||||
if cc.has_header('stdc-predef.h')
|
||||
add_global_arguments('-DHAS_STDC_PREDEF_H', language: 'c')
|
||||
endif
|
||||
|
||||
warns = [ 'all', 'extra', 'no-unused-parameter', 'nonnull', 'shadow', 'no-type-limits',
|
||||
'implicit-fallthrough', 'no-unknown-warning-option', 'no-missing-braces', 'conversion' ]
|
||||
foreach w : warns
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
// Copyright (c) 2018 Yuxuan Shui <yshuiv7@gmail.com>
|
||||
#pragma once
|
||||
|
||||
#ifdef HAS_STDC_PREDEF_H
|
||||
#include <stdc-predef.h>
|
||||
#endif
|
||||
|
||||
#define auto __auto_type
|
||||
#define likely(x) __builtin_expect(!!(x), 1)
|
||||
|
|
Loading…
Reference in New Issue