diff mbox

[2/2] Add full list of gcc attribute

Message ID CANeU7QmVL_qjs8du-_UetFekS=yPJh+T+Vn1YRGwDoLWckAQrQ@mail.gmail.com (mailing list archive)
State Mainlined, archived
Headers show

Commit Message

Christopher Li July 3, 2017, 6:43 p.m. UTC
This will greatly reduce the "unknown attribute" warning.

Chris
diff mbox

Patch

From ae8e894dc5b294ef7d31139aa1d19f0bceb82229 Mon Sep 17 00:00:00 2001
From: Christopher Li <sparse@chrisli.org>
Date: Mon, 3 Jul 2017 04:18:31 -0700
Subject: [PATCH 2/2] Add full list of gcc attribute

This will greatly reduce the "unknown attribute" warning.

Signed-off-By: <sparse@chrisli.org>
---
 gcc-attr-list.h | 204 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 parse.c         | 114 +++----------------------------
 2 files changed, 214 insertions(+), 104 deletions(-)
 create mode 100644 gcc-attr-list.h

diff --git a/gcc-attr-list.h b/gcc-attr-list.h
new file mode 100644
index 0000000..ec8cf44
--- /dev/null
+++ b/gcc-attr-list.h
@@ -0,0 +1,204 @@ 
+GCC_ATTR(BELOW100)
+GCC_ATTR(OS_Task)
+GCC_ATTR(OS_main)
+GCC_ATTR(OS_task)
+GCC_ATTR(abi_tag)
+GCC_ATTR(absdata)
+GCC_ATTR(address)
+GCC_ATTR(alias)
+GCC_ATTR(aligned)
+GCC_ATTR(alloc_align)
+GCC_ATTR(alloc_size)
+GCC_ATTR(altivec)
+GCC_ATTR(always_inline)
+GCC_ATTR(artificial)
+GCC_ATTR(assume_aligned)
+GCC_ATTR(bank_switch)
+GCC_ATTR(based)
+GCC_ATTR(below100)
+GCC_ATTR(bnd_instrument)
+GCC_ATTR(bnd_legacy)
+GCC_ATTR(bnd_variable_size)
+GCC_ATTR(break_handler)
+GCC_ATTR(brk_interrupt)
+GCC_ATTR(callee_pop_aggregate_return)
+GCC_ATTR(cb)
+GCC_ATTR(cdecl)
+GCC_ATTR(cleanup)
+GCC_ATTR(cmse_nonsecure_call)
+GCC_ATTR(cmse_nonsecure_entry)
+GCC_ATTR(cold)
+GCC_ATTR(common)
+GCC_ATTR(common_object)
+GCC_ATTR(const)
+GCC_ATTR(constructor)
+GCC_ATTR(critical)
+GCC_ATTR(default)
+GCC_ATTR(deprecated)
+GCC_ATTR(designated_init)
+GCC_ATTR(destructor)
+GCC_ATTR(disinterrupt)
+GCC_ATTR(dllexport)
+GCC_ATTR(dllimport)
+GCC_ATTR(eightbit_data)
+GCC_ATTR(either)
+GCC_ATTR(error)
+GCC_ATTR(exception)
+GCC_ATTR(exception_handler)
+GCC_ATTR(externally_visible)
+GCC_ATTR(fallthrough)
+GCC_ATTR(far)
+GCC_ATTR(fast_interrupt)
+GCC_ATTR(fastcall)
+GCC_ATTR(flatten)
+GCC_ATTR(force_align_arg_pointer)
+GCC_ATTR(format)
+GCC_ATTR(format_arg)
+GCC_ATTR(forwarder_section)
+GCC_ATTR(function_vector)
+GCC_ATTR(gcc_struct)
+GCC_ATTR(gnu_inline)
+GCC_ATTR(hidden)
+GCC_ATTR(hot)
+GCC_ATTR(hotpatch)
+GCC_ATTR(ifunc)
+GCC_ATTR(init_priority)
+GCC_ATTR(interfacearm)
+GCC_ATTR(internal)
+GCC_ATTR(interrupt)
+GCC_ATTR(interrupt_handler)
+GCC_ATTR(interrupt_thread)
+GCC_ATTR(io)
+GCC_ATTR(io_low)
+GCC_ATTR(isr)
+GCC_ATTR(keep_interrupts_masked)
+GCC_ATTR(kernel)
+GCC_ATTR(kspisusp)
+GCC_ATTR(l1_data)
+GCC_ATTR(l1_data_A)
+GCC_ATTR(l1_data_B)
+GCC_ATTR(l1_text)
+GCC_ATTR(l2)
+GCC_ATTR(leaf)
+GCC_ATTR(long_call)
+GCC_ATTR(longcall)
+GCC_ATTR(lower)
+GCC_ATTR(malloc)
+GCC_ATTR(may_alias)
+GCC_ATTR(maybe_unused)
+GCC_ATTR(medium_call)
+GCC_ATTR(micromips)
+GCC_ATTR(mips16)
+GCC_ATTR(mode)
+GCC_ATTR(model)
+GCC_ATTR(monitor)
+GCC_ATTR(ms_abi)
+GCC_ATTR(ms_hook_prologue)
+GCC_ATTR(ms_struct)
+GCC_ATTR(naked)
+GCC_ATTR(near)
+GCC_ATTR(nested)
+GCC_ATTR(nested_ready)
+GCC_ATTR(nesting)
+GCC_ATTR(nmi)
+GCC_ATTR(nmi_handler)
+GCC_ATTR(no_address_safety_analysis)
+GCC_ATTR(no_caller_saved_registers)
+GCC_ATTR(no_icf)
+GCC_ATTR(no_instrument_function)
+GCC_ATTR(no_profile_instrument_function)
+GCC_ATTR(no_reorder)
+GCC_ATTR(no_sanitize)
+GCC_ATTR(no_sanitize_address)
+GCC_ATTR(no_sanitize_thread)
+GCC_ATTR(no_sanitize_undefined)
+GCC_ATTR(no_split_stack)
+GCC_ATTR(no_stack_limit)
+GCC_ATTR(noclone)
+GCC_ATTR(nocommon)
+GCC_ATTR(nocompression)
+GCC_ATTR(nodiscard)
+GCC_ATTR(noinit)
+GCC_ATTR(noinline)
+GCC_ATTR(nomicromips)
+GCC_ATTR(nomips16)
+GCC_ATTR(nonnull)
+GCC_ATTR(noplt)
+GCC_ATTR(noreturn)
+GCC_ATTR(nosave_low_regs)
+GCC_ATTR(not_nested)
+GCC_ATTR(nothrow)
+GCC_ATTR(notshared)
+GCC_ATTR(optimize)
+GCC_ATTR(packed)
+GCC_ATTR(partial_save)
+GCC_ATTR(pcs)
+GCC_ATTR(persistent)
+GCC_ATTR(progmem)
+GCC_ATTR(protected)
+GCC_ATTR(pure)
+GCC_ATTR(reentrant)
+GCC_ATTR(regparm)
+GCC_ATTR(renesas)
+GCC_ATTR(resbank)
+GCC_ATTR(reset)
+GCC_ATTR(returns_nonnull)
+GCC_ATTR(returns_twice)
+GCC_ATTR(s390_vector_bool)
+GCC_ATTR(saddr)
+GCC_ATTR(save_all)
+GCC_ATTR(save_volatiles)
+GCC_ATTR(saveall)
+GCC_ATTR(scalar_storage_order)
+GCC_ATTR(sda)
+GCC_ATTR(section)
+GCC_ATTR(selectany)
+GCC_ATTR(sentinel)
+GCC_ATTR(shared)
+GCC_ATTR(short_call)
+GCC_ATTR(shortcall)
+GCC_ATTR(signal)
+GCC_ATTR(simd)
+GCC_ATTR(sp_switch)
+GCC_ATTR(spu_vector)
+GCC_ATTR(sseregparm)
+GCC_ATTR(stack_protect)
+GCC_ATTR(stdcall)
+GCC_ATTR(syscall_linkage)
+GCC_ATTR(sysv_abi)
+GCC_ATTR(target)
+GCC_ATTR(target_clones)
+GCC_ATTR(tda)
+GCC_ATTR(thiscall)
+GCC_ATTR(tiny)
+GCC_ATTR(tiny_data)
+GCC_ATTR(tls_model)
+GCC_ATTR(transaction_callable)
+GCC_ATTR(transaction_may_cancel_outer)
+GCC_ATTR(transaction_pure)
+GCC_ATTR(transaction_safe)
+GCC_ATTR(transaction_safe_dynamic)
+GCC_ATTR(transaction_unsafe)
+GCC_ATTR(transaction_wrap)
+GCC_ATTR(transparent_union)
+GCC_ATTR(trap_exit)
+GCC_ATTR(trapa_handler)
+GCC_ATTR(unused)
+GCC_ATTR(upper)
+GCC_ATTR(use_debug_exception_return)
+GCC_ATTR(use_shadow_register_set)
+GCC_ATTR(used)
+GCC_ATTR(vector)
+GCC_ATTR(vector_size)
+GCC_ATTR(version_id)
+GCC_ATTR(visibility)
+GCC_ATTR(vliw)
+GCC_ATTR(volatile)
+GCC_ATTR(wakeup)
+GCC_ATTR(warm)
+GCC_ATTR(warn_unused)
+GCC_ATTR(warn_unused_result)
+GCC_ATTR(warning)
+GCC_ATTR(weak)
+GCC_ATTR(weakref)
+GCC_ATTR(zda)
diff --git a/parse.c b/parse.c
index 953d04b..02a55a7 100644
--- a/parse.c
+++ b/parse.c
@@ -540,116 +540,22 @@  static struct init_keyword {
 	{ "__word__",	NS_KEYWORD,	MOD_LONG,	.op = &mode_word_op },
 };
 
+
 static const char *ignored_attributes[] = {
-	"alias",
-	"__alias__",
-	"alloc_align",
-	"__alloc_align__",
-	"alloc_size",
-	"__alloc_size__",
-	"always_inline",
-	"__always_inline__",
-	"artificial",
-	"__artificial__",
-	"assume_aligned",
-	"__assume_aligned__",
+
+#define GCC_ATTR(x)		\
+	STRINGIFY(x), 		\
+	STRINGIFY(__##x##__),
+
+#include "gcc-attr-list.h"
+
+#undef GCC_ATTR
+
 	"bounded",
 	"__bounded__",
-	"cdecl",
-	"__cdecl__",
-	"cold",
-	"__cold__",
-	"constructor",
-	"__constructor__",
-	"deprecated",
-	"__deprecated__",
-	"destructor",
-	"__destructor__",
-	"dllexport",
-	"__dllexport__",
-	"dllimport",
-	"__dllimport__",
-	"error",
-	"__error__",
-	"externally_visible",
-	"__externally_visible__",
-	"fastcall",
-	"__fastcall__",
-	"format",
-	"__format__",
-	"format_arg",
-	"__format_arg__",
-	"gnu_inline",
-	"__gnu_inline__",
-	"hot",
-	"__hot__",
-	"hotpatch",
-	"__hotpatch__",
-        "leaf",
-        "__leaf__",
-	"l1_text",
-	"__l1_text__",
-	"l1_data",
-	"__l1_data__",
-	"l2",
-	"__l2__",
-	"malloc",
-	"__malloc__",
-	"may_alias",
-	"__may_alias__",
-	"model",
-	"__model__",
-	"ms_abi",
-	"__ms_abi__",
-	"ms_hook_prologue",
-	"__ms_hook_prologue__",
-	"naked",
-	"__naked__",
-	"no_instrument_function",
-	"__no_instrument_function__",
-	"no_sanitize_address",
-	"__no_sanitize_address__",
-	"noclone",
 	"__noclone",
-	"__noclone__",
-	"noinline",
-	"__noinline__",
-	"nonnull",
 	"__nonnull",
-	"__nonnull__",
-	"nothrow",
 	"__nothrow",
-	"__nothrow__",
-	"optimize",
-	"__optimize__",
-	"regparm",
-	"__regparm__",
-	"section",
-	"__section__",
-	"sentinel",
-	"__sentinel__",
-	"signal",
-	"__signal__",
-	"stdcall",
-	"__stdcall__",
-	"syscall_linkage",
-	"__syscall_linkage__",
-	"sysv_abi",
-	"__sysv_abi__",
-	"unused",
-	"__unused__",
-	"used",
-	"__used__",
-	"vector_size",
-	"__vector_size__",
-	"visibility",
-	"__visibility__",
-	"warn_unused_result",
-	"__warn_unused_result__",
-	"warning",
-	"__warning__",
-	"weak",
-	"__weak__",
 };
 
 
-- 
2.9.4