__const__ meaningless after __asm__



Hello!

I'm using glib-1.2.10 and gcc-3.0 and I'm getting warnings of this kind:

foo.c:62: warning: const qualifier ignored on asm

Removing __const__ after __asm__ everywhere in glib.h fixes the problem.

CVS shows that __const__ was introduced in revision 1.71 of glib.h
(between glib-1.1.4 and glib-1.1.5):

revision 1.71
date: 1998/11/11 01:26:09;  author: yosh;  state: Exp;  lines: +62 -35
* glib.h: make the endian x86 asm __const__ so the compiler can do
better optimizations.

I fail to see what the meaning of __const__ might be in this context.  It
must be an error, and here's the patch against the glib-1-2 branch.

ChangeLog:
	* glib.h: Don't use __const__ in asm statements - it's
	meaningless.
----------------------------------
--- glib.h
+++ glib.h
@@ -535,9 +535,9 @@
 	 if (__builtin_constant_p (val))		\
 	   __v = GUINT16_SWAP_LE_BE_CONSTANT (val);	\
 	 else						\
-	   __asm__ __const__ ("rorw $8, %w0"		\
-			      : "=r" (__v)		\
-			      : "0" ((guint16) (val)));	\
+	   __asm__ ("rorw $8, %w0"			\
+		    : "=r" (__v)			\
+		    : "0" ((guint16) (val)));		\
 	__v; }))
 #  define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_X86 (val))
 #  if !defined(__i486__) && !defined(__i586__) \
@@ -548,11 +548,11 @@
 	    if (__builtin_constant_p (val))			\
 	      __v = GUINT32_SWAP_LE_BE_CONSTANT (val);		\
 	  else							\
-	    __asm__ __const__ ("rorw $8, %w0\n\t"		\
-			       "rorl $16, %0\n\t"		\
-			       "rorw $8, %w0"			\
-			       : "=r" (__v)			\
-			       : "0" ((guint32) (val)));	\
+	    __asm__ ("rorw $8, %w0\n\t"				\
+		     "rorl $16, %0\n\t"				\
+		     "rorw $8, %w0"				\
+		     : "=r" (__v)				\
+		     : "0" ((guint32) (val)));			\
 	__v; }))
 #  else /* 486 and higher has bswap */
 #     define GUINT32_SWAP_LE_BE_X86(val) \
@@ -561,9 +561,9 @@
 	    if (__builtin_constant_p (val))			\
 	      __v = GUINT32_SWAP_LE_BE_CONSTANT (val);		\
 	  else							\
-	    __asm__ __const__ ("bswap %0"			\
-			       : "=r" (__v)			\
-			       : "0" ((guint32) (val)));	\
+	    __asm__ ("bswap %0"					\
+		     : "=r" (__v)				\
+		     : "0" ((guint32) (val)));			\
 	__v; }))
 #  endif /* processor specific 32-bit stuff */
 #  define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_X86 (val))
----------------------------------

And this is for the head branch.

ChangeLog:
	* gtypes.h: Don't use __const__ in asm statements - it's
	meaningless.
----------------------------------
--- gtypes.h
+++ gtypes.h
@@ -123,9 +123,9 @@
 	 if (__builtin_constant_p (val))		\
 	   __v = GUINT16_SWAP_LE_BE_CONSTANT (val);	\
 	 else						\
-	   __asm__ __const__ ("rorw $8, %w0"		\
-			      : "=r" (__v)		\
-			      : "0" ((guint16) (val)));	\
+	   __asm__ ("rorw $8, %w0"			\
+		    : "=r" (__v)			\
+		    : "0" ((guint16) (val)));		\
 	__v; }))
 #  define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_X86 (val))
 #  if !defined(__i486__) && !defined(__i586__) \
@@ -136,11 +136,11 @@
 	    if (__builtin_constant_p (val))			\
 	      __v = GUINT32_SWAP_LE_BE_CONSTANT (val);		\
 	  else							\
-	    __asm__ __const__ ("rorw $8, %w0\n\t"		\
-			       "rorl $16, %0\n\t"		\
-			       "rorw $8, %w0"			\
-			       : "=r" (__v)			\
-			       : "0" ((guint32) (val)));	\
+	    __asm__ ("rorw $8, %w0\n\t"				\
+		     "rorl $16, %0\n\t"				\
+		     "rorw $8, %w0"				\
+		     : "=r" (__v)				\
+		     : "0" ((guint32) (val)));			\
 	__v; }))
 #  else /* 486 and higher has bswap */
 #     define GUINT32_SWAP_LE_BE_X86(val) \
@@ -149,9 +149,9 @@
 	    if (__builtin_constant_p (val))			\
 	      __v = GUINT32_SWAP_LE_BE_CONSTANT (val);		\
 	  else							\
-	    __asm__ __const__ ("bswap %0"			\
-			       : "=r" (__v)			\
-			       : "0" ((guint32) (val)));	\
+	    __asm__ ("bswap %0"					\
+		     : "=r" (__v)				\
+		     : "0" ((guint32) (val)));			\
 	__v; }))
 #  endif /* processor specific 32-bit stuff */
 #  define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_X86 (val))
----------------------------------

-- 
Regards,
Pavel Roskin





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