On 04/28/2015 09:01 PM, Aldy Hernandez wrote:

The approach looks good to me.

-  analyze_functions ();
+  analyze_functions (true);

In the C++ front end at least we comment anonymous boolean arguments, i.e.

 analyze_functions (/*first_time*/true);

Let's do that here, too.  Similarly for the calls to referred_to_p (false).

+      /* ?? Why are we looking at TREE_USED?  Shouldn't the call to
+        referred_to_p above be enough?  Apparently not, because the
+        `__unused__' attribute is not being considered for
+        referred_to_p.  */

Seems like you answered your question.  :)

+      /* Global ctors and dtors are called by the runtime.  */
+      && (TREE_CODE (decl) != FUNCTION_DECL
+         || (!DECL_STATIC_CONSTRUCTOR (decl)
+             && !DECL_STATIC_DESTRUCTOR (decl)))

Maybe check snode->needed_p instead?

Jason


Reply via email to