Change 25478 by [EMAIL PROTECTED] on 2005/09/18 23:13:25
Integrate:
[ 24545]
Fill in HASATTRIBUTE stuff in win32/config_H.* (see change #24508)
(None are actually defined, but it's nice to have them there anyway)
[ 24552]
Attribute compilation fix for Windows by Andy Lester
[ 24710]
Subject: [PATCH] Re: blead attribute warnings, cygwin + gcc 3.4.1
From: Yitzchak Scott-Thoennes <[EMAIL PROTECTED]>
Date: Sun, 5 Jun 2005 20:43:55 -0700
Message-ID: <[EMAIL PROTECTED]>
[ 24975]
Stop '"__attribute__format__" redefined' warnings from gcc on Win32
Affected files ...
... //depot/maint-5.8/perl/cygwin/cygwin.c#3 integrate
... //depot/maint-5.8/perl/perl.h#85 integrate
... //depot/maint-5.8/perl/perlio.h#13 integrate
... //depot/maint-5.8/perl/win32/config_H.bc#25 integrate
... //depot/maint-5.8/perl/win32/config_H.gc#24 integrate
... //depot/maint-5.8/perl/win32/config_H.vc#24 integrate
... //depot/maint-5.8/perl/win32/config_H.vc64#24 integrate
Differences ...
==== //depot/maint-5.8/perl/cygwin/cygwin.c#3 (text) ====
Index: perl/cygwin/cygwin.c
--- perl/cygwin/cygwin.c#2~24281~ Fri Apr 22 03:42:05 2005
+++ perl/cygwin/cygwin.c Sun Sep 18 16:13:25 2005
@@ -160,11 +160,14 @@
XS(XS_Cygwin_pid_to_winpid)
{
dXSARGS;
+ dXSTARG;
+ pid_t pid, RETVAL;
+
if (items != 1)
Perl_croak(aTHX_ "Usage: Cygwin::pid_to_winpid(pid)");
- pid_t pid = (pid_t)SvIV(ST(0));
- pid_t RETVAL;
- dXSTARG;
+
+ pid = (pid_t)SvIV(ST(0));
+
if ((RETVAL = cygwin_internal(CW_CYGWIN_PID_TO_WINPID, pid)) > 0) {
XSprePUSH; PUSHi((IV)RETVAL);
XSRETURN(1);
@@ -176,11 +179,14 @@
XS(XS_Cygwin_winpid_to_pid)
{
dXSARGS;
+ dXSTARG;
+ pid_t pid, RETVAL;
+
if (items != 1)
Perl_croak(aTHX_ "Usage: Cygwin::winpid_to_pid(pid)");
- pid_t pid = (pid_t)SvIV(ST(0));
- pid_t RETVAL;
- dXSTARG;
+
+ pid = (pid_t)SvIV(ST(0));
+
if ((RETVAL = cygwin32_winpid_to_pid(pid)) > 0) {
XSprePUSH; PUSHi((IV)RETVAL);
XSRETURN(1);
==== //depot/maint-5.8/perl/perl.h#85 (text) ====
Index: perl/perl.h
--- perl/perl.h#84~25470~ Sun Sep 18 08:00:31 2005
+++ perl/perl.h Sun Sep 18 16:13:25 2005
@@ -2312,6 +2312,41 @@
# endif
#endif
+/* In case Configure was not used (we are using a "canned config"
+ * such as Win32, or a cross-compilation setup, for example) try going
+ * by the gcc major and minor versions. One useful URL is
+ * http://www.ohse.de/uwe/articles/gcc-attributes.html,
+ * but contrary to this information warn_unused_result seems
+ * not to be in gcc 3.3.5, at least. --jhi
+ * Set these up now otherwise we get confused when some of the <*thread.h>
+ * includes below indirectly pull in <perlio.h> (which needs to know if we
+ * have HASATTRIBUTE_FORMAT).
+ */
+
+#if defined __GNUC__
+# if __GNUC__ >= 3 /* 3.0 -> */ /* XXX Verify this version */
+# define HASATTRIBUTE_FORMAT
+# endif
+# if __GNUC__ >= 3 /* 3.0 -> */
+# define HASATTRIBUTE_MALLOC
+# endif
+# if __GNUC__ == 3 && __GNUC_MINOR__ >= 3 || __GNUC__ > 3 /* 3.3 -> */
+# define HASATTRIBUTE_NONNULL
+# endif
+# if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 || __GNUC__ > 2 /* 2.5 -> */
+# define HASATTRIBUTE_NORETURN
+# endif
+# if __GNUC__ >= 3 /* gcc 3.0 -> */
+# define HASATTRIBUTE_PURE
+# endif
+# if __GNUC__ >= 3 /* gcc 3.0 -> */ /* XXX Verify this version */
+# define HASATTRIBUTE_UNUSED
+# endif
+# if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 || __GNUC__ > 3 /* 3.4 -> */
+# define HASATTRIBUTE_WARN_UNUSED_RESULT
+# endif
+#endif
+
/*
* USE_5005THREADS needs to be after unixish.h as <pthread.h> includes
* <sys/signal.h> which defines NSIG - which will stop inclusion of <signal.h>
@@ -2511,36 +2546,6 @@
#ifndef DieNull
# define DieNull Perl_vdie(aTHX_ Nullch, Null(va_list *))
-#endif
-
-/* In case Configure was not used (we are using a "canned config"
- * such as Win32, or a cross-compilation setup, for example) try going
- * by the gcc major and minor versions. One useful URL is
- * http://www.ohse.de/uwe/articles/gcc-attributes.html,
- * but contrary to this information warn_unused_result seems
- * not to be in gcc 3.3.5, at least. --jhi */
-#if defined __GNUC__
-# if __GNUC__ >= 3 /* 3.0 -> */ /* XXX Verify this version */
-# define HASATTRIBUTE_FORMAT
-# endif
-# if __GNUC__ >= 3 /* 3.0 -> */
-# define HASATTRIBUTE_MALLOC
-# endif
-# if __GNUC__ == 3 && __GNUC_MINOR__ >= 3 || __GNUC__ > 3 /* 3.3 -> */
-# define HASATTRIBUTE_NONNULL
-# endif
-# if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 || __GNUC__ > 2 /* 2.5 -> */
-# define HASATTRIBUTE_NORETURN
-# endif
-# if __GNUC__ >= 3 /* gcc 3.0 -> */
-# define HASATTRIBUTE_PURE
-# endif
-# if __GNUC__ >= 3 /* gcc 3.0 -> */ /* XXX Verify this version */
-# define HASATTRIBUTE_UNUSED
-# endif
-# if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 || __GNUC__ > 3 /* 3.4 -> */
-# define HASATTRIBUTE_WARN_UNUSED_RESULT
-# endif
#endif
/* Because 5.8.x has to keep using %_ for SVf, which will make the format
==== //depot/maint-5.8/perl/perlio.h#13 (text) ====
Index: perl/perlio.h
--- perl/perlio.h#12~25467~ Sun Sep 18 07:03:33 2005
+++ perl/perlio.h Sun Sep 18 16:13:25 2005
@@ -210,7 +210,11 @@
START_EXTERN_C
#ifndef __attribute__format__
-# define __attribute__format__(x,y,z) __attribute__((format(x,y,z)))
+# ifdef HASATTRIBUTE_FORMAT
+# define __attribute__format__(x,y,z) __attribute__((format(x,y,z)))
+# else
+# define __attribute__format__(x,y,z)
+# endif
#endif
#ifndef PerlIO_init
PERL_EXPORT_C void PerlIO_init(pTHX);
==== //depot/maint-5.8/perl/win32/config_H.bc#25 (text+w) ====
Index: perl/win32/config_H.bc
--- perl/win32/config_H.bc#24~24462~ Fri May 13 07:50:56 2005
+++ perl/win32/config_H.bc Sun Sep 18 16:13:25 2005
@@ -1548,17 +1548,40 @@
*/
#define HAS_ACCESS /**/
-/* HASATTRIBUTE:
- * This symbol indicates the C compiler can check for function attributes,
- * such as printf formats. This is normally only supported by GNU cc.
- */
-/*#define HASATTRIBUTE /**/
-#ifndef HASATTRIBUTE
-#ifdef __attribute__
-#undef __attribute__
-#endif
-#define __attribute__(_arg_)
-#endif
+/* HASATTRIBUTE_FORMAT:
+ * Can we handle GCC attribute for checking printf-style formats
+ */
+/*#define HASATTRIBUTE_FORMAT /**/
+
+/* HASATTRIBUTE_MALLOC:
+ * Can we handle GCC attribute for malloc-style functions.
+ */
+/*#define HASATTRIBUTE_MALLOC /**/
+
+/* HASATTRIBUTE_NONNULL:
+ * Can we handle GCC attribute for nonnull function parms.
+ */
+/*#define HASATTRIBUTE_NONNULL /**/
+
+/* HASATTRIBUTE_NORETURN:
+ * Can we handle GCC attribute for functions that do not return
+ */
+/*#define HASATTRIBUTE_NORETURN /**/
+
+/* HASATTRIBUTE_PURE:
+ * Can we handle GCC attribute for pure functions
+ */
+/*#define HASATTRIBUTE_PURE /**/
+
+/* HASATTRIBUTE_UNUSED:
+ * Can we handle GCC attribute for unused variables and arguments
+ */
+/*#define HASATTRIBUTE_UNUSED /**/
+
+/* HASATTRIBUTE_WARN_UNUSED_RESULT:
+ * Can we handle GCC attribute for warning on unused results
+ */
+/*#define HASATTRIBUTE_WARN_UNUSED_RESULT /**/
/* HAS_CRYPT:
* This symbol, if defined, indicates that the crypt routine is available
==== //depot/maint-5.8/perl/win32/config_H.gc#24 (text+w) ====
Index: perl/win32/config_H.gc
--- perl/win32/config_H.gc#23~24462~ Fri May 13 07:50:56 2005
+++ perl/win32/config_H.gc Sun Sep 18 16:13:25 2005
@@ -1548,17 +1548,45 @@
*/
#define HAS_ACCESS /**/
-/* HASATTRIBUTE:
- * This symbol indicates the C compiler can check for function attributes,
- * such as printf formats. This is normally only supported by GNU cc.
- */
-#define HASATTRIBUTE /**/
-#ifndef HASATTRIBUTE
-#ifdef __attribute__
-#undef __attribute__
-#endif
-#define __attribute__(_arg_)
-#endif
+/* The HASATTRIBUTE_* defines are left undefined here because they vary from
+ * one version of GCC to another. Instead, they are defined on the basis of
+ * the compiler version in <perl.h>.
+ */
+
+/* HASATTRIBUTE_FORMAT:
+ * Can we handle GCC attribute for checking printf-style formats
+ */
+/*#define HASATTRIBUTE_FORMAT /**/
+
+/* HASATTRIBUTE_MALLOC:
+ * Can we handle GCC attribute for malloc-style functions.
+ */
+/*#define HASATTRIBUTE_MALLOC /**/
+
+/* HASATTRIBUTE_NONNULL:
+ * Can we handle GCC attribute for nonnull function parms.
+ */
+/*#define HASATTRIBUTE_NONNULL /**/
+
+/* HASATTRIBUTE_NORETURN:
+ * Can we handle GCC attribute for functions that do not return
+ */
+/*#define HASATTRIBUTE_NORETURN /**/
+
+/* HASATTRIBUTE_PURE:
+ * Can we handle GCC attribute for pure functions
+ */
+/*#define HASATTRIBUTE_PURE /**/
+
+/* HASATTRIBUTE_UNUSED:
+ * Can we handle GCC attribute for unused variables and arguments
+ */
+/*#define HASATTRIBUTE_UNUSED /**/
+
+/* HASATTRIBUTE_WARN_UNUSED_RESULT:
+ * Can we handle GCC attribute for warning on unused results
+ */
+/*#define HASATTRIBUTE_WARN_UNUSED_RESULT /**/
/* HAS_CRYPT:
* This symbol, if defined, indicates that the crypt routine is available
==== //depot/maint-5.8/perl/win32/config_H.vc#24 (text+w) ====
Index: perl/win32/config_H.vc
--- perl/win32/config_H.vc#23~24462~ Fri May 13 07:50:56 2005
+++ perl/win32/config_H.vc Sun Sep 18 16:13:25 2005
@@ -1548,17 +1548,40 @@
*/
#define HAS_ACCESS /**/
-/* HASATTRIBUTE:
- * This symbol indicates the C compiler can check for function attributes,
- * such as printf formats. This is normally only supported by GNU cc.
- */
-/*#define HASATTRIBUTE /**/
-#ifndef HASATTRIBUTE
-#ifdef __attribute__
-#undef __attribute__
-#endif
-#define __attribute__(_arg_)
-#endif
+/* HASATTRIBUTE_FORMAT:
+ * Can we handle GCC attribute for checking printf-style formats
+ */
+/*#define HASATTRIBUTE_FORMAT /**/
+
+/* HASATTRIBUTE_MALLOC:
+ * Can we handle GCC attribute for malloc-style functions.
+ */
+/*#define HASATTRIBUTE_MALLOC /**/
+
+/* HASATTRIBUTE_NONNULL:
+ * Can we handle GCC attribute for nonnull function parms.
+ */
+/*#define HASATTRIBUTE_NONNULL /**/
+
+/* HASATTRIBUTE_NORETURN:
+ * Can we handle GCC attribute for functions that do not return
+ */
+/*#define HASATTRIBUTE_NORETURN /**/
+
+/* HASATTRIBUTE_PURE:
+ * Can we handle GCC attribute for pure functions
+ */
+/*#define HASATTRIBUTE_PURE /**/
+
+/* HASATTRIBUTE_UNUSED:
+ * Can we handle GCC attribute for unused variables and arguments
+ */
+/*#define HASATTRIBUTE_UNUSED /**/
+
+/* HASATTRIBUTE_WARN_UNUSED_RESULT:
+ * Can we handle GCC attribute for warning on unused results
+ */
+/*#define HASATTRIBUTE_WARN_UNUSED_RESULT /**/
/* HAS_CRYPT:
* This symbol, if defined, indicates that the crypt routine is available
==== //depot/maint-5.8/perl/win32/config_H.vc64#24 (text) ====
Index: perl/win32/config_H.vc64
--- perl/win32/config_H.vc64#23~24462~ Fri May 13 07:50:56 2005
+++ perl/win32/config_H.vc64 Sun Sep 18 16:13:25 2005
@@ -1548,17 +1548,40 @@
*/
#define HAS_ACCESS /**/
-/* HASATTRIBUTE:
- * This symbol indicates the C compiler can check for function attributes,
- * such as printf formats. This is normally only supported by GNU cc.
- */
-/*#define HASATTRIBUTE /**/
-#ifndef HASATTRIBUTE
-#ifdef __attribute__
-#undef __attribute__
-#endif
-#define __attribute__(_arg_)
-#endif
+/* HASATTRIBUTE_FORMAT:
+ * Can we handle GCC attribute for checking printf-style formats
+ */
+/*#define HASATTRIBUTE_FORMAT /**/
+
+/* HASATTRIBUTE_MALLOC:
+ * Can we handle GCC attribute for malloc-style functions.
+ */
+/*#define HASATTRIBUTE_MALLOC /**/
+
+/* HASATTRIBUTE_NONNULL:
+ * Can we handle GCC attribute for nonnull function parms.
+ */
+/*#define HASATTRIBUTE_NONNULL /**/
+
+/* HASATTRIBUTE_NORETURN:
+ * Can we handle GCC attribute for functions that do not return
+ */
+/*#define HASATTRIBUTE_NORETURN /**/
+
+/* HASATTRIBUTE_PURE:
+ * Can we handle GCC attribute for pure functions
+ */
+/*#define HASATTRIBUTE_PURE /**/
+
+/* HASATTRIBUTE_UNUSED:
+ * Can we handle GCC attribute for unused variables and arguments
+ */
+/*#define HASATTRIBUTE_UNUSED /**/
+
+/* HASATTRIBUTE_WARN_UNUSED_RESULT:
+ * Can we handle GCC attribute for warning on unused results
+ */
+/*#define HASATTRIBUTE_WARN_UNUSED_RESULT /**/
/* HAS_CRYPT:
* This symbol, if defined, indicates that the crypt routine is available
End of Patch.