d_cmsghdr_s=''
d_const=''
d_copysignl=''
+d_cplusplus=''
cryptlib=''
d_crypt=''
crypt_r_proto=''
set d_gnulibc
eval $setvar
+echo " "
+echo "Checking for C++..." >&4
+cat >try.c <<'EOCP'
+#include <stdio.h>
+int main(void)
+{
+#ifdef __cplusplus
+ printf("define\n");
+#else
+ printf("undef\n");
+#endif
+ return 0;
+}
+EOCP
+set try
+if eval $compile_ok && $run ./try > cplusplus; then
+ val=`$cat cplusplus`
+ echo "You are using a C++ compiler."
+else
+ val="$undef"
+ echo "You are not using a C++ compiler."
+fi
+$rm -f try try.* cplusplus
+set d_cplusplus
+eval $setvar
+
: see if nm is to be used to determine whether a symbol is defined or not
case "$usenm" in
'')
: see if dlopen exists
xxx_runnm="$runnm"
+xxx_ccflags="$ccflags"
runnm=false
+: with g++ one needs -shared to get is-in-libc to work for dlopen
+case "$gccversion" in
+'') ;;
+*) case "$d_cplusplus" in
+ "$define") ccflags="$ccflags -shared" ;;
+ esac
+ ;;
+esac
set dlopen d_dlopen
eval $inlibc
runnm="$xxx_runnm"
+ccflags="$xxx_ccflags"
: see if this is a unistd.h system
set unistd.h i_unistd
int main()
{
const char *foo;
- const spug y;
+ const spug y = { 0 };
}
EOCP
if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
d_cmsghdr_s='$d_cmsghdr_s'
d_const='$d_const'
d_copysignl='$d_copysignl'
+d_cplusplus='$d_cplusplus'
d_crypt='$d_crypt'
d_crypt_r='$d_crypt_r'
d_csh='$d_csh'
d_cmsghdr_s='undef'
d_const='define'
d_copysignl='undef'
+d_cplusplus='undef'
d_crypt='undef'
d_crypt_r='undef'
d_csh='undef'
indicates to the C program that this C compiler knows about the
const type.
+d_cplusplus (d_cplusplus.U):
+ This variable conditionally defines the USE_CPLUSPLUS symbol, which
+ indicates that a C++ compiler was used to compiled Perl and will be
+ used to compile extensions.
+
d_copysignl (d_copysignl.U):
This variable conditionally defines the HAS_COPYSIGNL symbol, which
indicates to the C program that the copysignl() routine is available.
d_cmsghdr_s='define'
d_const='define'
d_copysignl='define'
+d_cplusplus='undef'
d_crypt='define'
d_crypt_r='undef'
d_csh='define'
*/
#define HAS_COPYSIGNL /**/
+/* USE_CPLUSPLUS:
+ * This symbol, if defined, indicates that a C++ compiler was
+ * used to compiled Perl and will be used to compile extensions.
+ */
+/*#define USE_CPLUSPLUS /**/
+
/* HAS_DBMINIT_PROTO:
* This symbol, if defined, indicates that the system provides
* a prototype for the dbminit() function. Otherwise, it is up
*) ;;
esac
+case "$cc" in
+*g++*) ccflags="`echo $ccflags|sed 's/-Wdeclaration-after-statement/ /'`" ;;
+esac
+
if test -f .patch; then
ccflags="-DPERL_PATCHNUM=`cat .patch` $ccflags"
fi
*/
#$d_copysignl HAS_COPYSIGNL /**/
+/* USE_CPLUSPLUS:
+ * This symbol, if defined, indicates that a C++ compiler was
+ * used to compiled Perl and will be used to compile extensions.
+ */
+#$d_cplusplus USE_CPLUSPLUS /**/
+
/* HAS_CRYPT:
* This symbol, if defined, indicates that the crypt routine is available
* to encrypt passwords and the like.
$ WC "d_cmsghdr_s='undef'"
$ WC "d_const='define'"
$ WC "d_copysignl='define'"
+$ WC "d_cplusplus='undef'"
$ WC "d_crypt='define'"
$ WC "d_csh='undef'"
$ WC "d_cuserid='define'"
for (;;)
{
const size_t si_name_ix = si->si_type+1; /* -1 is a valid index */
- const char * const si_name =
- (const char *)
- ((si_name_ix >= sizeof(si_names)) ? "????" : si_names[si_name_ix]);
+ const char * const si_name = (si_name_ix >= sizeof(si_names)) ? "????" : si_names[si_name_ix];
I32 ix;
PerlIO_printf(Perl_debug_log, "STACK %"IVdf": %s\n",
(IV)si_ix, si_name);
"%*sTYPE = %s ===> ",
(int)(PL_dumpindent*level-4), "", OP_NAME(o));
if (o->op_next)
- PerlIO_printf(file, (const char *)(seq ? "%"UVf"\n" : "(%"UVf")\n"),
- sequence_num(o->op_next));
+ PerlIO_printf(file, seq ? "%"UVf"\n" : "(%"UVf")\n",
+ sequence_num(o->op_next));
else
PerlIO_printf(file, "DONE\n");
if (o->op_targ) {
d_cmsghdr_s='undef'
d_const='define'
d_copysignl='undef'
+d_cplusplus='undef'
d_crypt='undef'
d_crypt_r='undef'
d_csh='undef'
* this is a dirhandle.
*/
const char * const fh =
- (const char *)
- (PL_op->op_type == OP_READDIR ||
- PL_op->op_type == OP_TELLDIR ||
- PL_op->op_type == OP_SEEKDIR ||
- PL_op->op_type == OP_REWINDDIR ||
- PL_op->op_type == OP_CLOSEDIR ?
- "dirhandle" : "filehandle");
+ PL_op->op_type == OP_READDIR ||
+ PL_op->op_type == OP_TELLDIR ||
+ PL_op->op_type == OP_SEEKDIR ||
+ PL_op->op_type == OP_REWINDDIR ||
+ PL_op->op_type == OP_CLOSEDIR ?
+ "dirhandle" : "filehandle";
Perl_croak(aTHX_ "Bad symbol for %s", fh);
}
Perl_newGP(pTHX_ GV *const gv)
{
GP *gp;
- const char *const file =
- CopFILE(PL_curcop) ? CopFILE(PL_curcop) : (const char *)"";
+ const char *const file = CopFILE(PL_curcop) ? CopFILE(PL_curcop) : "";
STRLEN len = strlen(file);
U32 hash;
SvOK_off(sv);
return;
}
- sv_setpv(sv, prefix ? prefix : (const char *)"");
+ sv_setpv(sv, prefix ? prefix : "");
name = HvNAME_get(hv);
if (name) {
FALSE)))
{
/* Can be an import stub (created by "can"). */
- const char * const name =
- (const char *)
- ((gvsv && SvPOK(gvsv)) ? SvPVX_const(gvsv) : "???");
+ const char * const name = (gvsv && SvPOK(gvsv)) ? SvPVX_const(gvsv) : "???";
Perl_croak(aTHX_ "%s method \"%.256s\" overloading \"%s\" "\
"in package \"%.256s\"",
(GvCVGEN(gv) ? "Stub found while resolving"
void
Perl_gv_fullname(pTHX_ SV *sv, const GV *gv)
{
- gv_fullname3(sv, gv, (const char *)(sv == (const SV*)gv ? "*" : ""));
+ gv_fullname3(sv, gv, sv == (const SV*)gv ? "*" : "");
}
/* compatibility with versions <= 5.003. */
void
Perl_gv_efullname(pTHX_ SV *sv, const GV *gv)
{
- gv_efullname3(sv, gv, (const char *)(sv == (const SV*)gv ? "*" : ""));
+ gv_efullname3(sv, gv, sv == (const SV*)gv ? "*" : "");
}
void
{
const int saveerrno = errno;
sv_setnv(sv, (NV)errno);
- sv_setpv(sv, (const char *)(errno ? Strerror(errno) : ""));
+ sv_setpv(sv, errno ? Strerror(errno) : "");
errno = saveerrno;
}
#endif
sv_setpvn(sv, WARN_NONEstring, WARNsize) ;
}
else if (PL_compiling.cop_warnings == pWARN_STD) {
- sv_setpvn(sv,
- (const char *)
- ((PL_dowarn & G_WARN_ON) ?
- WARN_ALLstring : WARN_NONEstring),
- WARNsize);
+ sv_setpvn(
+ sv,
+ (PL_dowarn & G_WARN_ON) ? WARN_ALLstring : WARN_NONEstring,
+ WARNsize
+ );
}
else if (PL_compiling.cop_warnings == pWARN_ALL) {
/* Get the bit mask for $warnings::Bits{all}, because
sv_setpv(sv, os2error(Perl_rc));
else
#endif
- sv_setpv(sv, (const char *)(errno ? Strerror(errno) : ""));
+ sv_setpv(sv, errno ? Strerror(errno) : "");
errno = saveerrno;
}
#endif
{
dVAR;
STRLEN len = 0, klen;
- const char *s = SvOK(sv) ? SvPV_const(sv,len) : (const char *)"";
+ const char *s = SvOK(sv) ? SvPV_const(sv,len) : "";
const char * const ptr = MgPV_const(mg,klen);
my_setenv(ptr, s);
Perl_magic_nextpack(pTHX_ SV *sv, MAGIC *mg, SV *key)
{
dVAR; dSP;
- const char * const meth = (const char *)(SvOK(key) ? "NEXTKEY" : "FIRSTKEY");
+ const char * const meth = SvOK(key) ? "NEXTKEY" : "FIRSTKEY";
ENTER;
SAVETMPS;
|| ltype == OP_PADHV) && ckWARN(WARN_MISC))
{
const char * const desc
- = PL_op_desc[(rtype == OP_SUBST || rtype == OP_TRANS) ?
- (int)rtype : OP_MATCH];
- const char * const sample =
- (const char *)
- (((ltype == OP_RV2AV || ltype == OP_PADAV)
- ? "@array" : "%hash"));
+ = PL_op_desc[(rtype == OP_SUBST || rtype == OP_TRANS)
+ ? (int)rtype : OP_MATCH];
+ const char * const sample = ((ltype == OP_RV2AV || ltype == OP_PADAV)
+ ? "@array" : "%hash");
Perl_warner(aTHX_ packWARN(WARN_MISC),
"Applying %s to %s will act on scalar(%s)",
desc, sample, sample);
if (label->op_type == OP_STUB && (label->op_flags & OPf_PARENS))
o = newOP(type, OPf_SPECIAL);
else {
- o = newPVOP(type, 0,
- savepv(label->op_type == OP_CONST
- ? SvPVx_nolen_const(((SVOP*)label)->op_sv)
- : (const char *)""));
+ o = newPVOP(type, 0, savepv(label->op_type == OP_CONST
+ ? SvPVx_nolen_const(((SVOP*)label)->op_sv)
+ : ""));
}
#ifdef PERL_MAD
op_getmad(label,o,'L');
aname = NULL;
gv = name ? gv_fetchsv(cSVOPo->op_sv, gv_fetch_flags, SVt_PVCV)
- : gv_fetchpv((const char *)
- (aname ? aname
- : (PL_curstash ? "__ANON__" : "__ANON__::__ANON__")),
+ : gv_fetchpv(aname ? aname
+ : (PL_curstash ? "__ANON__" : "__ANON__::__ANON__"),
gv_fetch_flags, SVt_PVCV);
if (!PL_madskills) {
if (PL_copline != NOLINE)
CopLINE_set(PL_curcop, PL_copline);
Perl_warner(aTHX_ packWARN(WARN_REDEFINE),
- (const char *)
- (CvCONST(cv)
- ? "Constant subroutine %s redefined"
- : "Subroutine %s redefined"), name);
+ CvCONST(cv) ? "Constant subroutine %s redefined"
+ : "Subroutine %s redefined", name);
CopLINE_set(PL_curcop, oldline);
}
#ifdef PERL_MAD
Perl_newXS(pTHX_ const char *name, XSUBADDR_t subaddr, const char *filename)
{
dVAR;
- GV * const gv =
- gv_fetchpv((const char *)
- (name ? name :
- (PL_curstash ? "__ANON__" : "__ANON__::__ANON__")),
- GV_ADDMULTI, SVt_PVCV);
+ GV * const gv = gv_fetchpv(name ? name :
+ (PL_curstash ? "__ANON__" : "__ANON__::__ANON__"),
+ GV_ADDMULTI, SVt_PVCV);
register CV *cv;
if (!subaddr)
if (PL_copline != NOLINE)
CopLINE_set(PL_curcop, PL_copline);
Perl_warner(aTHX_ packWARN(WARN_REDEFINE),
- (const char *)
- (CvCONST(cv)
- ? "Constant subroutine %s redefined"
- : "Subroutine %s redefined"),
- name);
+ CvCONST(cv) ? "Constant subroutine %s redefined"
+ : "Subroutine %s redefined"
+ ,name);
CopLINE_set(PL_curcop, oldline);
}
}
#ifdef GV_UNIQUE_CHECK
if (GvUNIQUE(gv)) {
- Perl_croak(aTHX_ (const char*)"Bad symbol for form (GV is unique)");
+ Perl_croak(aTHX_ "Bad symbol for form (GV is unique)");
}
#endif
GvMULTI_on(gv);
if (PL_copline != NOLINE)
CopLINE_set(PL_curcop, PL_copline);
Perl_warner(aTHX_ packWARN(WARN_REDEFINE),
- (const char *)
- (o
- ? "Format %"SVf" redefined"
- : "Format STDOUT redefined"), (void*)cSVOPo->op_sv);
+ o ? "Format %"SVf" redefined"
+ : "Format STDOUT redefined", (void*)cSVOPo->op_sv);
CopLINE_set(PL_curcop, oldline);
}
SvREFCNT_dec(cv);
if (op) {
SV *tmpstr = NULL;
const char * const a =
- (const char *)
- (kid->op_type == OP_AELEM ?
- "[]" : "{}");
+ kid->op_type == OP_AELEM ?
+ "[]" : "{}";
if (((op->op_type == OP_RV2AV) ||
(op->op_type == OP_RV2HV)) &&
(firstop = ((UNOP*)op)->op_first) &&
if (kid && kid->op_type == OP_MATCH) {
if (ckWARN(WARN_SYNTAX)) {
const REGEXP *re = PM_GETRE(kPMOP);
- const char *pmstr = (const char *)(re ? re->precomp : "STRING");
+ const char *pmstr = re ? re->precomp : "STRING";
Perl_warner(aTHX_ packWARN(WARN_SYNTAX),
"/%s/ should probably be written as \"%s\"",
pmstr, pmstr);
arg++;
if (o3->op_type != OP_REFGEN && o3->op_type != OP_UNDEF)
bad_type(arg,
- (const char*)
- (arg == 1 ? "block or sub {}" : "sub {}"),
- gv_ename(namegv), o3);
+ arg == 1 ? "block or sub {}" : "sub {}",
+ gv_ename(namegv), o3);
break;
case '*':
/* '*' allows any scalar type, including bareword */
#ifndef PERL_GLOBAL_STRUCT_INIT
#ifndef DOINIT
-EXT const U32 PL_opargs[];
+EXTCONST U32 PL_opargs[];
#else
-EXT const U32 PL_opargs[] = {
+EXTCONST U32 PL_opargs[] = {
0x00000000, /* null */
0x00000000, /* stub */
0x00003604, /* scalar */
*/
/*#define HAS_COPYSIGNL /**/
+/* USE_CPLUSPLUS:
+ * This symbol, if defined, indicates that a C++ compiler was
+ * used to compiled Perl and will be used to compile extensions.
+ */
+/*#define USE_CPLUSPLUS /**/
+
/* HAS_DBMINIT_PROTO:
* This symbol, if defined, indicates that the system provides
* a prototype for the dbminit() function. Otherwise, it is up
*/
/*#define HAS_COPYSIGNL /**/
+/* USE_CPLUSPLUS:
+ * This symbol, if defined, indicates that a C++ compiler was
+ * used to compiled Perl and will be used to compile extensions.
+ */
+/*#define USE_CPLUSPLUS /**/
+
/* HAS_DBMINIT_PROTO:
* This symbol, if defined, indicates that the system provides
* a prototype for the dbminit() function. Otherwise, it is up
d_cmsghdr_s='undef'
d_const='define'
d_copysignl='undef'
+d_cplusplus='undef'
d_crypt='undef'
d_crypt_r='undef'
d_csh='undef'
*/
/*#define HAS_PIPE / **/
-/* HAS_POLL:
- * This symbol, if defined, indicates that the poll routine is
- * available to poll active file descriptors. You may safely
- * include <poll.h> when this symbol is defined.
- */
-/*#define HAS_POLL / **/
-
/* HAS_READDIR:
* This symbol, if defined, indicates that the readdir routine is
* available to read directory entries. You may have to include
/*#define HAS_BUILTIN_EXPECT / **/
/*#define HAS_BUILTIN_CHOOSE_EXPR / **/
+/* HAS_C99_VARIADIC_MACROS:
+ * If defined, the compiler supports C99 variadic macros.
+ */
+/*#define HAS_C99_VARIADIC_MACROS / **/
+
/* CASTI32:
* This symbol is defined if the C compiler can cast negative
* or large floating point numbers to 32-bit ints.
*/
/*#define HAS_COPYSIGNL / **/
+/* USE_CPLUSPLUS:
+ * This symbol, if defined, indicates that a C++ compiler was
+ * used to compiled Perl and will be used to compile extensions.
+ */
+/*#define USE_CPLUSPLUS / **/
+
/* HAS_CRYPT:
* This symbol, if defined, indicates that the crypt routine is available
* to encrypt passwords and the like.
/* I_POLL:
* This symbol, if defined, indicates that <poll.h> exists and
- * should be included.
+ * should be included. (see also HAS_POLL)
*/
/*#define I_POLL / **/
#define M_VOID /* Xenix strikes again */
#endif
+/* HAS_POLL:
+ * This symbol, if defined, indicates that the poll routine is
+ * available to poll active file descriptors. You may safely
+ * include <poll.h> when both this symbol *and* I_POLL are defined.
+ */
+/*#define HAS_POLL / **/
+
#endif
d_cmsghdr_s='undef'
d_const='undef'
d_copysignl='undef'
+d_cplusplus='undef'
d_crypt='undef'
d_crypt_r='undef'
d_csh='undef'
d_cmsghdr_s='undef'
d_const='define'
d_copysignl='undef'
+d_cplusplus='undef'
d_crypt='undef'
d_crypt_r='undef'
d_csh='undef'
d_cmsghdr_s='undef'
d_const='define'
d_copysignl='undef'
+d_cplusplus='undef'
d_crypt='undef'
d_crypt_r='undef'
d_csh='undef'
d_cmsghdr_s='undef'
d_const='define'
d_copysignl='undef'
+d_cplusplus='undef'
d_crypt='undef'
d_crypt_r='undef'
d_csh='undef'
d_cmsghdr_s='undef'
d_const='define'
d_copysignl='undef'
+d_cplusplus='undef'
d_crypt='undef'
d_crypt_r='undef'
d_csh='undef'
d_cmsghdr_s='undef'
d_const='define'
d_copysignl='undef'
+d_cplusplus='undef'
d_crypt='undef'
d_crypt_r='undef'
d_csh='undef'
*/
/*#define HAS_CLEARENV /**/
+/* USE_CPLUSPLUS:
+ * This symbol, if defined, indicates that a C++ compiler was
+ * used to compiled Perl and will be used to compile extensions.
+ */
+/*#define USE_CPLUSPLUS /**/
+
/* HAS_COPYSIGNL:
* This symbol, if defined, indicates that the copysignl routine is
* available. If aintl is also present we can emulate modfl.
*/
/*#define HAS_COPYSIGNL /**/
+/* USE_CPLUSPLUS:
+ * This symbol, if defined, indicates that a C++ compiler was
+ * used to compiled Perl and will be used to compile extensions.
+ */
+/*#define USE_CPLUSPLUS /**/
+
/* HAS_DBMINIT_PROTO:
* This symbol, if defined, indicates that the system provides
* a prototype for the dbminit() function. Otherwise, it is up
*/
/*#define HAS_COPYSIGNL /**/
+/* USE_CPLUSPLUS:
+ * This symbol, if defined, indicates that a C++ compiler was
+ * used to compiled Perl and will be used to compile extensions.
+ */
+/*#define USE_CPLUSPLUS /**/
+
/* HAS_DBMINIT_PROTO:
* This symbol, if defined, indicates that the system provides
* a prototype for the dbminit() function. Otherwise, it is up
*/
/*#define HAS_COPYSIGNL /**/
+/* USE_CPLUSPLUS:
+ * This symbol, if defined, indicates that a C++ compiler was
+ * used to compiled Perl and will be used to compile extensions.
+ */
+/*#define USE_CPLUSPLUS /**/
+
/* HAS_DBMINIT_PROTO:
* This symbol, if defined, indicates that the system provides
* a prototype for the dbminit() function. Otherwise, it is up
*/
/*#define HAS_COPYSIGNL /**/
+/* USE_CPLUSPLUS:
+ * This symbol, if defined, indicates that a C++ compiler was
+ * used to compiled Perl and will be used to compile extensions.
+ */
+/*#define USE_CPLUSPLUS /**/
+
/* HAS_DBMINIT_PROTO:
* This symbol, if defined, indicates that the system provides
* a prototype for the dbminit() function. Otherwise, it is up