Skip to contentSkip to conversation

Ignore "cold" and "hot" attributes, which appeared in gcc 4.3

PATCH New Pavel Roskin 1 participant 1 message Apr 25, 2008 Sparse checker

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Ignore "cold" and "hot" attributes, which appeared in gcc 4.3

They describe how likely the function is to be executed, which can affect optimization. Also ignore attributes with underscores.

---

 ident-list.h |    2 ++
 parse.c      |    4 ++++
 2 files changed, 6 insertions(+), 0 deletions(-)
ident-list.h +2 -0
index 8fcd7de..6104826 100644
@@ -74,6 +74,8 @@ IDENT(__malloc__);
 IDENT(nonnull); IDENT(__nonnull); IDENT(__nonnull__);
 IDENT(constructor); IDENT(__constructor__);
 IDENT(destructor); IDENT(__destructor__);
+IDENT(cold); IDENT(__cold__);
+IDENT(hot); IDENT(__hot__);
 IDENT(cdecl); IDENT(__cdecl__);
 IDENT(stdcall); IDENT(__stdcall__);
 IDENT(fastcall); IDENT(__fastcall__);
parse.c +4 -0
index 137ba77..877414c 100644
@@ -353,6 +353,10 @@ static struct init_keyword {
 	{ "__constructor__",	NS_KEYWORD,	.op = &ignore_attr_op },
 	{ "destructor",	NS_KEYWORD,	.op = &ignore_attr_op },
 	{ "__destructor__",	NS_KEYWORD,	.op = &ignore_attr_op },
+	{ "cold",	NS_KEYWORD,	.op = &ignore_attr_op },
+	{ "__cold__",	NS_KEYWORD,	.op = &ignore_attr_op },
+	{ "hot",	NS_KEYWORD,	.op = &ignore_attr_op },
+	{ "__hot__",	NS_KEYWORD,	.op = &ignore_attr_op },
 };
 
 void init_parser(int stream)