linux-stable/tools/include/linux
Nathan Chancellor d0ee23f9d7 tools: compiler-gcc.h: Guard error attribute use with __has_attribute
When building objtool with HOSTCC=clang, there are several errors along
the lines of

  orc_dump.c:201:28: error: unknown attribute 'error' ignored [-Werror,-Wunknown-attributes]

This occurs after commit 4e59869aa6 ("compiler-gcc.h: drop checks for
older GCC versions"), which removed the GCC_VERSION gating.  The removed
version check just so happened to prevent __compiletime_error() from
being defined with clang because it pretends to be GCC 4.2.1 for
compatibility but the error attribute was not added to clang until
14.0.0.

Commit 815f0ddb34 ("include/linux/compiler*.h: make compiler-*.h
mutually exclusive") and commit a3f8a30f3f ("Compiler Attributes: use
feature checks instead of version checks") refactored the handling of
attributes in the main kernel to avoid situations like this but that
refactoring has never been done for the tools directory.

Refactoring is a rather large undertaking and this has never been an
issue before so instead, just guard the definition of
__compiletime_error() with __has_attribute() so that there are no more
errors.

Fixes: 4e59869aa6 ("compiler-gcc.h: drop checks for older GCC versions")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-09-13 15:51:41 -07:00
..
sched
unaligned
atomic.h
bitmap.h tools: rename bitmap_alloc() to bitmap_zalloc() 2021-09-08 11:50:27 -07:00
bitops.h bitops: more BITS_TO_* macros 2020-02-04 03:05:26 +00:00
bits.h linux/bits.h: fix compilation error with GENMASK 2021-05-22 15:09:07 -10:00
btf_ids.h btf: Add BTF_ID_LIST_SINGLE macro 2020-09-21 15:00:40 -07:00
bug.h
build_bug.h tools headers: Syncronize linux/build_bug.h with the kernel sources 2021-01-15 16:31:46 -03:00
compiler-gcc.h tools: compiler-gcc.h: Guard error attribute use with __has_attribute 2021-09-13 15:51:41 -07:00
compiler.h tools headers: Get tools's linux/compiler.h closer to the kernel's 2020-12-18 17:32:26 -03:00
compiler_types.h tools: Add sparse context/locking annotations in compiler-types.h 2021-08-19 15:39:22 -03:00
const.h linux/bits.h: fix compilation error with GENMASK 2021-05-22 15:09:07 -10:00
coresight-pmu.h tools headers UAPI: Update tools' copy of linux/coresight-pmu.h 2021-03-06 16:54:30 -03:00
ctype.h tools headers: Update linux/ctype.h with the kernel sources 2020-12-18 17:32:28 -03:00
debug_locks.h
delay.h
err.h docs: fix broken documentation links 2019-06-08 13:42:13 -06:00
export.h module: remove EXPORT_UNUSED_SYMBOL* 2021-02-08 12:28:07 +01:00
filter.h bpf: Add bitwise atomic instructions 2021-01-14 18:34:29 -08:00
ftrace.h
gfp.h
hardirq.h
hash.h
hashtable.h
interrupt.h
irqflags.h lockdep: Remove lockdep_hardirq{s_enabled,_context}() argument 2020-07-10 12:00:02 +02:00
jhash.h tools/: replace HTTP links with HTTPS ones 2020-08-07 11:33:21 -07:00
kallsyms.h kallsyms/printk: add loglvl to print_ip_sym() 2020-06-09 09:39:10 -07:00
kconfig.h tools headers: Remove broken definition of __LITTLE_ENDIAN 2021-07-14 14:39:36 -03:00
kern_levels.h
kernel.h tools headers: Synchronize linux/bits.h with the kernel sources 2020-04-14 11:40:05 -03:00
linkage.h
list.h
lockdep.h tools/lib/lockdep: Add dummy task_struct state member 2018-09-10 13:48:24 +02:00
log2.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
math64.h tools include: Add an initial math64.h 2021-04-15 16:38:02 -03:00
module.h
mutex.h
nmi.h
numa.h tools/: replace open encodings for NUMA_NO_NODE 2019-03-05 21:07:14 -08:00
objtool.h objtool: Combine UNWIND_HINT_RET_OFFSET and UNWIND_HINT_FUNC 2021-01-26 11:12:00 -06:00
overflow.h compiler.h: drop fallback overflow checkers 2021-09-13 10:18:28 -07:00
poison.h mm, page_poison: remove CONFIG_PAGE_POISONING_ZERO 2020-12-15 12:13:46 -08:00
proc_fs.h
rbtree.h rbtree: Add generic add and find helpers 2021-02-17 14:07:31 +01:00
rbtree_augmented.h docs: Add rbtree documentation to the core-api 2020-04-21 10:29:19 -06:00
rcu.h rcu: Don't return a value from rcu_assign_pointer() 2019-06-13 15:38:34 -07:00
refcount.h
ring_buffer.h tools headers: Add missing perf_event.h include 2019-08-22 11:12:36 -03:00
seq_file.h
sizes.h tools: bpftool: add "prog run" subcommand to test-run programs 2019-07-05 23:48:07 +02:00
spinlock.h xarray: Add XArray unconditional store operations 2018-10-21 10:45:57 -04:00
stacktrace.h
static_call_types.h static_call: Move struct static_call_key definition to static_call_types.h 2021-03-11 16:04:39 +01:00
string.h tools lib: Adopt memchr_inv() from kernel 2020-11-27 08:34:52 -03:00
stringify.h
time64.h
types.h tools include: Add __sum16 and __wsum definitions. 2021-03-08 10:42:03 -03:00
zalloc.h tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00