check_function_arguments_recurse has an assert that is equivalent
to tree_fits_uhwi_p.  The extraction can then use tree_to_uhwi.

Asserting here makes the intent obvious, but tree_to_uhwi also asserts
for the same thing, so an alternative would be to use tree_to_uhwi on
its own.

Thanks,
Richard


gcc/c-family/
2013-11-19  Kenneth Zadeck  <zad...@naturalbridge.com>

        * c-common.c (check_function_arguments_recurse): Use tree_fits_uhwi_p
        and tree_to_uhwi.

Index: gcc/c-family/c-common.c
===================================================================
--- gcc/c-family/c-common.c     2013-11-19 10:53:54.965643984 +0000
+++ gcc/c-family/c-common.c     2013-11-19 11:08:41.797920627 +0000
@@ -9209,10 +9209,9 @@ check_function_arguments_recurse (void (
               to be valid.  */
            format_num_expr = TREE_VALUE (TREE_VALUE (attrs));
 
-           gcc_assert (TREE_CODE (format_num_expr) == INTEGER_CST
-                       && !TREE_INT_CST_HIGH (format_num_expr));
+           gcc_assert (tree_fits_uhwi_p (format_num_expr));
 
-           format_num = TREE_INT_CST_LOW (format_num_expr);
+           format_num = tree_to_uhwi (format_num_expr);
 
            for (inner_arg = first_call_expr_arg (param, &iter), i = 1;
                 inner_arg != 0;

Reply via email to