Mesa (master): scons: Bump C standard to gnu11 on macOS 10.15.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Nov 29 13:08:38 UTC 2019


Module: Mesa
Branch: master
Commit: 0d21fe5397884cd395c754141d1416e05152298c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0d21fe5397884cd395c754141d1416e05152298c

Author: Vinson Lee <vlee at freedesktop.org>
Date:   Thu Nov 28 00:05:13 2019 -0800

scons: Bump C standard to gnu11 on macOS 10.15.

Fix build error on macOS 10.15 Catalina.

src/util/u_queue.c:179:7: error: implicit declaration of function 'timespec_get' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
      timespec_get(&ts, TIME_UTC);
      ^

timespec_get needs C11 starting with macOS 10.15.

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/time.h
   193	#if (__DARWIN_C_LEVEL >= __DARWIN_C_FULL) && \
   194	        ((defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \
   195	        (defined(__cplusplus) && __cplusplus >= 201703L))
   196	/* ISO/IEC 9899:201x 7.27.2.5 The timespec_get function */
   197	#define TIME_UTC	1	/* time elapsed since epoch */
   198	__API_AVAILABLE(macosx(10.15), ios(13.0), tvos(13.0), watchos(6.0))
   199	int timespec_get(struct timespec *ts, int base);
   200	#endif

Signed-off-by: Vinson Lee <vlee at freedesktop.org>
Acked-by: Eric Engestrom <eric at engestrom.ch>

---

 scons/gallium.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/scons/gallium.py b/scons/gallium.py
index c0f6f6c91ca..ea212d15a95 100755
--- a/scons/gallium.py
+++ b/scons/gallium.py
@@ -491,8 +491,11 @@ def generate(env):
             '-Werror=missing-prototypes',
             '-Werror=return-type',
             '-Werror=incompatible-pointer-types',
-            '-std=gnu99',
         ]
+        if platform == 'darwin' and host_platform.mac_ver()[0] >= '10.15':
+            cflags += ['-std=gnu11']
+        else:
+            cflags += ['-std=gnu99']
     if icc:
         cflags += [
             '-std=gnu99',




More information about the mesa-commit mailing list