Open jkeenan opened 3 years ago
https://github.com/timbunce/devel-nytprof/pull/190 -- which is a cherry-pick of a patch from @rurban from 2 years ago -- appears to clear up most of these warnings. Here is my before/after comparison:
Effect of applying rurban patch 5599d1ab50 in branch gpp-build-time-warnings-20210505
[perlmonger: devel-nytprof] $ ~/bin/perl/report-build-warnings gpp.master.output.txt
File: gpp.master.output.txt
Wliteral-suffix 35
Wwrite-strings 3
[perlmonger: devel-nytprof] $ ~/bin/perl/report-build-warnings gpp.branch.output.txt
File: gpp.branch.output.txt
Wwrite-strings 3
With one more commit to the gpp-build-time-warnings-20210505 branch (https://github.com/timbunce/devel-nytprof/pull/190), we can reduce the remaining number of g++ build-time warnings from 3 to 2.
~/bin/perl/report-build-warnings gpp.branch.output.2nd.txt
File: gpp.branch.output.2nd.txt
Wwrite-strings 2
With release of CPAN version 6.10, 2 -Wwrite-strings
build-time warnings remain when compiling with g++
.
With release of CPAN version 6.10, 2
-Wwrite-strings
build-time warnings remain when compiling withg++
.
$ parse-build-warnings 5c915c93d2.freebsd.g++9.make.output.txt.gz
File: 5c915c93d2.freebsd.g++9.make.output.txt.gz
[
{
char => 37,
group => "Wwrite-strings",
line => 226,
source => "NYTProf.xs",
text => "ISO C++ forbids converting a string constant to 'char*'",
},
{
char => 37,
group => "Wwrite-strings",
line => 231,
source => "NYTProf.xs",
text => "ISO C++ forbids converting a string constant to 'char*'",
},
]
My local and remote machines have been upgraded. Here is a status update on warnings emitted during make
when compiling Devel-NYTProf (master branch) with the default versions of g++
.
Ubuntu Linux 22.04 LTS
$ g++ --version | head -n 1
g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
$ report-build-warnings 2a11e63e8d.linux.g++-11.make.output.txt.gz
File: 2a11e63e8d.linux.g++-11.make.output.txt.gz
Wregister 4
Wwrite-strings 2
$ parse-build-warnings 2a11e63e8d.linux.g++-11.make.output.txt.gz
File: 2a11e63e8d.linux.g++-11.make.output.txt.gz
[
{
char => 37,
group => "Wwrite-strings",
line => 226,
source => "NYTProf.xs",
text => "ISO C++ forbids converting a string constant to \xE2\x80\x98char*\xE2\x80\x99",
},
{
char => 37,
group => "Wwrite-strings",
line => 231,
source => "NYTProf.xs",
text => "ISO C++ forbids converting a string constant to \xE2\x80\x98char*\xE2\x80\x99",
},
{
char => 28,
group => "Wregister",
line => 1281,
source => "NYTProf.xs",
text => "ISO C++17 does not allow \xE2\x80\x98register\xE2\x80\x99 storage class specifier",
},
{
char => 18,
group => "Wregister",
line => 1407,
source => "NYTProf.xs",
text => "ISO C++17 does not allow \xE2\x80\x98register\xE2\x80\x99 storage class specifier",
},
{
char => 28,
group => "Wregister",
line => 1408,
source => "NYTProf.xs",
text => "ISO C++17 does not allow \xE2\x80\x98register\xE2\x80\x99 storage class specifier",
},
{
char => 28,
group => "Wregister",
line => 1409,
source => "NYTProf.xs",
text => "ISO C++17 does not allow \xE2\x80\x98register\xE2\x80\x99 storage class specifier",
},
]
FreeBSD-13
$ g++ --version | head -n 1
g++ (FreeBSD Ports Collection) 12.2.0
$ report-build-warnings 2a11e63e8d.freebsd.threaded.gcc12.make.output.tx
t.gz
File: 2a11e63e8d.freebsd.threaded.gcc12.make.output.txt.gz
Wregister 4
Wwrite-strings 2
$ parse-build-warnings 2a11e63e8d.freebsd.threaded.gcc12.make.output.txt.gz
File: 2a11e63e8d.freebsd.threaded.gcc12.make.output.txt.gz
[
{
char => 37,
group => "Wwrite-strings",
line => 226,
source => "NYTProf.xs",
text => "ISO C++ forbids converting a string constant to 'char*'",
},
{
char => 37,
group => "Wwrite-strings",
line => 231,
source => "NYTProf.xs",
text => "ISO C++ forbids converting a string constant to 'char*'",
},
{
char => 28,
group => "Wregister",
line => 1281,
source => "NYTProf.xs",
text => "ISO C++17 does not allow 'register' storage class specifier",
},
{
char => 18,
group => "Wregister",
line => 1407,
source => "NYTProf.xs",
text => "ISO C++17 does not allow 'register' storage class specifier",
},
{
char => 28,
group => "Wregister",
line => 1408,
source => "NYTProf.xs",
text => "ISO C++17 does not allow 'register' storage class specifier",
},
{
char => 28,
group => "Wregister",
line => 1409,
source => "NYTProf.xs",
text => "ISO C++17 does not allow 'register' storage class specifier",
},
]
So on both platforms g++
is now emitting -Wregister
warnings related to C++17. Context (from the FreeBSD run):
NYTProf.xs: In function ‘int dopopcx_at(PerlInterpreter*, PERL_CONTEXT*, I32, UV)’:
NYTProf.xs:1281:28: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
1281 | register PERL_CONTEXT *cx;
| ^~
NYTProf.xs: In function ‘PERL_CONTEXT* visit_contexts(PerlInterpreter*, UV, int (*)(PerlInterpreter*, PERL_CONTEXT*, UV*))’:
NYTProf.xs:1407:18: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
1407 | register I32 cxix = cxstack_ix;
| ^~~~
NYTProf.xs:1408:28: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
1408 | register PERL_CONTEXT *cx = NULL;
| ^~
NYTProf.xs:1409:28: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
1409 | register PERL_CONTEXT *ccstack = cxstack;
| ^~~~~~~
I don't follow C++ development. Is there anyone who could shed some light on this?
The 4 -Wregister
warnings should be gone as of version 6.13 of Devel-NYTProf, uploaded just now to CPAN. That should leave the 2 -Wwrite-strings
warnings.
With a
perl-5.32.1
compiled on FreeBSD withg++
, I got these build-time errors when runningmake
for Devel-NYTProf: