[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xine-cvslog
Subject:    [xine-cvs] HG: xine-lib: Add check for const attribute (for
From:       "=?UTF-8?Q?Diego=20'Flameeyes'=20Petten=C3=B2?=" <flameeyes () gmail ! com>
Date:       2008-05-23 18:07:20
Message-ID: 2f9b78e8361f265b2a04.1211310876 () hg ! debian ! org
[Download RAW message or body]

# HG changeset patch
# User Diego 'Flameeyes' Pettenò <flameeyes@gmail.com>
# Date 1211310876 -7200
# Node ID 2f9b78e8361f265b2a04e5d5f85ca08d5f7a7fce
# Parent  c507526e65a16155bd2665fcf89a159b9f97249f
Add check for const attribute (for mathematical functions).

Add CC_ATTRIBUTE_CONST macro to the attributes.h.
Run CC_ATTRIBUTE_CONST in configure.
Define SUPPORT_ATTRIBUTE_CONST for GCC 3.
Define XINE_CONST to __attribute__((__const__)) if supported.

diff -r 2f9b78e8361f265b2a04e5d5f85ca08d5f7a7fce -r \
                c507526e65a16155bd2665fcf89a159b9f97249f configure.ac
--- a/configure.ac	Tue May 20 21:14:36 2008 +0200
+++ b/configure.ac	Thu May 22 23:42:16 2008 +0200
@@ -2219,6 +2219,7 @@ CC_ATTRIBUTE_UNUSED
 CC_ATTRIBUTE_UNUSED
 CC_ATTRIBUTE_MALLOC
 CC_ATTRIBUTE_PACKED
+CC_ATTRIBUTE_CONST
 
 AC_OPTIMIZATIONS
 
diff -r 2f9b78e8361f265b2a04e5d5f85ca08d5f7a7fce -r \
                c507526e65a16155bd2665fcf89a159b9f97249f m4/attributes.m4
--- a/m4/attributes.m4	Tue May 20 21:14:36 2008 +0200
+++ b/m4/attributes.m4	Thu May 22 23:42:16 2008 +0200
@@ -184,6 +184,14 @@ AC_DEFUN([CC_ATTRIBUTE_PACKED], [
   CC_CHECK_ATTRIBUTE(
     [packed], ,
     [struct astructure { char a; int b; long c; void *d; } \
__attribute__((packed));], +    [$1],
+    [$2])
+])
+
+AC_DEFUN([CC_ATTRIBUTE_CONST], [
+  CC_CHECK_ATTRIBUTE(
+    [const], ,
+    [int __attribute__((const)) twopow(int n) { return 1 << n; } ],
     [$1],
     [$2])
 ])
diff -r 2f9b78e8361f265b2a04e5d5f85ca08d5f7a7fce -r \
                c507526e65a16155bd2665fcf89a159b9f97249f src/xine-utils/attributes.h
--- a/src/xine-utils/attributes.h	Tue May 20 21:14:36 2008 +0200
+++ b/src/xine-utils/attributes.h	Thu May 22 23:42:16 2008 +0200
@@ -45,6 +45,7 @@
 #  define SUPPORT_ATTRIBUTE_FORMAT_ARG 1
 #  define SUPPORT_ATTRIBUTE_MALLOC 1
 #  define SUPPORT_ATTRIBUTE_UNUSED 1
+#  define SUPPORT_ATTRIBUTE_CONST 1
 # endif
   
 # if __GNUC__ >= 4
@@ -109,4 +110,10 @@
 # define XINE_PACKED
 #endif
 
+#ifdef SUPPORT_ATTRIBUTE_CONST
+# define XINE_CONST __attribute__((__const__))
+#else
+# define XINE_CONST
+#endif
+
 #endif /* ATTRIBUTE_H_ */

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Xine-cvslog mailing list
Xine-cvslog@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xine-cvslog


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic