Mesa (master): scons: add support for MAJOR_IN_{MKDEV,SYSMACROS}

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Aug 27 13:12:30 UTC 2019


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

Author: Eric Engestrom <eric.engestrom at intel.com>
Date:   Thu Aug 22 12:12:20 2019 +0100

scons: add support for MAJOR_IN_{MKDEV,SYSMACROS}

src/gallium/winsys/svga/drm/vmw_screen.c: In function ‘vmw_dev_compare’:
src/gallium/winsys/svga/drm/vmw_screen.c:48:12: warning: implicit declaration of function ‘major’ [-Wimplicit-function-declaration]
   48 |    return (major(*(dev_t *)key1) == major(*(dev_t *)key2) &&
      |            ^~~~~
src/gallium/winsys/svga/drm/vmw_screen.c:49:12: warning: implicit declaration of function ‘minor’ [-Wimplicit-function-declaration]
   49 |            minor(*(dev_t *)key1) == minor(*(dev_t *)key2)) ? 0 : 1;
      |            ^~~~~

That file (and many others) already has the proper #include with their
respective guards, but scons wasn't defining them, resulting in implicit
functions being used instead (and an always-true check that's probably
breaking something down the line).

Note that I'm cheating a bit here because Scons doesn't seem to have
a clean way to detect the existence of major() et al. as functions or
macros, so I'm taking the shortcut of just detecting the presence of the
header and assuming its contents is what we expect.

Signed-off-by: Eric Engestrom <eric.engestrom at intel.com>
Reviewed-By: Jose Fonseca <jfonseca at vmware.com>

---

 scons/gallium.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/scons/gallium.py b/scons/gallium.py
index 21197c8d0d1..79b9406a975 100755
--- a/scons/gallium.py
+++ b/scons/gallium.py
@@ -378,6 +378,14 @@ def generate(env):
         if check_header(env, 'sys/shm.h'):
             cppdefines += ['HAVE_SYS_SHM_H']
 
+        #FIXME: we should really be checking for the major()/minor()
+        # functions/macros in these headers, but check_functions()'s
+        # SConf.CheckFunc() doesn't seem to support macros.
+        if check_header(env, 'sys/mkdev.h'):
+            cppdefines += ['MAJOR_IN_MKDEV']
+        if check_header(env, 'sys/sysmacros.h'):
+            cppdefines += ['MAJOR_IN_SYSMACROS']
+
     if platform == 'windows':
         cppdefines += [
             'WIN32',




More information about the mesa-commit mailing list