lkml.org 
[lkml]   [2012]   [Sep]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    SubjectRe: [PATCH v2 03/12] perf tools: include __WORDSIZE definition
    From
    On Sat, Sep 8, 2012 at 3:43 AM, Irina Tirdea <irina.tirdea@gmail.com> wrote:
    > From: Irina Tirdea <irina.tirdea@intel.com>
    >
    > __WORDSIZE is GLibC-specific and is not defined on all systems or glibc
    > versions (e.g. Android's bionic does not define it).
    >
    > In file included from util/include/linux/bitmap.h:5:0,
    > from util/header.h:10,
    > from util/session.h:6,
    > from util/build-id.h:4,
    > from util/annotate.c:11:
    > util/include/linux/bitops.h: In function 'set_bit':
    > util/include/linux/bitops.h:25:12: error:
    > '__WORDSIZE' undeclared (first use in this function)
    > util/include/linux/bitops.h:25:12: note:
    > each undeclared identifier is reported only once for each function it appears in
    > util/include/linux/bitops.h:23:51: error:
    > parameter 'addr' set but not used [-Werror=unused-but-set-parameter]
    > util/include/linux/bitops.h: In function 'clear_bit':
    > util/include/linux/bitops.h:30:12: error:
    > '__WORDSIZE' undeclared (first use in this function)
    > util/include/linux/bitops.h:28:53: error:
    > parameter 'addr' set but not used [-Werror=unused-but-set-parameter]
    > In file included from util/header.h:10:0,
    > from util/session.h:6,
    > from util/build-id.h:4,
    > from util/annotate.c:11:
    > util/include/linux/bitmap.h: In function 'bitmap_zero':
    > util/include/linux/bitmap.h:22:6: error:
    > '__WORDSIZE' undeclared (first use in this function)
    >
    > Defining __WORDSIZE in perf's headers if it is not already defined.
    >
    > Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
    > ---
    > tools/perf/util/include/linux/bitops.h | 9 +++++++++
    > 1 file changed, 9 insertions(+)
    >
    > diff --git a/tools/perf/util/include/linux/bitops.h b/tools/perf/util/include/linux/bitops.h
    > index 587a230..91779ec 100644
    > --- a/tools/perf/util/include/linux/bitops.h
    > +++ b/tools/perf/util/include/linux/bitops.h
    > @@ -5,6 +5,15 @@
    > #include <linux/compiler.h>
    > #include <asm/hweight.h>
    >
    > +#ifndef __WORDSIZE
    > +#if defined(__x86_64__)
    > +# define __WORDSIZE 64
    > +#endif
    > +#if defined(__i386__) || defined(__arm__)
    > +# define __WORDSIZE 32
    > +#endif
    > +#endif

    Why not use "sizeof(unsigned long) * 8" ?


    \
     
     \ /
      Last update: 2012-09-08 11:41    [W:2.993 / U:0.260 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site