public inbox for crossgcc@sourceware.org
 help / color / mirror / Atom feed
* bugfix to mpfr tests + crosstool-ng patch
@ 2009-08-03  1:58 Oron Peled
  2009-08-03 19:40 ` Yann E. MORIN
  0 siblings, 1 reply; 2+ messages in thread
From: Oron Peled @ 2009-08-03  1:58 UTC (permalink / raw)
  To: crossgcc

[-- Attachment #1: Type: text/plain, Size: 1158 bytes --]

Hi,

Two patches attached. The real bugfix is mpfr-2.4.1-test-tmul.patch.
However, since it touches tests/Makefile.am I had to change
./scripts/build/mpfr.sh in crosstool-ng so it would run autoreconf.

The tmul test uses a compiled in input file in $(srcdir).
The problem is that the Makefile passes it unquoted. The C code
tries to stringify it using clever macros, which may *usually* work.

In my case the source directory was named:
  .../toolchain-powerpc-e500v2-linux-gnuspe-1.0-2.fc10/.../tests
And guess what? During testing I found out the program fails because
it tries to open:
  .../toolchain-powerpc-e500v2-1-gnuspe-1.0-2.fc10/.../tests

Yes, CPP tokenized the macro before stringifying it and not surprisingly
the 'linux' part was converted to 1.
[on Fedora-10: cpp (GCC) 4.3.2 20081105 (Red Hat 4.3.2-7)]

So the attached patch simplify the macros and pass the path as string
from the Makefile.

Cheers,

-- 
Oron Peled                                 Voice: +972-4-8228492
oron@actcom.co.il                  http://users.actcom.co.il/~oron
"Copyright protects Software. Patents protect Software Monopolies."
        http://swpat.ffii.org/



[-- Attachment #2: crosstool-ng-1.4.1.mpfr.patch --]
[-- Type: text/x-patch, Size: 822 bytes --]

diff -up ./scripts/build/mpfr.sh.orig ./scripts/build/mpfr.sh
--- ./scripts/build/mpfr.sh.orig	2009-04-21 00:10:03.000000000 +0300
+++ ./scripts/build/mpfr.sh	2009-08-03 01:25:02.000000000 +0300
@@ -30,6 +30,15 @@ do_mpfr_extract() {
     # do that in the future...
     # It seems that MPFR >= 2.4.0 do not need this...
     case "${CT_MPFR_VERSION}" in
+        2.4.1)
+            CT_Pushd "${CT_SRC_DIR}/mpfr-${CT_MPFR_VERSION}"
+            if [ ! -f .autoreconf.ct-ng ]; then
+                CT_DoLog DEBUG "Running autoreconf"
+                CT_DoExecLog ALL autoreconf
+                touch .autoreconf.ct-ng
+            fi
+            CT_Popd
+            ;;
         1.*|2.0.*|2.1.*|2.2.*|2.3.*)
             CT_Pushd "${CT_SRC_DIR}/mpfr-${CT_MPFR_VERSION}"
             if [ ! -f .autotools.ct-ng ]; then

[-- Attachment #3: mpfr-2.4.1-test-tmul.patch --]
[-- Type: text/x-patch, Size: 1422 bytes --]

diff -up ./tests/Makefile.am.orig ./tests/Makefile.am
--- ./tests/Makefile.am.orig	2009-07-28 16:28:55.377059021 +0300
+++ ./tests/Makefile.am	2009-07-28 16:31:01.136810734 +0300
@@ -20,7 +20,7 @@ check_PROGRAMS = tversion tinternals tin
 
 EXTRA_DIST = tgeneric.c tgeneric_ui.c mpf_compat.h inp_str.data tmul.dat
 
-tmul_CPPFLAGS = -DMPFR_SRCDIR=$(srcdir)
+tmul_CPPFLAGS = -DMPFR_SRCDIR=\"$(srcdir)\"
 
 LDADD = libfrtests.la $(MPFR_LIBM) $(top_builddir)/libmpfr.la
 INCLUDES = -I$(top_srcdir) -I$(top_builddir)
diff -up ./tests/tmul.c.orig ./tests/tmul.c
--- ./tests/tmul.c.orig	2009-07-28 16:29:03.761058919 +0300
+++ ./tests/tmul.c	2009-07-28 16:30:46.369812215 +0300
@@ -26,10 +26,8 @@ MA 02110-1301, USA. */
 #include "mpfr-test.h"
 
 #ifndef MPFR_SRCDIR
-#define MPFR_SRCDIR .
+#define MPFR_SRCDIR "."
 #endif
-#define QUOTE(X) NAME(X)
-#define NAME(X) #X
 
 #ifdef CHECK_EXTERNAL
 static int
@@ -482,10 +480,10 @@ check_regression (void)
   mpfr_inits2 (6177, x, y, z, (mpfr_ptr) 0);
   /* we read long strings from a file since ISO C90 does not support strings of
      length > 509 */
-  fp = fopen (QUOTE (MPFR_SRCDIR)"/tmul.dat", "r");
+  fp = fopen (MPFR_SRCDIR "/tmul.dat", "r");
   if (fp == NULL)
     {
-      fprintf (stderr, "Error, cannot open "QUOTE (MPFR_SRCDIR)"/tmul.dat\n");
+      fprintf (stderr, "Error, cannot open " MPFR_SRCDIR "/tmul.dat\n");
       exit (1);
     }
   get_string (s, fp);


[-- Attachment #4: Type: text/plain, Size: 71 bytes --]

--
For unsubscribe information see http://sourceware.org/lists.html#faq

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

* Re: bugfix to mpfr tests + crosstool-ng patch
  2009-08-03  1:58 bugfix to mpfr tests + crosstool-ng patch Oron Peled
@ 2009-08-03 19:40 ` Yann E. MORIN
  0 siblings, 0 replies; 2+ messages in thread
From: Yann E. MORIN @ 2009-08-03 19:40 UTC (permalink / raw)
  To: crossgcc; +Cc: Oron Peled

Oron,
All,

On Monday 03 August 2009 03:58:18 Oron Peled wrote:
> Two patches attached. The real bugfix is mpfr-2.4.1-test-tmul.patch.
> However, since it touches tests/Makefile.am I had to change
> ./scripts/build/mpfr.sh in crosstool-ng so it would run autoreconf.
> 
> The tmul test uses a compiled in input file in $(srcdir).
> The problem is that the Makefile passes it unquoted. The C code
> tries to stringify it using clever macros, which may *usually* work.
[--SNIP--]
> So the attached patch simplify the macros and pass the path as string
> from the Makefile.

OK, applied to default branch. Thank you.

I'm trying to find a way to correctly backport single revisions in Mercurial
and once I know, this will be backported (along with your previous change)
to the 1.4 maintenance branch.

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +0/33 662376056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| --==< ^_^ >==-- `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
`------------------------------^-------^------------------^--------------------'



--
For unsubscribe information see http://sourceware.org/lists.html#faq

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

end of thread, other threads:[~2009-08-03 19:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-03  1:58 bugfix to mpfr tests + crosstool-ng patch Oron Peled
2009-08-03 19:40 ` Yann E. MORIN

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).