diff mbox

[testsuite,ada] Convert ACATS to DejaGnu (PR testsuite/37703)

Message ID 20110201195619.GK30899@tyan-ft48-01.lab.bos.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek Feb. 1, 2011, 7:56 p.m. UTC
On Tue, Feb 01, 2011 at 06:08:43PM +0100, Rainer Orth wrote:
> Michael Matz <matz@suse.de> writes:
> 
> > If Solaris as works with the version in elfos.h (using .string and 
> > .ascii) you can just remove it from i386/sysv4.h.
> 
> I'll give that a try, all the way back to Solaris 8.  Since
> i386/sysv4.h is only used on Solaris 2/x86, I don't even need approval
> for such a change.

Alternatively just fix up ASM_OUTPUT_ASCII in sysv4.h.
          for (p = _ascii_bytes; p < limit && *p != '\0'; p++)          \                                                                          
            continue;                                                   \                                                                          
inner loop clearly results in O(n^2) time complexity, completely
unnecessarily.  Something like (completely untested) following could fix
it, i.e. only recompute p if it will be different from last iteration.



	Jakub

Comments

Rainer Orth Feb. 2, 2011, 6:10 p.m. UTC | #1
Jakub Jelinek <jakub@redhat.com> writes:

> Alternatively just fix up ASM_OUTPUT_ASCII in sysv4.h.
>           for (p = _ascii_bytes; p < limit && *p != '\0'; p++)          \                                                                          
>             continue;                                                   \                                                                          
> inner loop clearly results in O(n^2) time complexity, completely
> unnecessarily.  Something like (completely untested) following could fix
> it, i.e. only recompute p if it will be different from last iteration.

Thanks, but the generic version in elfos.h proved to just work, so
there's no need for a almost-duplicate, especially since those tend to
be forgotten if the original is modified/optimized/whatever.

Since i386-pc-solaris2.9 testing finished successfully, I've now checked
in the patch to just remove the i386/sysv4.h version of the macro.

	Rainer
diff mbox

Patch

--- gcc/config/i386/sysv4.h	2010-06-11 11:05:31.766533869 +0200
+++ gcc/config/i386/sysv4.h	2011-02-01 20:53:47.116795897 +0100
@@ -54,16 +54,17 @@  along with GCC; see the file COPYING3.  
         (const unsigned char *) (STR);					\
       const unsigned char *limit = _ascii_bytes + (LENGTH);		\
       unsigned bytes_in_chunk = 0;					\
+      const unsigned char *p = _ascii_bytes;				\
       for (; _ascii_bytes < limit; _ascii_bytes++)			\
 	{								\
-	  const unsigned char *p;					\
 	  if (bytes_in_chunk >= 64)					\
 	    {								\
 	      fputc ('\n', (FILE));					\
 	      bytes_in_chunk = 0;					\
 	    }								\
-	  for (p = _ascii_bytes; p < limit && *p != '\0'; p++)		\
-	    continue;							\
+	  if (p <= _ascii_bytes)					\
+	    for (p = _ascii_bytes; p < limit && *p != '\0'; p++)	\
+	      continue;							\
 	  if (p < limit && (p - _ascii_bytes) <= (long) STRING_LIMIT)	\
 	    {								\
 	      if (bytes_in_chunk > 0)					\