__STDC_VERSION__ may be undefined

Clang++ (and g++) don't define __STDC_VERSION__ which results in

 include/spa/support/log.h:101:5: error: '__STDC_VERSION__' is not defined, evaluates to 0 [-Werror,-Wundef]
 #if __STDC_VERSION__ >= 199901L
 include/pipewire/log.h:64:5: error: '__STDC_VERSION__' is not defined, evaluates to 0 [-Werror,-Wundef]
 #if __STDC_VERSION__ >= 199901L

so check if __STDC_VERSION__ is defined before comparing.
Also, include/feature.h additionally defines __USE_ISOC99 (and
__USE_ISOC11 for C11 extension), so check these as well.
This commit is contained in:
Eike Rathke 2018-03-12 19:35:25 +01:00 committed by Wim Taymans
parent e38cba4e13
commit 871dd2743b
2 changed files with 4 additions and 2 deletions

View file

@ -98,7 +98,8 @@ struct spa_log {
#define spa_log_level_enabled(l,lev) ((l) && (l)->level >= (lev))
#if __STDC_VERSION__ >= 199901L
#if defined(__USE_ISOC11) || defined(__USE_ISOC99) || \
(defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
#define spa_log_log(l,lev,...) \
if (SPA_UNLIKELY (spa_log_level_enabled (l, lev))) \