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]
Other format: [Raw text]

[Patch/testsuite] : gcc.dg/compat/struct-layout-1_generate.c fixes


Hello,

Two problems I ran into with testsuite/gcc.dg/compat/struct-layout-1_generate.c

1) ffsll() is not available on all targets.  We could supply a my_ffsll but
 __builtin_ffsll does the job too.

2) When trying to track individual failures using #define DBG = 1, stdout
isn't necessarily flushed when abort is called, so we lose the test
identifiers.


The following fixes:

testsuite/ChangeLog

2004-11-01  Danny Smith  <dannysmith@users.sourceforge.net>

	* gcc.dg/compat/struct-layout-1_generate.c (main): Generate a
	call to fflush(stdout) before abort.
	(generate_fields): Use __builtin_ffsll.

Index: gcc.dg/compat/struct-layout-1_generate.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c,v
retrieving revision 1.2
diff -c -3 -p -r1.2 struct-layout-1_generate.c
*** gcc.dg/compat/struct-layout-1_generate.c	15 Oct 2004 17:22:41 -0000	1.2
--- gcc.dg/compat/struct-layout-1_generate.c	1 Nov 2004 07:40:56 -0000
*************** int main (void)\n\
*** 563,569 ****
  #include \"t%03d_test.h\"\n\
  #undef TX\n\
    if (fails)\n\
!     abort ();\n\
    exit (0);\n\
  }\n", srcdir, srcdir, filecnt, filecnt);
    fclose (outfile);
--- 563,572 ----
  #include \"t%03d_test.h\"\n\
  #undef TX\n\
    if (fails)\n\
!     {\n\
!       fflush (stdout);\n\ 
!       abort ();\n\
!     }\n\
    exit (0);\n\
  }\n", srcdir, srcdir, filecnt, filecnt);
    fclose (outfile);
*************** generate_fields (enum FEATURE features, 
*** 1310,1318 ****
  	        case 'B': ma = 1; break;
  	        case ' ':
  		  if (e[j].type->type == TYPE_UENUM)
! 		    mi = ffsll (e[j].type->maxval + 1) - 1;
  		  else if (e[j].type->type == TYPE_SENUM)
! 		    mi = ffsll (e[j].type->maxval + 1);
  		  else
  		    abort ();
  		  if (!mi)
--- 1313,1321 ----
  	        case 'B': ma = 1; break;
  	        case ' ':
  		  if (e[j].type->type == TYPE_UENUM)
! 		    mi = __builtin_ffsll (e[j].type->maxval + 1) - 1;
  		  else if (e[j].type->type == TYPE_SENUM)
! 		    mi = __builtin_ffsll (e[j].type->maxval + 1);
  		  else
  		    abort ();
  		  if (!mi)

Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.com


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