d_alarm=''
asctime_r_proto=''
d_asctime_r=''
-d_attribut=''
+d_attribute_format=''
+d_attribute_malloc=''
+d_attribute_nonnull=''
+d_attribute_noreturn=''
+d_attribute_pure=''
+d_attribute_unused=''
+d_attribute_warn_unused_result=''
d_bcmp=''
d_bcopy=''
d_bzero=''
set atoll d_atoll
eval $inlibc
-: Look for GNU-cc style attribute checking
-case "$d_attribut" in
+: Look for GCC-style attribute format
+case "$d_attribute_format" in
'')
echo " "
-echo "Checking whether your compiler can handle __attribute__ ..." >&4
+echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
$cat >attrib.c <<'EOCP'
#include <stdio.h>
-void croak (char* pat,...) __attribute__((__format__(__printf__,1,2),noreturn));
+void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
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 support __attribute__((format))."
val="$undef"
else
- echo "Your C compiler supports __attribute__."
+ echo "Your C compiler supports __attribute__((format))."
val="$define"
fi
else
val="$undef"
fi
;;
-*) val="$d_attribut" ;;
+*) val="$d_attribute_format" ;;
esac
-set d_attribut
+set d_attribute_format
+eval $setvar
+$rm -f attrib*
+
+: Look for GCC-style attribute malloc
+case "$d_attribute_malloc" in
+'')
+echo " "
+echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
+$cat >attrib.c <<'EOCP'
+#include <stdio.h>
+char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
+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 support __attribute__((malloc))."
+ val="$undef"
+ else
+ echo "Your C compiler supports __attribute__((malloc))."
+ val="$define"
+ fi
+else
+ echo "Your C compiler doesn't seem to understand __attribute__ at all."
+ val="$undef"
+fi
+;;
+*) val="$d_attribute_malloc" ;;
+esac
+set d_attribute_malloc
+eval $setvar
+$rm -f attrib*
+
+: Look for GCC-style attribute nonnull
+case "$d_attribute_nonnull" in
+'')
+echo " "
+echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
+$cat >attrib.c <<'EOCP'
+#include <stdio.h>
+void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
+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 support __attribute__((nonnull))."
+ val="$undef"
+ else
+ echo "Your C compiler supports __attribute__((nonnull))."
+ val="$define"
+ fi
+else
+ echo "Your C compiler doesn't seem to understand __attribute__ at all."
+ val="$undef"
+fi
+;;
+*) val="$d_attribute_nonnull" ;;
+esac
+set d_attribute_nonnull
+eval $setvar
+$rm -f attrib*
+
+: Look for GCC-style attribute noreturn
+case "$d_attribute_noreturn" in
+'')
+echo " "
+echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
+$cat >attrib.c <<'EOCP'
+#include <stdio.h>
+void fall_over_dead( void ) __attribute__((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 support __attribute__((noreturn))."
+ val="$undef"
+ else
+ echo "Your C compiler supports __attribute__((noreturn))."
+ val="$define"
+ fi
+else
+ echo "Your C compiler doesn't seem to understand __attribute__ at all."
+ val="$undef"
+fi
+;;
+*) val="$d_attribute_noreturn" ;;
+esac
+set d_attribute_noreturn
+eval $setvar
+$rm -f attrib*
+
+: Look for GCC-style attribute pure
+case "$d_attribute_pure" in
+'')
+echo " "
+echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
+$cat >attrib.c <<'EOCP'
+#include <stdio.h>
+int square( int n ) __attribute__((pure));
+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 support __attribute__((pure))."
+ val="$undef"
+ else
+ echo "Your C compiler supports __attribute__((pure))."
+ val="$define"
+ fi
+else
+ echo "Your C compiler doesn't seem to understand __attribute__ at all."
+ val="$undef"
+fi
+;;
+*) val="$d_attribute_pure" ;;
+esac
+set d_attribute_pure
+eval $setvar
+$rm -f attrib*
+
+: Look for GCC-style attribute unused
+case "$d_attribute_unused" in
+'')
+echo " "
+echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
+$cat >attrib.c <<'EOCP'
+#include <stdio.h>
+int do_something( int dummy __attribute__((unused)), int n );
+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 support __attribute__((unused))."
+ val="$undef"
+ else
+ echo "Your C compiler supports __attribute__((unused))."
+ val="$define"
+ fi
+else
+ echo "Your C compiler doesn't seem to understand __attribute__ at all."
+ val="$undef"
+fi
+;;
+*) val="$d_attribute_unused" ;;
+esac
+set d_attribute_unused
+eval $setvar
+$rm -f attrib*
+
+: Look for GCC-style attribute warn_unused_result
+case "$d_attribute_warn_unused_result" in
+'')
+echo " "
+echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
+$cat >attrib.c <<'EOCP'
+#include <stdio.h>
+int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
+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 support __attribute__((warn_unused_result))."
+ val="$undef"
+ else
+ echo "Your C compiler supports __attribute__((warn_unused_result))."
+ val="$define"
+ fi
+else
+ echo "Your C compiler doesn't seem to understand __attribute__ at all."
+ val="$undef"
+fi
+;;
+*) val="$d_attribute_warn_unused_result" ;;
+esac
+set d_attribute_warn_unused_result
eval $setvar
$rm -f attrib*
d_asctime_r='$d_asctime_r'
d_atolf='$d_atolf'
d_atoll='$d_atoll'
-d_attribut='$d_attribut'
+d_attribute_format='$d_attribute_format'
+d_attribute_malloc='$d_attribute_malloc'
+d_attribute_nonnull='$d_attribute_nonnull'
+d_attribute_noreturn='$d_attribute_noreturn'
+d_attribute_pure='$d_attribute_pure'
+d_attribute_unused='$d_attribute_unused'
+d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
d_bcmp='$d_bcmp'
d_bcopy='$d_bcopy'
d_bsd='$d_bsd'
d_asctime_r='undef'
d_atolf='undef'
d_atoll='define'
-d_attribut='define'
+d_attribute_format='undef'
+d_attribute_malloc='undef'
+d_attribute_nonnull='undef'
+d_attribute_noreturn='undef'
+d_attribute_pure='undef'
+d_attribute_unused='undef'
+d_attribute_warn_unused_result='undef'
d_bcmp='define'
d_bcopy='define'
d_bsd='undef'
d_asctime_r='undef'
d_atolf='undef'
d_atoll='undef'
-d_attribut='undef'
+d_attribute_format='undef'
+d_attribute_malloc='undef'
+d_attribute_nonnull='undef'
+d_attribute_noreturn='undef'
+d_attribute_pure='undef'
+d_attribute_unused='undef'
+d_attribute_warn_unused_result='undef'
d_bcmp='undef'
d_bcopy='undef'
d_bsd='define'
This variable conditionally defines the HAS_ATOLL symbol, which
indicates to the C program that the atoll() routine is available.
-d_attribut (d_attribut.U):
- This variable conditionally defines HASATTRIBUTE, which
- indicates the C compiler can check for function attributes,
- such as printf formats.
+d_attribute_format (d_attribut_format.U):
+ This variable conditionally defines HASATTRIBUTE_FORMAT, which
+ indicates the C compiler can check for printf-like formats.
+
+d_attribute_malloc (d_attribute_malloc.U):
+ This variable conditionally defines HASATTRIBUTE_MALLOC, which
+ indicates the C compiler can understand functions as having
+ malloc-like semantics.
+
+d_attribute_nonnull (d_attribute_nonnull.U):
+ This variable conditionally defines HASATTRIBUTE_NONNULL, which
+ indicates that the C compiler can know that certain arguments
+ must not be NULL, and will check accordingly at compile time.
+
+d_attribute_noreturn (d_attribute_noreturn.U):
+ This variable conditionally defines HASATTRIBUTE_NORETURN, which
+ indicates that the C compiler can know that certain functions
+ are guaranteed never to return.
+
+d_attribute_pure (d_attribute_pure.U):
+ This variable conditionally defines HASATTRIBUTE_PURE, which
+ indicates that the C compiler can know that certain functions
+ are "pure" functions, meaning that they have no side effects, and
+ only rely on function input and/or global data for their results.
+
+d_attribute_unused (d_attribute_unused.U):
+ This variable conditionally defines HASATTRIBUTE_UNUSED, which
+ indicates that the C compiler can know that certain variables
+ and arguments may not always be used, and to not throw warnings
+ if they don't get used.
+
+d_attribute_warn_unused_result (d_attribute_warn_unused_result.U):
+ This variable conditionally defines
+ HASATTRIBUTE_WARN_UNUSED_RESULT, which indicates that the C
+ compiler can know that certain functions have a return values
+ that must not be ignored, such as malloc() or open().
d_bcmp (d_bcmp.U):
This variable conditionally defines the HAS_BCMP symbol if
d_asctime_r='undef'
d_atolf='undef'
d_atoll='define'
-d_attribut='define'
+d_attribute_format='undef'
+d_attribute_malloc='undef'
+d_attribute_nonnull='undef'
+d_attribute_noreturn='undef'
+d_attribute_pure='undef'
+d_attribute_unused='undef'
+d_attribute_warn_unused_result='undef'
d_bcmp='define'
d_bcopy='define'
d_bsd='undef'
=head2 Other tests
-=over 4
-
-=item CHECK_FORMAT
-
-If you have gcc, you can test the correct use of printf-style
-arguments. Run C<Configure> with S<-Dccflags='-DCHECK_FORMAT
--Wformat'> (and S<-Dcc=gcc>, if you are not on a system where C<cc>
-is C<gcc>) and run C<make>. The compiler will produce warnings of
-incorrect use of format arguments.
-
-As of change 23767, CHECK_FORMAT changes perl-defined formats
-to obscure (but standard) formats, and then traps the obscure
-format. The resulting perl executable operates properly but
-you should not use the executable produced by this process.
-
-=over 4
-
-=item *
-
-A more accurate approach is the following commands:
-
- make clean
- make all OPTIMIZE='-DCHECK_FORMAT -Wformat' >& make.log
- perl -nwe 'print if /^\S+:/ and not /^make\b/' make.log
-
-=item *
-
-A more thorough approach to compiler warnings is
-
- make clean
- make miniperl OPTIMIZE=-O\ -DCHECK_FORMAT >& make.log
- make all OPTIMIZE=-O\ -DCHECK_FORMAT\ -Wall\ -Wno-unused\
- -Wno-uninitialized >>& make.log
- perl -nwe 'print if /^\S+:/ and not /^make\b/' make.log
-
-=back
-
-(-Wformat support by Robin Barker.)
-
=item gcc -ansi -pedantic
Configure -Dgccansipedantic [ -Dcc=gcc ] will enable (via the cflags script,
# define XS(name) EXPORT_C void name(pTHX_ CV* cv)
#endif
#ifndef XS
-# if defined(HASATTRIBUTE)
-# define XS(name) void name(pTHX_ CV* cv __attribute__((unused)))
+# ifdef HASATTRIBUTE_UNUSED
+# define XS(name) void name(pTHX_ CV* cv __attribute__unused__)
# else
# define XS(name) void name(pTHX_ CV* cv)
# endif
#define M_VOID /* Xenix strikes again */
#endif
-/* HASATTRIBUTE:
- * This symbol indicates the C compiler can check for function attributes,
- * such as printf formats. This is normally only supported by GNU cc.
- */
-#$d_attribut HASATTRIBUTE /**/
-#ifndef HASATTRIBUTE
-#ifdef __attribute__
-#undef __attribute__
-#endif
-#define __attribute__(_arg_)
-#endif
+/* HASATTRIBUTE_FORMAT:
+ * Can we handle GCC attribute for checking printf-style formats
+ */
+#$d_attribute_format HASATTRIBUTE_FORMAT /**/
+
+/* HASATTRIBUTE_MALLOC:
+ * Can we handle GCC attribute for malloc-style functions.
+ */
+#$d_attribute_malloc HASATTRIBUTE_MALLOC /**/
+
+/* HASATTRIBUTE_NONNULL:
+ * Can we handle GCC attribute for nonnull function parms.
+ */
+#$d_attribute_nonnull HASATTRIBUTE_NONNULL /**/
+
+/* HASATTRIBUTE_NORETURN:
+ * Can we handle GCC attribute for functions that do not return
+ */
+#$d_attribute_noreturn HASATTRIBUTE_NORETURN /**/
+
+/* HASATTRIBUTE_PURE:
+ * Can we handle GCC attribute for pure functions
+ */
+#$d_attribute_pure HASATTRIBUTE_PURE /**/
+
+/* HASATTRIBUTE_UNUSED:
+ * Can we handle GCC attribute for unused variables and arguments
+ */
+#$d_attribute_unused HASATTRIBUTE_UNUSED /**/
+
+/* HASATTRIBUTE_WARN_UNUSED_RESULT:
+ * Can we handle GCC attribute for warning on unused results
+ */
+#$d_attribute_warn_unused_result HASATTRIBUTE_WARN_UNUSED_RESULT /**/
/* HAS_CRYPT:
* This symbol, if defined, indicates that the crypt routine is available
$ WC "d_archlib='define'"
$ WC "d_atolf='" + d_atolf + "'"
$ WC "d_atoll='" + d_atoll + "'"
-$ WC "d_attribut='" + d_attribut + "'"
+$ WC "d_attribute_format='" + d_attribut + "'"
+$ WC "d_attribute_malloc='undef'"
+$ WC "d_attribute_nonnull='undef'"
+$ WC "d_attribute_noreturn='undef'"
+$ WC "d_attribute_pure='undef'"
+$ WC "d_attribute_unused='undef'"
+$ WC "d_attribute_warn_unused_result='undef'"
$ WC "d_bcmp='" + d_bcmp + "'"
$ WC "d_bcopy='" + d_bcopy + "'"
$ WC "d_bincompat3='undef'"
d_asctime_r='undef'
d_atolf='undef'
d_atoll='undef'
-d_attribut='undef'
+d_attribute_format='undef'
+d_attribute_malloc='undef'
+d_attribute_nonnull='undef'
+d_attribute_noreturn='undef'
+d_attribute_pure='undef'
+d_attribute_unused='undef'
+d_attribute_warn_unused_result='undef'
d_bcmp='define'
d_bcopy='define'
d_bsd='undef'
echo It will not be found there. Try moving it to >&4
echo /NextDeveloper/Headers/bsd/gdbm.h. >&4
-ccflags="$ccflags -DUSE_NEXT_CTYPE -DNEXT30_NO_ATTRIBUTE"
+ccflags="$ccflags -DUSE_NEXT_CTYPE"
POSIX_cflags='ccflags="-posix $ccflags"'
useposix='undef'
ldflags="$ldflags -u libsys_s"
# (Thanks to Andreas Koenig <k@franz.ww.tu-berlin.de>)
ranlib='sleep 5; /bin/ranlib'
+# Doesn't support attributes, so we'll set that here.
+d_attribute_format='undef'
+d_attribute_malloc='undef'
+d_attribute_nonnull='undef'
+d_attribute_noreturn='undef'
+d_attribute_pure='undef'
+d_attribute_unused='undef'
+d_attribute_warn_unused_result='undef'
d_archlib='define'
# randbits='15'
archobjs="vmesa.o"
-d_attribut='undef'
+d_attribute_format='undef'
+d_attribute_malloc='undef'
+d_attribute_nonnull='undef'
+d_attribute_noreturn='undef'
+d_attribute_pure='undef'
+d_attribute_unused='undef'
+d_attribute_warn_unused_result='undef'
d_bcmp='define'
d_bcopy='define'
d_bsd='undef'
# ifndef pTHX
# define pTHX void
# define pTHX_
-# ifdef HASATTRIBUTE
+# ifdef HASATTRIBUTE_UNUSED
# define dTHX extern int Perl___notused PERL_UNUSED_DECL
# else
# define dTHX extern int Perl___notused
{
(void)sv; (void)mg;
Perl_croak(aTHX_ PL_no_modify);
- /* NOT REACHED */
-#ifndef HASATTRIBUTE_NORETURN
- /* No __attribute__((noreturn)), so the compiler doesn't know that
- * croak never returns. */
- return 0;
-#endif
+ NORETURN_FUNCTION_END;
}
U32
Perl_croak(aTHX_ "NOT IMPL LINE %d",__LINE__);
/* STUB */
(void)o;
-#ifndef HASATTRIBUTE_NORETURN
- /* No __attribute__((noreturn)), so the compiler doesn't know that
- * croak never returns. */
- return 0;
-#endif
+ NORETURN_FUNCTION_END;
}
OP *
#pragma fini "perl_fini"
#endif
-#if defined(__GNUC__) && defined(__attribute__)
-/* want to make sure __attribute__ works here even
- * for -Dd_attribut=undef builds.
- */
-#undef __attribute__
+static void
+#if defined(__GNUC__)
+__attribute__((destructor))
#endif
-
-static void __attribute__((destructor))
perl_fini(void)
{
dVAR;
#define CALLREG_INTUIT_STRING CALL_FPTR(PL_regint_string)
#define CALLREGFREE CALL_FPTR(PL_regfree)
-#if defined(SYMBIAN) && defined(__GNUC__)
-# undef __attribute__
-# undef __attribute__(_arg_)
-# define HASATTRIBUTE
-#endif
-
-#ifdef HASATTRIBUTE
-# if (defined(__GNUC__) && defined(__cplusplus)) || defined(__INTEL_COMPILER)
-# define PERL_UNUSED_DECL
-# else
-# define PERL_UNUSED_DECL __attribute__((unused))
-# endif
-#else
-# define PERL_UNUSED_DECL
-#endif
-
-#if defined(SYMBIAN) && defined(__GNUC__)
-# undef __attribute__
-# undef __attribute__(_arg_)
-# define HASATTRIBUTE
-#endif
+#define PERL_UNUSED_DECL __attribute__unused__
/* gcc -Wall:
* for silencing unused variables that are actually used most of the time,
# define PERL_SET_THX(t) PERL_SET_CONTEXT(t)
#endif
+/* This replaces the previous %_ "hack" by the "%-p" hack
+ All that is required is that the perl source does not
+ use "%-p" or "%-<number>p" format. These format will
+ still work in perl code. RMB 2005/05/17
+*/
#ifndef SVf
-# ifdef CHECK_FORMAT
-# define SVf "-p"
-# else
-# define SVf "_"
-# endif
+# define SVf "-p"
#endif
#ifndef SVf_precision
-# ifdef CHECK_FORMAT
-# define SVf_precision(n) "-" n "p"
-# else
-# define SVf_precision(n) "." n "_"
-# endif
+# define SVf_precision(n) "-" n "p"
#endif
#ifndef SVf32
#endif
#ifndef DieNull
-# ifdef CHECK_FORMAT
-# define DieNull Perl_vdie(aTHX_ Nullch, Null(va_list *))
-# else
-# define DieNull Perl_die(aTHX_ Nullch)
+# 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
-#endif
-
-#ifndef __attribute__format__
-# ifdef CHECK_FORMAT
-# define __attribute__format__(x,y,z) __attribute__((format(x,y,z)))
-# else
-# define __attribute__format__(x,y,z)
+# 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
-/* See http://www.ohse.de/uwe/articles/gcc-attributes.html, but
- * contrary to the information warn_unused_result seems not to be in
- * gcc 3.3.5, at least. --jhi */
-#if __GNUC__ >= 3
+#ifdef HASATTRIBUTE_FORMAT
+# define __attribute__format__(x,y,z) __attribute__((format(x,y,z)))
+#endif
+#ifdef HASATTRIBUTE_MALLOC
# define __attribute__malloc__ __attribute__((malloc))
#endif
-#if __GNUC__ == 3 && __GNUC_MINOR__ >= 3 || __GNUC__ > 3
+#ifdef HASATTRIBUTE_NONNULL
# define __attribute__nonnull__(a) __attribute__((nonnull(a)))
#endif
-#if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 || __GNUC__ > 2
+#ifdef HASATTRIBUTE_NORETURN
# define __attribute__noreturn__ __attribute__((noreturn))
#endif
-#if __GNUC__ >= 3
+#ifdef HASATTRIBUTE_PURE
# define __attribute__pure__ __attribute__((pure))
#endif
-#if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 || __GNUC__ > 3
+#ifdef HASATTRIBUTE_UNUSED
+# define __attribute__unused__ __attribute__((unused))
+#endif
+#ifdef HASATTRIBUTE_WARN_UNUSED_RESULT
# define __attribute__warn_unused_result__ __attribute__((warn_unused_result))
#endif
+/* If we haven't defined the attributes yet, define them to blank. */
+#ifndef __attribute__format__
+# define __attribute__format__(x,y,z)
+#endif
#ifndef __attribute__malloc__
# define __attribute__malloc__
#endif
#ifndef __attribute__pure__
# define __attribute__pure__
#endif
+#ifndef __attribute__unused__
+# define __attribute__unused__
+#endif
#ifndef __attribute__warn_unused_result__
# define __attribute__warn_unused_result__
#endif
-#if defined(HASATTRIBUTE) && __GNUC__ >= 3
-# define HASATTRIBUTE_NORETURN
+/* For functions that are marked as __attribute__noreturn__, it's not
+ appropriate to call return. In either case, include the lint directive.
+ */
+#ifdef HASATTRIBUTE_NORETURN
+# define NORETURN_FUNCTION_END /* NOT REACHED */
+#else
+# define NORETURN_FUNCTION_END /* NOT REACHED */ return 0
#endif
/* Some unistd.h's give a prototype for pause() even though
#ifndef PERL_CALLCONV
# define PERL_CALLCONV
#endif
-
-#ifndef NEXT30_NO_ATTRIBUTE
-# ifndef HASATTRIBUTE /* disable GNU-cc attribute checking? */
-# ifdef __attribute__ /* Avoid possible redefinition errors */
-# undef __attribute__
-# endif
-# define __attribute__(attr)
-# endif
-#endif
-
#undef PERL_CKDEF
#undef PERL_PPDEF
#define PERL_CKDEF(s) OP *s (pTHX_ OP *o);
START_EXTERN_C
#ifndef __attribute__format__
-# ifdef CHECK_FORMAT
-# define __attribute__format__(x,y,z) __attribute__((format(x,y,z)))
-# else
-# define __attribute__format__(x,y,z)
-#endif
-#endif
-#ifndef NEXT30_NO_ATTRIBUTE
-#ifndef HASATTRIBUTE /* disable GNU-cc attribute checking? */
-#ifdef __attribute__ /* Avoid possible redefinition errors */
-#undef __attribute__
-#endif
-#define __attribute__(attr)
-#endif
+# define __attribute__format__(x,y,z) __attribute__((format(x,y,z)))
#endif
#ifndef PerlIO_init
PERL_EXPORT_C void PerlIO_init(pTHX);
d_asctime_r='undef'
d_atolf='undef'
d_atoll='define'
-d_attribut='undef'
+d_attribute_format='undef'
+d_attribute_malloc='undef'
+d_attribute_nonnull='undef'
+d_attribute_noreturn='undef'
+d_attribute_pure='undef'
+d_attribute_unused='undef'
+d_attribute_warn_unused_result='undef'
d_bcmp='define'
d_bcopy='define'
d_bsd='undef'
# Plan 9 compiler stuff
print OUT "cc='pcc'\n";
-print OUT "d_attribut='undef'\n";
+print OUT "d_attribute_format='undef'\n";
+print OUT "d_attribute_malloc='undef'\n";
+print OUT "d_attribute_nonnull='undef'\n";
+print OUT "d_attribute_noreturn='undef'\n";
+print OUT "d_attribute_pure='undef'\n";
+print OUT "d_attribute_unused='undef'\n";
+print OUT "d_attribute_warn_unused_result='undef'\n";
print OUT "d_socket='define'\n";
print OUT "d_sockpair='define'\n";
print OUT "d_sigsetjmp='define'\n";
{
Perl_croak(aTHX_ "panic: save_threadsv called in non-threaded perl");
(void)i;
-#ifndef HASATTRIBUTE_NORETURN
- /* No __attribute__((noreturn)), so the compiler doesn't know that
- * croak never returns. */
- return 0;
-#endif
+ NORETURN_FUNCTION_END;
}
void
/* no matter what, this is a string now */
(void)SvPV_force(sv, origlen);
- /* special-case "", "%s", and "%_" */
+ /* special-case "", "%s", and "%-p" (SVf) */
if (patlen == 0)
return;
- if (patlen == 2 && pat[0] == '%') {
- switch (pat[1]) {
- case 's':
+ if (patlen == 2 && pat[0] == '%' && pat[1] == 's') {
if (args) {
const char *s = va_arg(*args, char*);
sv_catpv(sv, s ? s : nullstr);
SvUTF8_on(sv);
}
return;
- case '_':
+ }
+ if (patlen == 3 && pat[0] == '%' &&
+ pat[1] == '-' && pat[2] == 'p') {
if (args) {
argsv = va_arg(*args, SV*);
sv_catsv(sv, argsv);
SvUTF8_on(sv);
return;
}
- /* See comment on '_' below */
- break;
- }
}
#ifndef USE_LONG_DOUBLE
is_utf8 = TRUE;
}
}
- goto string;
-
- case '_':
-#ifdef CHECK_FORMAT
- format_sv:
-#endif
- /*
- * The "%_" hack might have to be changed someday,
- * if ISO or ANSI decide to use '_' for something.
- * So we keep it hidden from users' code.
- */
- if (!args || vectorize)
- goto unknown;
- argsv = va_arg(*args, SV*);
- eptr = SvPVx(argsv, elen);
- if (DO_UTF8(argsv))
- is_utf8 = TRUE;
string:
vectorize = FALSE;
/* INTEGERS */
case 'p':
-#ifdef CHECK_FORMAT
- if (left) {
+ if (left && args) { /* SVf */
left = FALSE;
- if (!width)
- goto format_sv; /* %-p -> %_ */
- precis = width;
- has_precis = TRUE;
- width = 0;
- goto format_sv; /* %-Np -> %.N_ */
+ if (width) {
+ precis = width;
+ has_precis = TRUE;
+ width = 0;
+ }
+ if (vectorize)
+ goto unknown;
+ argsv = va_arg(*args, SV*);
+ eptr = SvPVx(argsv, elen);
+ if (DO_UTF8(argsv))
+ is_utf8 = TRUE;
+ goto string;
}
-#endif
if (alt || vectorize)
goto unknown;
uv = PTR2UV(args ? va_arg(*args, void*) : argsv);
d_asctime_r='undef'
d_atolf='undef'
d_atoll='undef'
-d_attribut='undef'
+d_attribute_format='undef'
+d_attribute_malloc='undef'
+d_attribute_nonnull='undef'
+d_attribute_noreturn='undef'
+d_attribute_pure='undef'
+d_attribute_unused='undef'
+d_attribute_warn_unused_result='undef'
d_bcmp='undef'
d_bcopy='undef'
d_bsd='undef'
>%+o< >642< >1202<
>%#o< >642< >01202<
>%d< >$p=sprintf('%p',$p);$p=~/^[0-9a-f]+$/< >1< >Coarse hack: hex from %p?<
+>%d< >$p=sprintf('%-8p',$p);$p=~/^[0-9a-f]+\s*$/< >1< >Coarse hack: hex from %p?<
>%#p< >''< >%#p INVALID<
>%q< >''< >%q INVALID<
>%r< >''< >%r INVALID<
d_asctime_r='undef'
d_atolf='undef'
d_atoll='undef'
-d_attribut='undef'
+d_attribute_format='undef'
+d_attribute_malloc='undef'
+d_attribute_nonnull='undef'
+d_attribute_noreturn='undef'
+d_attribute_pure='undef'
+d_attribute_unused='undef'
+d_attribute_warn_unused_result='undef'
d_bcmp='undef'
d_bcopy='undef'
d_bsd='undef'
$d_attr = 'undef';
}
print OUT "vms_cc_type='$cctype'\n";
- print OUT "d_attribut='$d_attr'\n";
+ print OUT "d_attribute_format='$d_attr'\n";
+ # XXX The following attributes may be able to use $d_attr, too.
+ print OUT "d_attribute_malloc='undef'\n";
+ print OUT "d_attribute_nonnull='undef'\n";
+ print OUT "d_attribute_noreturn='undef'\n";
+ print OUT "d_attribute_pure='undef'\n";
+ print OUT "d_attribute_unused='undef'\n";
+ print OUT "d_attribute_warn_unused_result='undef'\n";
print OUT "cc='$cc'\n";
if ( ($cctype eq 'decc' and $archsufx eq 'VAX') || $cctype eq 'gcc') {
# gcc and DECC for VAX requires filename in /object qualifier, so we
d_asctime_r='undef'
d_atolf='undef'
d_atoll='undef'
-d_attribut='undef'
+d_attribute_format='undef'
+d_attribute_malloc='undef'
+d_attribute_nonnull='undef'
+d_attribute_noreturn='undef'
+d_attribute_pure='undef'
+d_attribute_unused='undef'
+d_attribute_warn_unused_result='undef'
d_bcmp='undef'
d_bcopy='undef'
d_bsd='define'
d_asctime_r='undef'
d_atolf='undef'
d_atoll='undef'
-d_attribut='define'
+d_attribute_format='undef'
+d_attribute_malloc='undef'
+d_attribute_nonnull='undef'
+d_attribute_noreturn='undef'
+d_attribute_pure='undef'
+d_attribute_unused='undef'
+d_attribute_warn_unused_result='undef'
d_bcmp='undef'
d_bcopy='undef'
d_bsd='define'
d_asctime_r='undef'
d_atolf='undef'
d_atoll='undef'
-d_attribut='undef'
+d_attribute_format='undef'
+d_attribute_malloc='undef'
+d_attribute_nonnull='undef'
+d_attribute_noreturn='undef'
+d_attribute_pure='undef'
+d_attribute_unused='undef'
+d_attribute_warn_unused_result='undef'
d_bcmp='undef'
d_bcopy='undef'
d_bsd='define'
d_asctime_r='undef'
d_atolf='undef'
d_atoll='define'
-d_attribut='undef'
+d_attribute_format='undef'
+d_attribute_malloc='undef'
+d_attribute_nonnull='undef'
+d_attribute_noreturn='undef'
+d_attribute_pure='undef'
+d_attribute_unused='undef'
+d_attribute_warn_unused_result='undef'
d_bcmp='undef'
d_bcopy='undef'
d_bsd='define'
d_asctime_r='undef'
d_atolf='undef'
d_atoll='undef'
-d_attribut='undef'
+d_attribute_format='undef'
+d_attribute_malloc='undef'
+d_attribute_nonnull='undef'
+d_attribute_noreturn='undef'
+d_attribute_pure='undef'
+d_attribute_unused='undef'
+d_attribute_warn_unused_result='undef'
d_bcmp='undef'
d_bcopy='undef'
d_bsd='define'