__extension__ not recognized in gcc-2.7.2.1



Hello!

I have a report from a Solaris 2.5 user with gcc-2.7.2.1 that
`__extension__' is not recognized on his system.  Although the problem was
not in glib.h in that particular case (because the processor was Sparc,
not x86), I can imagine that glib.h be the source of troubles for other
users.

gmacros.h (glib head branch) defines G_GNUC_EXTENSION to an empty value
for gcc below 2.8.  However, gtypes.h uses `__extension__' when gcc is
2.0 and newer.

Since glib.h includes glib/gtypes.h after glib/gmacros.h, it should be
safe to use G_GNUC_EXTENSION instead.

Here's the patch for the head branch.

ChangeLog:
	* glib/gtypes.h: Use G_GNUC_EXTENSION instead of __extension__.
----------------------------
--- gtypes.h
+++ gtypes.h
@@ -118,7 +118,7 @@
  */
 #if defined (__i386__) && defined (__GNUC__) && __GNUC__ >= 2
 #  define GUINT16_SWAP_LE_BE_X86(val) \
-     (__extension__					\
+     (G_GNUC_EXTENSION					\
       ({ register guint16 __v;				\
 	 if (__builtin_constant_p (val))		\
 	   __v = GUINT16_SWAP_LE_BE_CONSTANT (val);	\
@@ -131,7 +131,7 @@
 #  if !defined(__i486__) && !defined(__i586__) \
       && !defined(__pentium__) && !defined(__i686__) && !defined(__pentiumpro__)
 #     define GUINT32_SWAP_LE_BE_X86(val) \
-        (__extension__						\
+        (G_GNUC_EXTENSION					\
          ({ register guint32 __v;				\
 	    if (__builtin_constant_p (val))			\
 	      __v = GUINT32_SWAP_LE_BE_CONSTANT (val);		\
@@ -144,7 +144,7 @@
 	__v; }))
 #  else /* 486 and higher has bswap */
 #     define GUINT32_SWAP_LE_BE_X86(val) \
-        (__extension__						\
+        (G_GNUC_EXTENSION					\
          ({ register guint32 __v;				\
 	    if (__builtin_constant_p (val))			\
 	      __v = GUINT32_SWAP_LE_BE_CONSTANT (val);		\
@@ -180,7 +180,7 @@
 	(guint64) G_GINT64_CONSTANT(0xff00000000000000U)) >> 56)))
 #  if defined (__i386__) && defined (__GNUC__) && __GNUC__ >= 2
 #    define GUINT64_SWAP_LE_BE_X86(val) \
-	(__extension__						\
+	(G_GNUC_EXTENSION					\
 	 ({ union { guint64 __ll;				\
 		    guint32 __l[2]; } __r;			\
 	    if (__builtin_constant_p (val))			\
----------------------------

And this is for the stable branch.

ChangeLog:
	* glib.h: Use G_GNUC_EXTENSION instead of __extension__.

The patch is the same but should be applied to glib.h

-- 
Regards,
Pavel Roskin





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]