Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 07590a7d authored by Ingo Molnar's avatar Ingo Molnar
Browse files

Merge tag 'perf-core-for-mingo-4.12-20170419' of...

Merge tag 'perf-core-for-mingo-4.12-20170419' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux

 into perf/core

Pull perf/core cleanups from Arnaldo Carvalho de Melo:

 - Introduce new header files out of the hodge-podge that util/util.h
   became, trying to disentangle the includes hell that all C projects
   end up growing. This should help in build times, as changes to
   seemingly unrelated files (util.h included tons of headers) won't
   trigger a rebuild of most object files.

 - Use equivalent facilities found in the kernel source code base
   originated tools/include/ header files, such as __stringify(),
   ARRAY_SIZE, that has extra checks (__must_be_array()), etc.

 - For that get some more files from the kernel sources, like
   include/linux/bug.h, some just with the bits needed at this time.

 - Use the headers where facilities declared in them are used, such
   as PRIxu(32,64) macros (inttypes.h), errno defines (errno.h), etc.

 - Remove various leftovers from the initial code base we copied from
   git.git: FLEX_ARRAY, etc.

Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parents afa7a17f 1b5ad16c
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
#ifndef _TOOLS_PERF_LINUX_BUG_H
#define _TOOLS_PERF_LINUX_BUG_H

/* Force a compilation error if condition is true, but also produce a
   result (of value 0 and type size_t), so the expression can be used
   e.g. in a structure initializer (or where-ever else comma expressions
   aren't permitted). */
#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))

#endif	/* _TOOLS_PERF_LINUX_BUG_H */
+3 −0
Original line number Diff line number Diff line
@@ -16,3 +16,6 @@
#if GCC_VERSION >= 40300
# define __compiletime_error(message) __attribute__((error(message)))
#endif /* GCC_VERSION >= 40300 */

/* &a[0] degrades to a pointer: a different type from an array */
#define __must_be_array(a)	BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
+5 −0
Original line number Diff line number Diff line
@@ -17,6 +17,11 @@
# define __always_inline	inline __attribute__((always_inline))
#endif

/* Are two types/vars the same type (ignoring qualifiers)? */
#ifndef __same_type
# define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
#endif

#ifdef __ANDROID__
/*
 * FIXME: Big hammer to get rid of tons of:
+0 −4
Original line number Diff line number Diff line
@@ -13,10 +13,6 @@
#include <linux/hash.h>
#include <linux/log2.h>

#ifndef ARRAY_SIZE
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#endif

#define DEFINE_HASHTABLE(name, bits)						\
	struct hlist_head name[1 << (bits)] =					\
			{ [0 ... ((1 << (bits)) - 1)] = HLIST_HEAD_INIT }
+3 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@
#include <stdarg.h>
#include <stddef.h>
#include <assert.h>
#include <linux/compiler.h>

#ifndef UINT_MAX
#define UINT_MAX	(~0U)
@@ -76,6 +77,8 @@
int vscnprintf(char *buf, size_t size, const char *fmt, va_list args);
int scnprintf(char * buf, size_t size, const char * fmt, ...);

#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))

/*
 * This looks more complex than it should be. But we need to
 * get the type for the ~ right in round_down (it needs to be
Loading