[PATCH] fix asm when strict ISO c and ensure dix-config.h is included first

Richard PALO richard at netbsd.org
Mon Nov 16 22:03:03 PST 2015


From: Richard PALO <richard at NetBSD.org>

The following is for the source found in the glamor subdirectory:

Define a macro 'asm' for the case of a strict ISO gnu c compatible compiler,
(NB this may need to be revised in case of being compiled in by c++)

Also, ensure that dix-config.h is effectively the first included file in
various glamor modules such that feature tests (at least on SunOS i386)
is correctly instrumented (such as _LARGEFILE_SOURCE/_FILE_OFFSET_BITS
as well as POSIX profile and other extensions).

Since glamor_priv.h correctly includes dix-config.h, the easiest way is
to simply adjust its position in the affected .c files.

Signed-off-by: Richard PALO <richard at NetBSD.org>
---
 glamor/glamor.c                  | 2 +-
 glamor/glamor_composite_glyphs.c | 2 +-
 glamor/glamor_core.c             | 3 +--
 glamor/glamor_fbo.c              | 3 +--
 glamor/glamor_largepixmap.c      | 3 +--
 glamor/glamor_picture.c          | 2 +-
 glamor/glamor_pixmap.c           | 2 +-
 glamor/glamor_utils.h            | 4 ++++
 8 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/glamor/glamor.c b/glamor/glamor.c
index d4a0236..d2c2189 100644
--- a/glamor/glamor.c
+++ b/glamor/glamor.c
@@ -31,9 +31,9 @@
  * functions not responsible for performing rendering.
  */
 
+#include "glamor_priv.h"
 #include <stdlib.h>
 
-#include "glamor_priv.h"
 #include "mipict.h"
 
 DevPrivateKeyRec glamor_screen_private_key;
diff --git a/glamor/glamor_composite_glyphs.c b/glamor/glamor_composite_glyphs.c
index 389c8f4..c3440b2 100644
--- a/glamor/glamor_composite_glyphs.c
+++ b/glamor/glamor_composite_glyphs.c
@@ -19,10 +19,10 @@
  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  * OF THIS SOFTWARE.
  */
+#include "glamor_priv.h"
 #include <stdlib.h>
 #include "Xprintf.h"
 
-#include "glamor_priv.h"
 #include "glamor_transform.h"
 #include "glamor_transfer.h"
 
diff --git a/glamor/glamor_core.c b/glamor/glamor_core.c
index 0104b88..0719845 100644
--- a/glamor/glamor_core.c
+++ b/glamor/glamor_core.c
@@ -31,9 +31,8 @@
  * This file covers core X rendering in glamor.
  */
 
-#include <stdlib.h>
-
 #include "glamor_priv.h"
+#include <stdlib.h>
 
 Bool
 glamor_get_drawable_location(const DrawablePtr drawable)
diff --git a/glamor/glamor_fbo.c b/glamor/glamor_fbo.c
index 262033f..ca6c90c 100644
--- a/glamor/glamor_fbo.c
+++ b/glamor/glamor_fbo.c
@@ -26,9 +26,8 @@
  *
  */
 
-#include <stdlib.h>
-
 #include "glamor_priv.h"
+#include <stdlib.h>
 
 #define GLAMOR_CACHE_EXPIRE_MAX 100
 
diff --git a/glamor/glamor_largepixmap.c b/glamor/glamor_largepixmap.c
index 9a6c95e..0a0c639 100644
--- a/glamor/glamor_largepixmap.c
+++ b/glamor/glamor_largepixmap.c
@@ -1,6 +1,5 @@
-#include <stdlib.h>
-
 #include "glamor_priv.h"
+#include <stdlib.h>
 
 static void
 glamor_get_transform_extent_from_box(struct pixman_box32 *box,
diff --git a/glamor/glamor_picture.c b/glamor/glamor_picture.c
index 9b09454..cae1219 100644
--- a/glamor/glamor_picture.c
+++ b/glamor/glamor_picture.c
@@ -26,9 +26,9 @@
  *
  */
 
+#include "glamor_priv.h"
 #include <stdlib.h>
 
-#include "glamor_priv.h"
 #include "mipict.h"
 
 /*
diff --git a/glamor/glamor_pixmap.c b/glamor/glamor_pixmap.c
index 166bde5..f0a3d3c 100644
--- a/glamor/glamor_pixmap.c
+++ b/glamor/glamor_pixmap.c
@@ -27,9 +27,9 @@
  *
  */
 
+#include "glamor_priv.h"
 #include <stdlib.h>
 
-#include "glamor_priv.h"
 /**
  * Sets the offsets to add to coordinates to make them address the same bits in
  * the backing drawable. These coordinates are nonzero only for redirected
diff --git a/glamor/glamor_utils.h b/glamor/glamor_utils.h
index e648af2..cee312a 100644
--- a/glamor/glamor_utils.h
+++ b/glamor/glamor_utils.h
@@ -32,6 +32,10 @@
 #ifndef __GLAMOR_UTILS_H__
 #define __GLAMOR_UTILS_H__
 
+#if defined(__GNUC__) && defined(_STRICT_STDC) && !defined(asm)
+#define	asm	__asm__	/* asm is not a keyword in ISO c */
+#endif
+
 #include "glamor_prepare.h"
 #include "mipict.h"
 
-- 
2.6.3





More information about the xorg-devel mailing list