patches/gcc/4.3.0/210-pr35440.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Wed Jan 13 20:46:01 2010 +0100 (2010-01-13)
changeset 1732 6b2ae7804c6f
parent 746 b150d6f590fc
permissions -rw-r--r--
debug/gdb: staticaly link to ncurses for the native gdb

Staticaly link the native gdb (the one that runs on the target,
not the cross one that runs on the host) to ncurses.
     1 Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/gentoo/60_all_gcc43-pr35440.patch
     2 2008-03-19  Jakub Jelinek  <jakub@redhat.com>
     3 
     4 	PR c/35440
     5 	* c-pretty-print.c (pp_c_initializer_list): Handle CONSTRUCTOR
     6 	for all types.
     7 
     8 	* gcc.dg/pr35440.c: New test.
     9 
    10 diff -durN gcc-4.3.0.orig/gcc/c-pretty-print.c gcc-4.3.0/gcc/c-pretty-print.c
    11 --- gcc-4.3.0.orig/gcc/c-pretty-print.c	2008-01-29 14:59:59.000000000 +0100
    12 +++ gcc-4.3.0/gcc/c-pretty-print.c	2008-06-10 14:44:54.000000000 +0200
    13 @@ -1173,6 +1173,12 @@
    14    tree type = TREE_TYPE (e);
    15    const enum tree_code code = TREE_CODE (type);
    16  
    17 +  if (TREE_CODE (e) == CONSTRUCTOR)
    18 +    {
    19 +      pp_c_constructor_elts (pp, CONSTRUCTOR_ELTS (e));
    20 +      return;
    21 +    }
    22 +
    23    switch (code)
    24      {
    25      case RECORD_TYPE:
    26 @@ -1207,16 +1213,12 @@
    27      case VECTOR_TYPE:
    28        if (TREE_CODE (e) == VECTOR_CST)
    29  	pp_c_expression_list (pp, TREE_VECTOR_CST_ELTS (e));
    30 -      else if (TREE_CODE (e) == CONSTRUCTOR)
    31 -	pp_c_constructor_elts (pp, CONSTRUCTOR_ELTS (e));
    32        else
    33  	break;
    34        return;
    35  
    36      case COMPLEX_TYPE:
    37 -      if (TREE_CODE (e) == CONSTRUCTOR)
    38 -	pp_c_constructor_elts (pp, CONSTRUCTOR_ELTS (e));
    39 -      else if (TREE_CODE (e) == COMPLEX_CST || TREE_CODE (e) == COMPLEX_EXPR)
    40 +      if (TREE_CODE (e) == COMPLEX_CST || TREE_CODE (e) == COMPLEX_EXPR)
    41  	{
    42  	  const bool cst = TREE_CODE (e) == COMPLEX_CST;
    43  	  pp_expression (pp, cst ? TREE_REALPART (e) : TREE_OPERAND (e, 0));
    44 diff -durN gcc-4.3.0.orig/gcc/testsuite/gcc.dg/pr35440.c gcc-4.3.0/gcc/testsuite/gcc.dg/pr35440.c
    45 --- gcc-4.3.0.orig/gcc/testsuite/gcc.dg/pr35440.c	1970-01-01 01:00:00.000000000 +0100
    46 +++ gcc-4.3.0/gcc/testsuite/gcc.dg/pr35440.c	2008-06-10 14:44:54.000000000 +0200
    47 @@ -0,0 +1,12 @@
    48 +/* PR c/35440 */
    49 +/* { dg-do compile } */
    50 +/* { dg-options "-std=gnu99" } */
    51 +
    52 +struct A {};
    53 +struct B { int i; char j[2]; };
    54 +
    55 +void foo (void)
    56 +{
    57 +  (struct A){}();			/* { dg-error "called object" } */
    58 +  (struct B){ .i = 2, .j[1] = 1 }();	/* { dg-error "called object" } */
    59 +}