Skip to content

Commit

Permalink
g++ stage 1 reached
Browse files Browse the repository at this point in the history
Message-ID: <[email protected]>

p4raw-id: //depot/perl@28674
  • Loading branch information
jhi authored and smpeters committed Aug 8, 2006
1 parent 0ec9ad9 commit 666ea19
Show file tree
Hide file tree
Showing 31 changed files with 182 additions and 79 deletions.
40 changes: 39 additions & 1 deletion Configure
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ d_void_closedir=''
d_cmsghdr_s=''
d_const=''
d_copysignl=''
d_cplusplus=''
cryptlib=''
d_crypt=''
crypt_r_proto=''
Expand Down Expand Up @@ -7136,6 +7137,32 @@ $rm -f try try.* glibc.ver
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
'')
Expand Down Expand Up @@ -7585,10 +7612,20 @@ esac'

: 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
Expand Down Expand Up @@ -10845,7 +10882,7 @@ typedef struct spug { int drokk; } spug;
int main()
{
const char *foo;
const spug y;
const spug y = { 0 };
}
EOCP
if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
Expand Down Expand Up @@ -21328,6 +21365,7 @@ d_closedir='$d_closedir'
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'
Expand Down
1 change: 1 addition & 0 deletions NetWare/config.wc
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ d_closedir='define'
d_cmsghdr_s='undef'
d_const='define'
d_copysignl='undef'
d_cplusplus='undef'
d_crypt='undef'
d_crypt_r='undef'
d_csh='undef'
Expand Down
5 changes: 5 additions & 0 deletions Porting/Glossary
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,11 @@ d_const (d_const.U):
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.
Expand Down
1 change: 1 addition & 0 deletions Porting/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ d_closedir='define'
d_cmsghdr_s='define'
d_const='define'
d_copysignl='define'
d_cplusplus='undef'
d_crypt='define'
d_crypt_r='undef'
d_csh='define'
Expand Down
6 changes: 6 additions & 0 deletions Porting/config_H
Original file line number Diff line number Diff line change
Expand Up @@ -3869,6 +3869,12 @@
*/
#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
Expand Down
4 changes: 4 additions & 0 deletions cflags.SH
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,10 @@ for file do
*) ;;
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
Expand Down
6 changes: 6 additions & 0 deletions config_h.SH
Original file line number Diff line number Diff line change
Expand Up @@ -1259,6 +1259,12 @@ sed <<!GROK!THIS! >$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un
*/
#$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.
Expand Down
1 change: 1 addition & 0 deletions configure.com
Original file line number Diff line number Diff line change
Expand Up @@ -5696,6 +5696,7 @@ $ WC "d_class='undef'"
$ 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'"
Expand Down
4 changes: 1 addition & 3 deletions deb.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,7 @@ Perl_deb_stack_all(pTHX)
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);
Expand Down
4 changes: 2 additions & 2 deletions dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -718,8 +718,8 @@ Perl_do_op_dump(pTHX_ I32 level, PerlIO *file, const OP *o)
"%*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) {
Expand Down
1 change: 1 addition & 0 deletions epoc/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ d_cmsghdr_s='undef'
d_cmsghdr_s='undef'
d_const='define'
d_copysignl='undef'
d_cplusplus='undef'
d_crypt='undef'
d_crypt_r='undef'
d_csh='undef'
Expand Down
22 changes: 9 additions & 13 deletions gv.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,12 @@ Perl_gv_IOadd(pTHX_ register GV *gv)
* 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);
}

Expand Down Expand Up @@ -162,8 +161,7 @@ GP *
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;

Expand Down Expand Up @@ -1277,7 +1275,7 @@ Perl_gv_fullname4(pTHX_ SV *sv, const GV *gv, const char *prefix, bool keepmain)
SvOK_off(sv);
return;
}
sv_setpv(sv, prefix ? prefix : (const char *)"");
sv_setpv(sv, prefix ? prefix : "");

name = HvNAME_get(hv);
if (name) {
Expand Down Expand Up @@ -1562,9 +1560,7 @@ Perl_Gv_AMupdate(pTHX_ HV *stash)
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"
Expand Down
4 changes: 2 additions & 2 deletions mathoms.c
Original file line number Diff line number Diff line change
Expand Up @@ -484,14 +484,14 @@ Perl_huge(void)
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
Expand Down
18 changes: 9 additions & 9 deletions mg.c
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg)
{
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
Expand Down Expand Up @@ -810,11 +810,11 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg)
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
Expand Down Expand Up @@ -993,7 +993,7 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg)
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
Expand Down Expand Up @@ -1048,7 +1048,7 @@ Perl_magic_setenv(pTHX_ SV *sv, MAGIC *mg)
{
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);

Expand Down Expand Up @@ -1650,7 +1650,7 @@ int
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;
Expand Down
Loading

0 comments on commit 666ea19

Please sign in to comment.