This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Add -Wsuggest-attribute=cold


+extern void do_something_interesting_and_never_return ();
+
+int
+foo1(int a)
+{ /* { dg-warning "cold" "detect cold candidate" { target *-*-* } "8" } */
+  if (a)
+    abort ();
+  else
+    abort ();
+}

In this case it looks to me like with the patch GCC will actually
issue two suggestions: the new -Wsuggest-attribute=cold and the
existing -Wsuggest-attrribute=noreturn.

It's probably fine to have the same function annotated with both
attributes but I think it would be nice to give just one suggestion,
and recommend the optimal of the two (presumably noreturn).

Martin

+
+int
+foo2(int a)
+{
+  if (a)
+    do_something_interesting_and_never_return ();
+  abort ();
+}



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]