Commit 909881cb by Eric Botcazou

c-ada-spec.c (ADA_HOST_WIDE_INT_PRINT_DOUBLE_HEX): Define.

	* c-ada-spec.c (ADA_HOST_WIDE_INT_PRINT_DOUBLE_HEX): Define.
	(dump_generic_ada_node) <INTEGER_CST>: Deal with sizetype specially.
	Remove POINTER_TYPE handling, add large unsigned handling and use
	ADA_HOST_WIDE_INT_PRINT_DOUBLE_HEX for big numbers.

From-SVN: r192489
parent a4da41e1
2012-10-16 Eric Botcazou <ebotcazou@adacore.com>
* c-ada-spec.c (ADA_HOST_WIDE_INT_PRINT_DOUBLE_HEX): Define.
(dump_generic_ada_node) <INTEGER_CST>: Deal with sizetype specially.
Remove POINTER_TYPE handling, add large unsigned handling and use
ADA_HOST_WIDE_INT_PRINT_DOUBLE_HEX for big numbers.
2012-10-12 Jakub Jelinek <jakub@redhat.com> 2012-10-12 Jakub Jelinek <jakub@redhat.com>
PR c/54381 PR c/54381
......
...@@ -30,6 +30,21 @@ along with GCC; see the file COPYING3. If not see ...@@ -30,6 +30,21 @@ along with GCC; see the file COPYING3. If not see
#include "c-pragma.h" #include "c-pragma.h"
#include "cpp-id-data.h" #include "cpp-id-data.h"
/* Adapted from hwint.h to use the Ada prefix. */
#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
# if HOST_BITS_PER_WIDE_INT == 64
# define ADA_HOST_WIDE_INT_PRINT_DOUBLE_HEX \
"16#%" HOST_LONG_FORMAT "x%016" HOST_LONG_FORMAT "x#"
# else
# define ADA_HOST_WIDE_INT_PRINT_DOUBLE_HEX \
"16#%" HOST_LONG_FORMAT "x%08" HOST_LONG_FORMAT "x#"
# endif
#else
/* We can assume that 'long long' is at least 64 bits. */
# define ADA_HOST_WIDE_INT_PRINT_DOUBLE_HEX \
"16#%" HOST_LONG_LONG_FORMAT "x%016" HOST_LONG_LONG_FORMAT "x#"
#endif /* HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG */
/* Local functions, macros and variables. */ /* Local functions, macros and variables. */
static int dump_generic_ada_node (pretty_printer *, tree, tree, static int dump_generic_ada_node (pretty_printer *, tree, tree,
int (*)(tree, cpp_operation), int, int, bool); int (*)(tree, cpp_operation), int, int, bool);
...@@ -2175,12 +2190,16 @@ dump_generic_ada_node (pretty_printer *buffer, tree node, tree type, ...@@ -2175,12 +2190,16 @@ dump_generic_ada_node (pretty_printer *buffer, tree node, tree type,
break; break;
case INTEGER_CST: case INTEGER_CST:
if (TREE_CODE (TREE_TYPE (node)) == POINTER_TYPE) /* We treat the upper half of the sizetype range as negative. This
{ is consistent with the internal treatment and makes it possible
pp_wide_integer (buffer, TREE_INT_CST_LOW (node)); to generate the (0 .. -1) range for flexible array members. */
pp_string (buffer, "B"); /* pseudo-unit */ if (TREE_TYPE (node) == sizetype)
} node = fold_convert (ssizetype, node);
else if (!host_integerp (node, 0)) if (host_integerp (node, 0))
pp_wide_integer (buffer, TREE_INT_CST_LOW (node));
else if (host_integerp (node, 1))
pp_unsigned_wide_integer (buffer, TREE_INT_CST_LOW (node));
else
{ {
tree val = node; tree val = node;
unsigned HOST_WIDE_INT low = TREE_INT_CST_LOW (val); unsigned HOST_WIDE_INT low = TREE_INT_CST_LOW (val);
...@@ -2193,12 +2212,10 @@ dump_generic_ada_node (pretty_printer *buffer, tree node, tree type, ...@@ -2193,12 +2212,10 @@ dump_generic_ada_node (pretty_printer *buffer, tree node, tree type,
low = -low; low = -low;
} }
sprintf (pp_buffer (buffer)->digit_buffer, sprintf (pp_buffer (buffer)->digit_buffer,
HOST_WIDE_INT_PRINT_DOUBLE_HEX, ADA_HOST_WIDE_INT_PRINT_DOUBLE_HEX,
(unsigned HOST_WIDE_INT) high, low); (unsigned HOST_WIDE_INT) high, low);
pp_string (buffer, pp_buffer (buffer)->digit_buffer); pp_string (buffer, pp_buffer (buffer)->digit_buffer);
} }
else
pp_wide_integer (buffer, TREE_INT_CST_LOW (node));
break; break;
case REAL_CST: case REAL_CST:
......
2012-10-15 Easwaran Raman <eraman@google.com> 2012-10-16 Eric Botcazou <ebotcazou@adacore.com>
* g++.dg/other/dump-ada-spec-2.C: New test.
2012-10-16 Easwaran Raman <eraman@google.com>
* gcc.dg/tree-prof/switch-case-1.c: New test case. * gcc.dg/tree-prof/switch-case-1.c: New test case.
* gcc.dg/tree-prof/switch-case-2.c: New test case. * gcc.dg/tree-prof/switch-case-2.c: New test case.
......
/* { dg-do compile } */
/* { dg-options "-fdump-ada-spec" } */
struct S
{
int it;
__extension__ unsigned char data[];
};
/* { dg-final { scan-ada-spec "array \\(0 .. -1\\)" } } */
/* { dg-final { cleanup-ada-spec } } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment