[Mesa-dev] [PATCH 1/7] svga: Use __asm__ instead of asm

Dylan Baker dylan at pnwbakers.com
Thu Oct 26 23:57:01 UTC 2017


Which allows the code to be compiled with c99 instead of gnu99.

A little history. This code is guarded by #ifdef __GNUC__, so it's only
compiled with autotools on *nix, SCons with MSVC wont hit that code.
However, meson is going to build both MSVC and GCC/Clang paths. As such
it makes sense to not have to override the std for gcc/clang, but ensure
that it's not set to gnu99 when building with MSVC when there's a
straightforward code change that allows removing the need for gnu99.

I have compile tested this with GCC and Clang

cc: Brian Paul <brianp at vmware.com>
Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---

Brian, I don't know who the right person and VMWare to ping for build system
stuff is. If there' someone better please let me know os I can cc them instead.

 src/gallium/drivers/svga/Makefile.am    |  3 ---
 src/gallium/drivers/svga/svga_msg.c     | 10 +++++-----
 src/gallium/winsys/svga/drm/Makefile.am |  3 ---
 3 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/src/gallium/drivers/svga/Makefile.am b/src/gallium/drivers/svga/Makefile.am
index 1ad5e0f91e6..2e5220e9f27 100644
--- a/src/gallium/drivers/svga/Makefile.am
+++ b/src/gallium/drivers/svga/Makefile.am
@@ -30,9 +30,6 @@ AM_CFLAGS = \
 	$(GALLIUM_DRIVER_CFLAGS) \
 	$(MSVC2013_COMPAT_CFLAGS)
 
-#On some systems -std= must be added to CFLAGS to be the last -std=
-CFLAGS += -std=gnu99
-
 noinst_HEADERS = $(SVGA_H_FILES)
 noinst_LTLIBRARIES = libsvga.la
 
diff --git a/src/gallium/drivers/svga/svga_msg.c b/src/gallium/drivers/svga/svga_msg.c
index e0346dee751..8b63132cb57 100755
--- a/src/gallium/drivers/svga/svga_msg.c
+++ b/src/gallium/drivers/svga/svga_msg.c
@@ -83,7 +83,7 @@
          port_num, magic,                  \
          ax, bx, cx, dx, si, di)           \
 ({                                         \
-   asm volatile ("inl %%dx, %%eax;" :      \
+   __asm__ volatile ("inl %%dx, %%eax;" :  \
       "=a"(ax),                            \
       "=b"(bx),                            \
       "=c"(cx),                            \
@@ -128,7 +128,7 @@ typedef uint64_t VMW_REG;
          port_num, magic, bp,                     \
          ax, bx, cx, dx, si, di)                  \
 ({                                                \
-   asm volatile ("push %%rbp;"                    \
+   __asm__ volatile ("push %%rbp;"                \
       "movq %12, %%rbp;"                          \
       "rep outsb;"                                \
       "pop %%rbp;" :                              \
@@ -152,7 +152,7 @@ typedef uint64_t VMW_REG;
          port_num, magic, bp,                     \
          ax, bx, cx, dx, si, di)                  \
 ({                                                \
-   asm volatile ("push %%rbp;"                    \
+   __asm__ volatile ("push %%rbp;"                \
       "movq %12, %%rbp;"                          \
       "rep insb;"                                 \
       "pop %%rbp" :                               \
@@ -183,7 +183,7 @@ typedef uint32_t VMW_REG;
          port_num, magic, bp,                     \
          ax, bx, cx, dx, si, di)                  \
 ({                                                \
-   asm volatile ("push %%ebp;"                    \
+   __asm__ volatile ("push %%ebp;"                \
       "mov %12, %%ebp;"                           \
       "rep outsb;"                                \
       "pop %%ebp;" :                              \
@@ -208,7 +208,7 @@ typedef uint32_t VMW_REG;
          port_num, magic, bp,                     \
          ax, bx, cx, dx, si, di)                  \
 ({                                                \
-   asm volatile ("push %%ebp;"                    \
+   __asm__ volatile ("push %%ebp;"                \
       "mov %12, %%ebp;"                           \
       "rep insb;"                                 \
       "pop %%ebp" :                               \
diff --git a/src/gallium/winsys/svga/drm/Makefile.am b/src/gallium/winsys/svga/drm/Makefile.am
index dfa97367650..ac9de18d3df 100644
--- a/src/gallium/winsys/svga/drm/Makefile.am
+++ b/src/gallium/winsys/svga/drm/Makefile.am
@@ -29,9 +29,6 @@ AM_CFLAGS = \
 	$(GALLIUM_WINSYS_CFLAGS) \
 	$(LIBDRM_CFLAGS)
 
-#On some systems -std= must be added to CFLAGS to be the last -std=
-CFLAGS += -std=gnu99
-
 noinst_LTLIBRARIES = libsvgadrm.la
 
 libsvgadrm_la_SOURCES = $(C_SOURCES)
-- 
2.14.2



More information about the mesa-dev mailing list