Patchwork fix libbacktrace build failure on arm-linux

login
register
mail settings
Submitter Matthias Klose
Date Oct. 7, 2012, 10:01 a.m.
Message ID <50715316.50704@ubuntu.com>
Download mbox | patch
Permalink /patch/189796/
State New
Headers show

Comments

Matthias Klose - Oct. 7, 2012, 10:01 a.m.
On 06.10.2012 22:46, Ian Lance Taylor wrote:
> On Sat, Oct 6, 2012 at 8:09 AM, Matthias Klose <doko@ubuntu.com> wrote:
>> current trunk fails to build on arm-linux with:
>>
>> In file included from ../../../../src/libbacktrace/backtrace.c:35:0:
>> ../libgcc/unwind.h: In function '_Unwind_decode_typeinfo_ptr':
>> ../libgcc/unwind.h:42:45: error: unused parameter 'base' [-Werror=unused-parameter]
>>    _Unwind_decode_typeinfo_ptr (_Unwind_Word base, _Unwind_Word ptr)
>>                                              ^
>> ../libgcc/unwind.h: In function '__gnu_unwind_24bit':
>> ../libgcc/unwind.h:68:41: error: unused parameter 'context'
>> [-Werror=unused-parameter]
>>    __gnu_unwind_24bit (_Unwind_Context * context, _uw data, int compact)
>>                                          ^
>> ../libgcc/unwind.h:68:54: error: unused parameter 'data' [-Werror=unused-parameter]
>>    __gnu_unwind_24bit (_Unwind_Context * context, _uw data, int compact)
>>                                                       ^
>> ../libgcc/unwind.h:68:64: error: unused parameter 'compact'
>> [-Werror=unused-parameter]
>>    __gnu_unwind_24bit (_Unwind_Context * context, _uw data, int compact)
>>                                                                 ^
>> cc1: all warnings being treated as errors
>> make[8]: *** [backtrace.lo] Error 1
>>
>> the immediate fix is to mark all arguments as unused, however I don't know if
>> this function should be used by libbacktrace, if it returns _URC_FAILURE
>> unconditionally.
> 
> The function is not used by libbacktrace.  It's an inline function
> defined in the header file, and the warning is about the inline
> function definition.  That is, this is a libgcc bug, not a
> libbacktrace bug, it just happens to show up when compiling
> libbacktrace for ARM
> 
> 
>>         * config/arm/unwind-arm.h (__gnu_unwind_24bit): Mark parameters
>>         as unused.
>>
>>
>> --- libgcc/config/arm/unwind-arm.h      (revision 192162)
>> +++ libgcc/config/arm/unwind-arm.h      (working copy)
>> @@ -64,8 +64,11 @@
>>        return tmp;
>>      }
>>
>> +#define __unused __attribute__((unused))
>> +
>>    static inline _Unwind_Reason_Code
>> -  __gnu_unwind_24bit (_Unwind_Context * context, _uw data, int compact)
>> +  __gnu_unwind_24bit (_Unwind_Context * context __unused, _uw data __unused,
>> +                      int compact __unused)
>>      {
>>        return _URC_FAILURE;
>>      }
> 
> Don't #define __unused.  Just write __attribute__ ((unused)) on the
> parameters.  Break the lines as needed.
> 
> This is OK with that change.

committed the following. the base parameter in _Unwind_decode_typeinfo_ptr
is unused too.

  Matthias

2012-10-07  Matthias Klose  <doko@ubuntu.com>

        * config/arm/unwind-arm.h (__gnu_unwind_24bit): Mark parameters
        as unused.
        (_Unwind_decode_typeinfo_ptr): Mark base as unused.

Patch

Index: libgcc/config/arm/unwind-arm.h
===================================================================
--- a/src/libgcc/config/arm/unwind-arm.h        (revision 192162)
+++ b/src/libgcc/config/arm/unwind-arm.h        (working copy)
@@ -39,7 +39,8 @@ 
 #endif
   /* Decode an R_ARM_TARGET2 relocation.  */
   static inline _Unwind_Word
-  _Unwind_decode_typeinfo_ptr (_Unwind_Word base, _Unwind_Word ptr)
+  _Unwind_decode_typeinfo_ptr (_Unwind_Word base __attribute__ ((unused)),
+                               _Unwind_Word ptr)
     {
       _Unwind_Word tmp;

@@ -65,7 +66,9 @@ 
     }

   static inline _Unwind_Reason_Code
-  __gnu_unwind_24bit (_Unwind_Context * context, _uw data, int compact)
+  __gnu_unwind_24bit (_Unwind_Context * context __attribute__ ((unused)),
+                      _Unwind_Context *_uw data __attribute__ ((unused)),
+                      int compact __attribute__ ((unused)))
     {
       return _URC_FAILURE;
     }