]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Wrap up "__attribute__((regparm(n)))" inside a macro so it is only
authorJulian Seward <jseward@acm.org>
Mon, 14 Mar 2011 12:35:18 +0000 (12:35 +0000)
committerJulian Seward <jseward@acm.org>
Mon, 14 Mar 2011 12:35:18 +0000 (12:35 +0000)
visible on x86, so as to avoid producing compiler warnings on targets
for which it is ignored.  Fixes #247223.  (Modified version of patch
from Bart Van Assche).

git-svn-id: svn://svn.valgrind.org/vex/trunk@2108

VEX/priv/guest_generic_bb_to_IR.c
VEX/priv/guest_x86_defs.h
VEX/priv/guest_x86_helpers.c
VEX/pub/libvex_basictypes.h
VEX/pub/libvex_ir.h

index 0f0a4f99bcaf5bbbc884eb2e6e4386ede32189fc..812fc3c6ee2b8c275dc21a3ee34dec87e9615815 100644 (file)
 
 
 /* Forwards .. */
-__attribute__((regparm(2)))
+VEX_REGPARM(2)
 static UInt genericg_compute_checksum_4al ( HWord first_w32, HWord n_w32s );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static UInt genericg_compute_checksum_4al_1 ( HWord first_w32 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static UInt genericg_compute_checksum_4al_2 ( HWord first_w32 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static UInt genericg_compute_checksum_4al_3 ( HWord first_w32 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static UInt genericg_compute_checksum_4al_4 ( HWord first_w32 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static UInt genericg_compute_checksum_4al_5 ( HWord first_w32 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static UInt genericg_compute_checksum_4al_6 ( HWord first_w32 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static UInt genericg_compute_checksum_4al_7 ( HWord first_w32 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static UInt genericg_compute_checksum_4al_8 ( HWord first_w32 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static UInt genericg_compute_checksum_4al_9 ( HWord first_w32 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static UInt genericg_compute_checksum_4al_10 ( HWord first_w32 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static UInt genericg_compute_checksum_4al_11 ( HWord first_w32 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static UInt genericg_compute_checksum_4al_12 ( HWord first_w32 );
 
-__attribute__((regparm(2)))
+VEX_REGPARM(2)
 static ULong genericg_compute_checksum_8al ( HWord first_w64, HWord n_w64s );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static ULong genericg_compute_checksum_8al_1 ( HWord first_w64 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static ULong genericg_compute_checksum_8al_2 ( HWord first_w64 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static ULong genericg_compute_checksum_8al_3 ( HWord first_w64 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static ULong genericg_compute_checksum_8al_4 ( HWord first_w64 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static ULong genericg_compute_checksum_8al_5 ( HWord first_w64 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static ULong genericg_compute_checksum_8al_6 ( HWord first_w64 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static ULong genericg_compute_checksum_8al_7 ( HWord first_w64 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static ULong genericg_compute_checksum_8al_8 ( HWord first_w64 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static ULong genericg_compute_checksum_8al_9 ( HWord first_w64 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static ULong genericg_compute_checksum_8al_10 ( HWord first_w64 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static ULong genericg_compute_checksum_8al_11 ( HWord first_w64 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static ULong genericg_compute_checksum_8al_12 ( HWord first_w64 );
 
 /* Small helpers */
@@ -425,8 +425,8 @@ IRSB* bb_to_IR ( /*OUT*/VexGuestExtents* vge,
       UInt     len2check;
       HWord    expectedhW;
       IRTemp   tistart_tmp, tilen_tmp;
-      HWord    __attribute__((regparm(2))) (*fn_generic)(HWord, HWord);
-      HWord    __attribute__((regparm(1))) (*fn_spec)(HWord);
+      HWord    VEX_REGPARM(2) (*fn_generic)(HWord, HWord);
+      HWord    VEX_REGPARM(1) (*fn_spec)(HWord);
       HChar*   nm_generic;
       HChar*   nm_spec;
       HWord    fn_generic_entry = 0;
@@ -466,11 +466,11 @@ IRSB* bb_to_IR ( /*OUT*/VexGuestExtents* vge,
          /* vex_printf("%lx %lx  %ld\n", first_w32, last_w32, w32s_to_check); */
 
          if (host_word_szB == 8) {
-            fn_generic =  (__attribute__((regparm(2))) HWord(*)(HWord, HWord))
+            fn_generic =  (VEX_REGPARM(2) HWord(*)(HWord, HWord))
                           genericg_compute_checksum_8al;
             nm_generic = "genericg_compute_checksum_8al";
          } else {
-            fn_generic =  (__attribute__((regparm(2))) HWord(*)(HWord, HWord))
+            fn_generic =  (VEX_REGPARM(2) HWord(*)(HWord, HWord))
                           genericg_compute_checksum_4al;
             nm_generic = "genericg_compute_checksum_4al";
          }
@@ -480,7 +480,7 @@ IRSB* bb_to_IR ( /*OUT*/VexGuestExtents* vge,
 
          if (host_word_szB == 8) {
             HChar* nm = NULL;
-            ULong  __attribute__((regparm(1))) (*fn)(HWord)  = NULL;
+            ULong  VEX_REGPARM(1) (*fn)(HWord)  = NULL;
             switch (hWs_to_check) {
                case 1:  fn =  genericg_compute_checksum_8al_1;
                         nm = "genericg_compute_checksum_8al_1"; break;
@@ -508,11 +508,11 @@ IRSB* bb_to_IR ( /*OUT*/VexGuestExtents* vge,
                         nm = "genericg_compute_checksum_8al_12"; break;
                default: break;
             }
-            fn_spec = (__attribute__((regparm(1))) HWord(*)(HWord)) fn;
+            fn_spec = (VEX_REGPARM(1) HWord(*)(HWord)) fn;
             nm_spec = nm;
          } else {
             HChar* nm = NULL;
-            UInt   __attribute__((regparm(1))) (*fn)(HWord) = NULL;
+            UInt   VEX_REGPARM(1) (*fn)(HWord) = NULL;
             switch (hWs_to_check) {
                case 1:  fn =  genericg_compute_checksum_4al_1;
                         nm = "genericg_compute_checksum_4al_1"; break;
@@ -540,7 +540,7 @@ IRSB* bb_to_IR ( /*OUT*/VexGuestExtents* vge,
                         nm = "genericg_compute_checksum_4al_12"; break;
                default: break;
             }
-            fn_spec = (__attribute__((regparm(1))) HWord(*)(HWord))fn;
+            fn_spec = (VEX_REGPARM(1) HWord(*)(HWord))fn;
             nm_spec = nm;
          }
 
@@ -661,7 +661,7 @@ static inline UInt ROL32 ( UInt w, Int n ) {
    return w;
 }
 
-__attribute((regparm(2)))
+VEX_REGPARM(2)
 static UInt genericg_compute_checksum_4al ( HWord first_w32, HWord n_w32s )
 {
    UInt  sum1 = 0, sum2 = 0;
@@ -689,7 +689,7 @@ static UInt genericg_compute_checksum_4al ( HWord first_w32, HWord n_w32s )
 
 /* Specialised versions of the above function */
 
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static UInt genericg_compute_checksum_4al_1 ( HWord first_w32 )
 {
    UInt  sum1 = 0, sum2 = 0;
@@ -700,7 +700,7 @@ static UInt genericg_compute_checksum_4al_1 ( HWord first_w32 )
    return sum1 + sum2;
 }
 
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static UInt genericg_compute_checksum_4al_2 ( HWord first_w32 )
 {
    UInt  sum1 = 0, sum2 = 0;
@@ -713,7 +713,7 @@ static UInt genericg_compute_checksum_4al_2 ( HWord first_w32 )
    return sum1 + sum2;
 }
 
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static UInt genericg_compute_checksum_4al_3 ( HWord first_w32 )
 {
    UInt  sum1 = 0, sum2 = 0;
@@ -728,7 +728,7 @@ static UInt genericg_compute_checksum_4al_3 ( HWord first_w32 )
    return sum1 + sum2;
 }
 
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static UInt genericg_compute_checksum_4al_4 ( HWord first_w32 )
 {
    UInt  sum1 = 0, sum2 = 0;
@@ -742,7 +742,7 @@ static UInt genericg_compute_checksum_4al_4 ( HWord first_w32 )
    return sum1 + sum2;
 }
 
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static UInt genericg_compute_checksum_4al_5 ( HWord first_w32 )
 {
    UInt  sum1 = 0, sum2 = 0;
@@ -758,7 +758,7 @@ static UInt genericg_compute_checksum_4al_5 ( HWord first_w32 )
    return sum1 + sum2;
 }
 
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static UInt genericg_compute_checksum_4al_6 ( HWord first_w32 )
 {
    UInt  sum1 = 0, sum2 = 0;
@@ -776,7 +776,7 @@ static UInt genericg_compute_checksum_4al_6 ( HWord first_w32 )
    return sum1 + sum2;
 }
 
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static UInt genericg_compute_checksum_4al_7 ( HWord first_w32 )
 {
    UInt  sum1 = 0, sum2 = 0;
@@ -796,7 +796,7 @@ static UInt genericg_compute_checksum_4al_7 ( HWord first_w32 )
    return sum1 + sum2;
 }
 
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static UInt genericg_compute_checksum_4al_8 ( HWord first_w32 )
 {
    UInt  sum1 = 0, sum2 = 0;
@@ -815,7 +815,7 @@ static UInt genericg_compute_checksum_4al_8 ( HWord first_w32 )
    return sum1 + sum2;
 }
 
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static UInt genericg_compute_checksum_4al_9 ( HWord first_w32 )
 {
    UInt  sum1 = 0, sum2 = 0;
@@ -836,7 +836,7 @@ static UInt genericg_compute_checksum_4al_9 ( HWord first_w32 )
    return sum1 + sum2;
 }
 
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static UInt genericg_compute_checksum_4al_10 ( HWord first_w32 )
 {
    UInt  sum1 = 0, sum2 = 0;
@@ -859,7 +859,7 @@ static UInt genericg_compute_checksum_4al_10 ( HWord first_w32 )
    return sum1 + sum2;
 }
 
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static UInt genericg_compute_checksum_4al_11 ( HWord first_w32 )
 {
    UInt  sum1 = 0, sum2 = 0;
@@ -884,7 +884,7 @@ static UInt genericg_compute_checksum_4al_11 ( HWord first_w32 )
    return sum1 + sum2;
 }
 
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static UInt genericg_compute_checksum_4al_12 ( HWord first_w32 )
 {
    UInt  sum1 = 0, sum2 = 0;
@@ -916,7 +916,7 @@ static inline ULong ROL64 ( ULong w, Int n ) {
    return w;
 }
 
-__attribute((regparm(2)))
+VEX_REGPARM(2)
 static ULong genericg_compute_checksum_8al ( HWord first_w64, HWord n_w64s )
 {
    ULong  sum1 = 0, sum2 = 0;
@@ -944,7 +944,7 @@ static ULong genericg_compute_checksum_8al ( HWord first_w64, HWord n_w64s )
 
 /* Specialised versions of the above function */
 
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static ULong genericg_compute_checksum_8al_1 ( HWord first_w64 )
 {
    ULong  sum1 = 0, sum2 = 0;
@@ -955,7 +955,7 @@ static ULong genericg_compute_checksum_8al_1 ( HWord first_w64 )
    return sum1 + sum2;
 }
 
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static ULong genericg_compute_checksum_8al_2 ( HWord first_w64 )
 {
    ULong  sum1 = 0, sum2 = 0;
@@ -968,7 +968,7 @@ static ULong genericg_compute_checksum_8al_2 ( HWord first_w64 )
    return sum1 + sum2;
 }
 
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static ULong genericg_compute_checksum_8al_3 ( HWord first_w64 )
 {
    ULong  sum1 = 0, sum2 = 0;
@@ -983,7 +983,7 @@ static ULong genericg_compute_checksum_8al_3 ( HWord first_w64 )
    return sum1 + sum2;
 }
 
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static ULong genericg_compute_checksum_8al_4 ( HWord first_w64 )
 {
    ULong  sum1 = 0, sum2 = 0;
@@ -997,7 +997,7 @@ static ULong genericg_compute_checksum_8al_4 ( HWord first_w64 )
    return sum1 + sum2;
 }
 
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static ULong genericg_compute_checksum_8al_5 ( HWord first_w64 )
 {
    ULong  sum1 = 0, sum2 = 0;
@@ -1013,7 +1013,7 @@ static ULong genericg_compute_checksum_8al_5 ( HWord first_w64 )
    return sum1 + sum2;
 }
 
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static ULong genericg_compute_checksum_8al_6 ( HWord first_w64 )
 {
    ULong  sum1 = 0, sum2 = 0;
@@ -1031,7 +1031,7 @@ static ULong genericg_compute_checksum_8al_6 ( HWord first_w64 )
    return sum1 + sum2;
 }
 
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static ULong genericg_compute_checksum_8al_7 ( HWord first_w64 )
 {
    ULong  sum1 = 0, sum2 = 0;
@@ -1051,7 +1051,7 @@ static ULong genericg_compute_checksum_8al_7 ( HWord first_w64 )
    return sum1 + sum2;
 }
 
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static ULong genericg_compute_checksum_8al_8 ( HWord first_w64 )
 {
    ULong  sum1 = 0, sum2 = 0;
@@ -1070,7 +1070,7 @@ static ULong genericg_compute_checksum_8al_8 ( HWord first_w64 )
    return sum1 + sum2;
 }
 
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static ULong genericg_compute_checksum_8al_9 ( HWord first_w64 )
 {
    ULong  sum1 = 0, sum2 = 0;
@@ -1091,7 +1091,7 @@ static ULong genericg_compute_checksum_8al_9 ( HWord first_w64 )
    return sum1 + sum2;
 }
 
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static ULong genericg_compute_checksum_8al_10 ( HWord first_w64 )
 {
    ULong  sum1 = 0, sum2 = 0;
@@ -1114,7 +1114,7 @@ static ULong genericg_compute_checksum_8al_10 ( HWord first_w64 )
    return sum1 + sum2;
 }
 
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static ULong genericg_compute_checksum_8al_11 ( HWord first_w64 )
 {
    ULong  sum1 = 0, sum2 = 0;
@@ -1139,7 +1139,7 @@ static ULong genericg_compute_checksum_8al_11 ( HWord first_w64 )
    return sum1 + sum2;
 }
 
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
 static ULong genericg_compute_checksum_8al_12 ( HWord first_w64 )
 {
    ULong  sum1 = 0, sum2 = 0;
index 96335335f19cf5177b8e0fca39f04f1a3dffb7b4..037bb6f9b18e0f3fe621a372aed847bc590ec605 100644 (file)
@@ -86,7 +86,7 @@ extern UInt  x86g_calculate_eflags_all (
                 UInt cc_op, UInt cc_dep1, UInt cc_dep2, UInt cc_ndep 
              );
 
-__attribute((regparm(3)))
+VEX_REGPARM(3)
 extern UInt  x86g_calculate_eflags_c ( 
                 UInt cc_op, UInt cc_dep1, UInt cc_dep2, UInt cc_ndep 
              );
index c538c076621e57732cd5eba4f1c108c36904fb96..eebc7c26fe086ca7daec429e66dda7c9a2816b6f 100644 (file)
@@ -588,7 +588,7 @@ UInt x86g_calculate_eflags_all ( UInt cc_op,
 
 /* CALLED FROM GENERATED CODE: CLEAN HELPER */
 /* Calculate just the carry flag from the supplied thunk parameters. */
-__attribute((regparm(3)))
+VEX_REGPARM(3)
 UInt x86g_calculate_eflags_c ( UInt cc_op, 
                                UInt cc_dep1, 
                                UInt cc_dep2,
index 0d3e8000602b3c39ee0a16d063df01a1af42a94b..56309962b9f8ab1a5b79a1c79c4b0b60231a7dd8 100644 (file)
@@ -130,29 +130,40 @@ typedef  unsigned long HWord;
    and ULong_to_Ptr in a way that doesn't cause compilers to complain.
    These functions allow us to cast pointers to and from 64-bit
    integers without complaints from compilers, regardless of the host
-   word size. */
+   word size.
+
+   Also set up VEX_REGPARM.
+*/
 
 #undef VEX_HOST_WORDSIZE
+#undef VEX_REGPARM
 
 /* The following 4 work OK for Linux. */
 #if defined(__x86_64__)
 #   define VEX_HOST_WORDSIZE 8
+#   define VEX_REGPARM(_n) /* */
 #elif defined(__i386__)
 #   define VEX_HOST_WORDSIZE 4
+#   define VEX_REGPARM(_n) __attribute__((regparm(_n)))
 #elif defined(__powerpc__) && defined(__powerpc64__)
 #   define VEX_HOST_WORDSIZE 8
+#   define VEX_REGPARM(_n) /* */
 #elif defined(__powerpc__) && !defined(__powerpc64__)
 #   define VEX_HOST_WORDSIZE 4
 #elif defined(__arm__)
 #   define VEX_HOST_WORDSIZE 4
+#   define VEX_REGPARM(_n) /* */
 
 #elif defined(_AIX) && !defined(__64BIT__)
 #   define VEX_HOST_WORDSIZE 4
+#   define VEX_REGPARM(_n) /* */
 #elif defined(_AIX) && defined(__64BIT__)
 #   define VEX_HOST_WORDSIZE 8
+#   define VEX_REGPARM(_n) /* */
 
 #elif defined(__s390x__)
 #   define VEX_HOST_WORDSIZE 8
+#   define VEX_REGPARM(_n) /* */
 
 #else
 #   error "Vex: Fatal: Can't establish the host architecture"
index d005bf22929f311be6f0f173dccd21ce269abcfe..3b5b272c1655de8841e026ecb9f32843b704e792 100644 (file)
@@ -322,9 +322,10 @@ extern Bool eqIRConst ( IRConst*, IRConst* );
 /* Describes a helper function to call.  The name part is purely for
    pretty printing and not actually used.  regparms=n tells the back
    end that the callee has been declared
-   "__attribute__((regparm(n)))".  On some targets (x86) the back end
-   will need to construct a non-standard sequence to call a function
-   declared like this. 
+   "__attribute__((regparm(n)))", although indirectly using the
+   VEX_REGPARM(n) macro.  On some targets (x86) the back end will need
+   to construct a non-standard sequence to call a function declared
+   like this.
 
    mcx_mask is a sop to Memcheck.  It indicates which args should be
    considered 'always defined' when lazily computing definedness of