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]

patch for genoutput



I have following `define_insn':

(define_insn "*pop4"
  [(set (reg:HI 32) (plus:HI (reg:HI 32) (const_int 4)))]
  ""
  "pop __tmp_reg__
	pop __tmp_reg__
	pop __tmp_reg__
	pop __tmp_reg__"
  [(set_attr "length" "4")])

This `define_insn' have a multiline output template.
While GCC compile insn-output.c I have warnings:

insn-output.c:2569: warning: string constant runs past end of line
insn-output.c:2569: warning: ANSI C forbids newline in string constant

I can add a `\\n\\' to the end of each line in the output template,
but it seems ugly.

(define_insn "*pop4"
  [(set (reg:HI 32) (plus:HI (reg:HI 32) (const_int 4)))]
  ""
  "pop __tmp_reg__\\n\\
	pop __tmp_reg__\\n\\
	pop __tmp_reg__\\n\\
	pop __tmp_reg__"
  [(set_attr "length" "4")])

Sat Sep  9 19:50:09 2000  Denis Chertykov  <denisc@overta.ru>

	* genoutput.c (output_insn_data): Translate <NEWLINE> to \n\ while
	output templates with many lines.

Index: genoutput.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/genoutput.c,v
retrieving revision 1.55
diff -c -3 -p -r1.55 genoutput.c
*** genoutput.c	2000/05/28 02:17:58	1.55
--- genoutput.c	2000/09/10 06:55:46
*************** output_insn_data ()
*** 352,358 ****
  	  printf ("    0,\n");
  	  break;
  	case INSN_OUTPUT_FORMAT_SINGLE:
! 	  printf ("    \"%s\",\n", d->template);
  	  break;
  	case INSN_OUTPUT_FORMAT_MULTI:
  	case INSN_OUTPUT_FORMAT_FUNCTION:
--- 352,373 ----
  	  printf ("    0,\n");
  	  break;
  	case INSN_OUTPUT_FORMAT_SINGLE:
! 	  {
! 	    const char *p = d->template;
! 	    char prev = 0;
! 	    
! 	    printf ("    \"");
! 	    while (*p)
! 	      {
! 		if (*p == '\n' && prev != '\\')
! 		  printf ("\\n\\\n");
! 		else
! 		  putchar (*p);
! 		prev = *p;
! 		++p;
! 	      }
! 	    printf ("\",\n");
! 	  }
  	  break;
  	case INSN_OUTPUT_FORMAT_MULTI:
  	case INSN_OUTPUT_FORMAT_FUNCTION:


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