public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: FIXINCL goes into an infinite loop on alpha-osf4
       [not found] <200001241631.LAA00220@caip.rutgers.edu>
@ 2000-01-24  9:18 ` Bruce Korb
  0 siblings, 0 replies; 7+ messages in thread
From: Bruce Korb @ 2000-01-24  9:18 UTC (permalink / raw)
  To: Kaveh R. Ghazi; +Cc: zack, gcc, gcc-patches

"Kaveh R. Ghazi" wrote:
> 
> Today's CVS now completes running fixincl on my alpha-osf4 box.  BTW,
> it seems to run a *lot* faster now.  And only about half as many files
> are transformed.  Good work!  (Next I'll try sunos4 and see how that
> does.)

Yes, Zack, GOOD WORK!  I had been wanting to get to it
for almost a year now.  Round tuits can be hard to come by :-(

Given that you (Kaveh) have access to Sun OS4 and I don't,
please try defining NO_BOGOSITY and see if it works.
We have fixed some troublesome issues since I deemed
it necessary, long, long ago.

If it does work, it will save a lot of fork-ing around.
The other troublesome box is HP/UX.  If we can dump
the BOGOSITY code for those boxes, we ought to
be able to dump it for all.

Regards,
	Bruce

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: FIXINCL goes into an infinite loop on alpha-osf4
  2000-01-25 18:21   ` Zack Weinberg
@ 2000-01-25 23:37     ` Zack Weinberg
  0 siblings, 0 replies; 7+ messages in thread
From: Zack Weinberg @ 2000-01-25 23:37 UTC (permalink / raw)
  To: Kaveh R. Ghazi; +Cc: autogen, gcc-patches, gcc

I committed the patch I sent previously, I believe it qualifies as an
obvious bugfix.

ChangeLog:

	* fixinc/Makefile.in (machname.h): SunOS 4 sed can't handle a
	file with one line and no trailing newline.
	Patch by Kaveh Ghazi <ghazi@caip.rutgers.edu>.
	* fixinc/fixtests.c (machine_name_test): Fix fencepost error
	checking if the match is on the line.
	* fixinc/gnu-regex.c: Provide regerror not __regerror.

zw

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: FIXINCL goes into an infinite loop on alpha-osf4
  2000-01-25 17:34 ` Zack Weinberg
@ 2000-01-25 18:21   ` Zack Weinberg
  2000-01-25 23:37     ` Zack Weinberg
  0 siblings, 1 reply; 7+ messages in thread
From: Zack Weinberg @ 2000-01-25 18:21 UTC (permalink / raw)
  To: Kaveh R. Ghazi; +Cc: autogen, gcc-patches, gcc

Ok.  Here is my patch for the problems you saw and for a silly fencepost
error in machine_name_test.  With this applied, I am confident that
fixincludes doesn't munge anything it shouldn't in the SunOS 4 headers.
I am less confident that it does munge everything that it should, but an
eyeball of the diffs looks okay.

An interesting statistic:  If you turn off else_endif_label, the number
of headers touched on SunOS drops by 313 files.

zw

===================================================================
Index: Makefile.in
--- Makefile.in	2000/01/20 18:25:12	1.13
+++ Makefile.in	2000/01/26 02:16:25
@@ -145,7 +145,7 @@ machname.h: ../specs
 	    sed -n 's/^.*-D\([a-zA-Z_][a-zA-Z0-9_]*\).*$$/\1/p' | sort -u | \
 	    grep -v '^_[_A-Z]' > mn.T
 	@echo "Forbidden identifiers: `tr '\012' ' ' <mn.T`"
-	@sed 's/^/\\\\</; s/$$/\\\\>/' <mn.T | tr '\012' '|' | \
-	     sed 's/^/#define MN_NAME_PAT "/; s/|$$/"/' > machname.h
-	@echo >> machname.h
-	@-rm -f mn.T
+	@sed 's/^/\\\\</; s/$$/\\\\>/' <mn.T | tr '\012' '|' > mn.T2
+	@echo '' >>mn.T2
+	@sed 's/^/#define MN_NAME_PAT "/; s/|$$/"/' < mn.T2 > machname.h
+	@-rm -f mn.T mn.T2
===================================================================
Index: fixtests.c
--- fixtests.c	2000/01/20 18:25:12	1.10
+++ fixtests.c	2000/01/26 02:16:25
@@ -307,7 +307,7 @@ TEST_FOR_FIX_PROC_HEAD( machine_name_tes
 	return SKIP_FIX;  /* No match in file - no fix needed */
 
       /* Match; is it on the line?  */
-      if (match[0].rm_eo < limit - base)
+      if (match[0].rm_eo <= limit - base)
 	return APPLY_FIX;  /* Yup */
 
       /* Otherwise, keep looking... */
===================================================================
Index: gnu-regex.c
--- gnu-regex.c	2000/01/20 18:25:12	1.3
+++ gnu-regex.c	2000/01/26 02:16:27
@@ -5745,7 +5745,7 @@ weak_alias (__regexec, regexec)
    from either regcomp or regexec.   We don't use PREG here.  */
 
 size_t
-__regerror (errcode, preg, errbuf, errbuf_size)
+regerror (errcode, preg, errbuf, errbuf_size)
     int errcode;
     const regex_t *preg;
     char *errbuf;

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: FIXINCL goes into an infinite loop on alpha-osf4
  2000-01-25 12:00 Kaveh R. Ghazi
  2000-01-25 16:37 ` Richard Henderson
@ 2000-01-25 17:34 ` Zack Weinberg
  2000-01-25 18:21   ` Zack Weinberg
  1 sibling, 1 reply; 7+ messages in thread
From: Zack Weinberg @ 2000-01-25 17:34 UTC (permalink / raw)
  To: Kaveh R. Ghazi; +Cc: autogen, gcc-patches, gcc

On Tue, Jan 25, 2000 at 02:59:16PM -0500, Kaveh R. Ghazi wrote:
> --- orig/egcs-CVS20000124/gcc/fixinc/Makefile.in	Fri Jan 21 10:43:14 2000
> +++ egcs-CVS20000124/gcc/fixinc/Makefile.in	Tue Jan 25 12:03:05 2000
> @@ -145,7 +145,7 @@ machname.h: ../specs
>  	    sed -n 's/^.*-D\([a-zA-Z_][a-zA-Z0-9_]*\).*$$/\1/p' | sort -u | \
>  	    grep -v '^_[_A-Z]' > mn.T
>  	@echo "Forbidden identifiers: `tr '\012' ' ' <mn.T`"
> -	@sed 's/^/\\\\</; s/$$/\\\\>/' <mn.T | tr '\012' '|' | \
> -	     sed 's/^/#define MN_NAME_PAT "/; s/|$$/"/' > machname.h
> -	@echo >> machname.h
> -	@-rm -f mn.T
> +	@sed 's/^/\\\\</; s/$$/\\\\>/' <mn.T | tr '\012' '|' > mn.T2
> +	@echo '' >> mn.T2
> +	@sed 's/^/#define MN_NAME_PAT "/; s/|$$/"/' < mn.T2 > machname.h
> +	@-rm -f mn.T mn.T2

This part looks fine to me.

> --- orig/egcs-CVS20000124/gcc/fixinc/fixlib.c	Fri Jan 21 10:43:15 2000
> +++ egcs-CVS20000124/gcc/fixinc/fixlib.c	Tue Jan 25 13:34:33 2000
> @@ -166,7 +166,7 @@ compile_re( pat, re, match, e1, e2 )
>    if (err)
>      {
>        char rerrbuf[1024];
> -      regerror (err, re, rerrbuf, 1024);
> +      __regerror (err, re, rerrbuf, 1024);
>        fprintf (stderr, z_bad_comp, e1, e2, pat, rerrbuf);
>        exit (EXIT_FAILURE);
>      }

Better you should do this:

--- gnu-regex.c 2000/01/20 18:25:12     1.3
+++ gnu-regex.c 2000/01/26 01:31:08
@@ -5745,7 +5745,7 @@
    from either regcomp or regexec.   We don't use PREG here.  */
 
 size_t
-__regerror (errcode, preg, errbuf, errbuf_size)
+regerror (errcode, preg, errbuf, errbuf_size)
     int errcode;
     const regex_t *preg;
     char *errbuf;

This is the way it is in libc's copy.  (Note, the patch was pasted from
another xterm and may have tab damage.)

With those changes fixincludes runs to completion on sunos 4.1.4, but
there appears to be something wrong with the machine_name fix - it doesn't
touch "#ifdef sparc", but does touch "#if defined(sparc)".  I'm looking
into it now.

zw

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: FIXINCL goes into an infinite loop on alpha-osf4
  2000-01-25 16:37 ` Richard Henderson
@ 2000-01-25 16:42   ` Zack Weinberg
  0 siblings, 0 replies; 7+ messages in thread
From: Zack Weinberg @ 2000-01-25 16:42 UTC (permalink / raw)
  To: Richard Henderson; +Cc: Kaveh R. Ghazi, autogen, gcc-patches, gcc

On Tue, Jan 25, 2000 at 04:37:17PM -0800, Richard Henderson wrote:
> On Tue, Jan 25, 2000 at 02:59:16PM -0500, Kaveh R. Ghazi wrote:
> > It looks like gnu-regex.c only provides a weak-alias for regerror if
> > we define _LIBC.  This is sunos4 land, so I changed the call in
> > fixlib.c from regerror to __regerror and it worked.
> 
> I'd prefer we hacked sources the other direction.

Agree.

I'm testing fixinc on SunOS 4 right now, and will look at this.

zw

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: FIXINCL goes into an infinite loop on alpha-osf4
  2000-01-25 12:00 Kaveh R. Ghazi
@ 2000-01-25 16:37 ` Richard Henderson
  2000-01-25 16:42   ` Zack Weinberg
  2000-01-25 17:34 ` Zack Weinberg
  1 sibling, 1 reply; 7+ messages in thread
From: Richard Henderson @ 2000-01-25 16:37 UTC (permalink / raw)
  To: Kaveh R. Ghazi; +Cc: autogen, gcc-patches, gcc, zack

On Tue, Jan 25, 2000 at 02:59:16PM -0500, Kaveh R. Ghazi wrote:
> It looks like gnu-regex.c only provides a weak-alias for regerror if
> we define _LIBC.  This is sunos4 land, so I changed the call in
> fixlib.c from regerror to __regerror and it worked.

I'd prefer we hacked sources the other direction.


r~

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: FIXINCL goes into an infinite loop on alpha-osf4
@ 2000-01-25 12:00 Kaveh R. Ghazi
  2000-01-25 16:37 ` Richard Henderson
  2000-01-25 17:34 ` Zack Weinberg
  0 siblings, 2 replies; 7+ messages in thread
From: Kaveh R. Ghazi @ 2000-01-25 12:00 UTC (permalink / raw)
  To: autogen; +Cc: gcc-patches, gcc, zack

 > From: Bruce Korb <bkorb@sco.COM>
 > 
 > Given that you (Kaveh) have access to Sun OS4 and I don't, please try
 > defining NO_BOGOSITY and see if it works.  We have fixed some
 > troublesome issues since I deemed it necessary, long, long ago.

Well, before trying NO_BOGOSITY, I needed to have it work at all on
sunos4. :-)  There were two problems.  

1.  The first was that it couldn't compile fixlib.c:
 > fixlib.c", line 185: warning: undeclared initializer name MN_NAME_PAT

This happened because machname.h was empty.  I tracked this down to
the fact that sed on sunos4 can't handle a file which doesn't end in a
newline.  The Makefile rules for creating machname.h did create this
circumstance.  So I rewrote it to make sure that there is always a
newline by reordering when the "echo" statement is run.  I also had it
say echo '' instead of just echo, because echo alone doesn't do
anything.

2.  I then had a problem linking fixincl and fixfixes:
 > ld: Undefined symbol
 >    _regerror

It looks like gnu-regex.c only provides a weak-alias for regerror if
we define _LIBC.  This is sunos4 land, so I changed the call in
fixlib.c from regerror to __regerror and it worked.


Okay to install?



2000-01-25  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* fixinc/Makefile.in (machname.h): Make sure data sent to `sed'
	has a terminating newline.

	* fixlib.c (compile_re): Call `__regerror', not `regerror'.

diff -rup orig/egcs-CVS20000124/gcc/fixinc/Makefile.in egcs-CVS20000124/gcc/fixinc/Makefile.in
--- orig/egcs-CVS20000124/gcc/fixinc/Makefile.in	Fri Jan 21 10:43:14 2000
+++ egcs-CVS20000124/gcc/fixinc/Makefile.in	Tue Jan 25 12:03:05 2000
@@ -145,7 +145,7 @@ machname.h: ../specs
 	    sed -n 's/^.*-D\([a-zA-Z_][a-zA-Z0-9_]*\).*$$/\1/p' | sort -u | \
 	    grep -v '^_[_A-Z]' > mn.T
 	@echo "Forbidden identifiers: `tr '\012' ' ' <mn.T`"
-	@sed 's/^/\\\\</; s/$$/\\\\>/' <mn.T | tr '\012' '|' | \
-	     sed 's/^/#define MN_NAME_PAT "/; s/|$$/"/' > machname.h
-	@echo >> machname.h
-	@-rm -f mn.T
+	@sed 's/^/\\\\</; s/$$/\\\\>/' <mn.T | tr '\012' '|' > mn.T2
+	@echo '' >> mn.T2
+	@sed 's/^/#define MN_NAME_PAT "/; s/|$$/"/' < mn.T2 > machname.h
+	@-rm -f mn.T mn.T2
diff -rup orig/egcs-CVS20000124/gcc/fixinc/fixlib.c egcs-CVS20000124/gcc/fixinc/fixlib.c
--- orig/egcs-CVS20000124/gcc/fixinc/fixlib.c	Fri Jan 21 10:43:15 2000
+++ egcs-CVS20000124/gcc/fixinc/fixlib.c	Tue Jan 25 13:34:33 2000
@@ -166,7 +166,7 @@ compile_re( pat, re, match, e1, e2 )
   if (err)
     {
       char rerrbuf[1024];
-      regerror (err, re, rerrbuf, 1024);
+      __regerror (err, re, rerrbuf, 1024);
       fprintf (stderr, z_bad_comp, e1, e2, pat, rerrbuf);
       exit (EXIT_FAILURE);
     }

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2000-01-25 23:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <200001241631.LAA00220@caip.rutgers.edu>
2000-01-24  9:18 ` FIXINCL goes into an infinite loop on alpha-osf4 Bruce Korb
2000-01-25 12:00 Kaveh R. Ghazi
2000-01-25 16:37 ` Richard Henderson
2000-01-25 16:42   ` Zack Weinberg
2000-01-25 17:34 ` Zack Weinberg
2000-01-25 18:21   ` Zack Weinberg
2000-01-25 23:37     ` Zack Weinberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).