develooper Front page | perl.perl5.porters | Postings from May 2003

RE: [perl #22189] patch: perl 5.8.0 compile error on ia64/HP-UX ( broken attribute test)

Thread Next
From:
Robin Barker
Date:
May 14, 2003 10:48
Subject:
RE: [perl #22189] patch: perl 5.8.0 compile error on ia64/HP-UX ( broken attribute test)
Message ID:
533D273D4014D411AB1D00062938C4D904046517@hotel.npl.co.uk
The format attributes are not normally visible to the compiler.
Unless you are using -DCHECK_FORMAT, the __printf__ are not seen.
The attribute setting in perlio.h were not protected by 
C<ifdef CHECK_FORMAT> -- this is a bug and was fixed by my
patch 18556.

Robin

-----Original Message-----
From: Petter Reinholdtsen [mailto:perlbug-followup@perl.org]
Sent: 13 May 2003 19:42
To: perl5-porters@perl.org
Subject: [perl #22189] patch: perl 5.8.0 compile error on ia64/HP-UX
(broken attribute test)


# New Ticket Created by  Petter Reinholdtsen 
# Please include the string:  [perl #22189]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=22189 >



I ran into a compile error when trying to compile perl 5.8.0 on ia64
HP/UX 11.22.  I got this error message when trying to compile
miniperlmain.c:

  Error 172: "perlio.h", line 209 # Undeclared variable '__printf__'.

The problem was the following code:

    __attribute__ ((__format__(__printf__, 1, 2)));

Tracking the problem further, I discovered the test for __attribute__
in Configure, where it is testing if the following construct is
compilable:

  #include <stdio.h>
  void croak (char* pat,...)
__attribute__((format(printf,1,2),noreturn));

I also discovered that the result from this test isn't printed to
stdout, making it hard to find out what the result from this test was.

I belive the test in Configure should test for the same feature that
is used in the perl code, and rewrote 'format' to '__format__' and
'printf' to '__printf__' to match perlio.h.  I also printed the result
of the test to stdout, making it easy see that this test now fails as
it should on HP/UX.

With the following patch, I got past the previous problem area.
Please include this patch in the next version of perl.

diff -ur src-5.8.0/Configure src-5.8.0-local/Configure
--- src-5.8.0/Configure	2002-07-19 00:55:15.000000000 +0200
+++ src-5.8.0-local/Configure	2003-05-13 20:23:30.000000000 +0200
@@ -9382,18 +9382,18 @@
 echo "Checking whether your compiler can handle __attribute__ ..." >&4
 $cat >attrib.c <<'EOCP'
 #include <stdio.h>
-void croak (char* pat,...)
__attribute__((format(printf,1,2),noreturn));
+void croak (char* pat,...)
__attribute__((__format__(__printf__,1,2),noreturn));
 EOCP
 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
 	if $contains 'warning' attrib.out >/dev/null 2>&1; then
-		echo "Your C compiler doesn't fully support
__attribute__."
+		echo "Your C compiler doesn't fully support
__attribute__." >&4
 		val="$undef"
 	else
-		echo "Your C compiler supports __attribute__."
+		echo "Your C compiler supports __attribute__." >&4
 		val="$define"
 	fi
 else
-	echo "Your C compiler doesn't seem to understand __attribute__
at all."
+	echo "Your C compiler doesn't seem to understand __attribute__
at all." >&4
 	val="$undef"
 fi
 set d_attribut

-------------------------------------------------------------------
This e-mail and any attachments may contain confidential and/or
privileged material; it is for the intended addressee(s) only.
If you are not a named addressee, you must not use, retain or
disclose such information.

NPL Management Ltd cannot guarantee that the e-mail or any
attachments are free from viruses.

NPL Management Ltd. Registered in England and Wales. No: 2937881
Registered Office: Teddington, Middlesex, United Kingdom TW11 0LW.
-------------------------------------------------------------------

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About