Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"unused parameter" warning when building with g++ #15979

Closed
p5pRT opened this issue May 14, 2017 · 11 comments
Closed

"unused parameter" warning when building with g++ #15979

p5pRT opened this issue May 14, 2017 · 11 comments

Comments

@p5pRT
Copy link

p5pRT commented May 14, 2017

Migrated from rt.perl.org#131314 (status was 'resolved')

Searchable as RT131314$

@p5pRT
Copy link
Author

p5pRT commented May 14, 2017

From @jkeenan

Observed today running 'make' on perl 5 blead when compiling with​:

g++ --version
g++ (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609

$ grep -nC2 'warning​:' g++.en_US.utf8.typescript
886-g++ -c -DPERL_CORE -fwrapv -fno-strict-aliasing -pipe
-fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -ansi -O2 -Wall
-Werror=declaration-after-statement -Wextra -Wwrite-strings perlio.c
887-In file included from perlio.c​:50​:0​:
888​:XSUB.h​:122​:43​: warning​: unused parameter ‘cv’ [-Wunused-parameter]
889- #define XSPROTO(name) void name(pTHX_ CV* cv)
890- ^
--
898- XS(XS_PerlIO__Layer__NoWarnings)
899- ^
900​:XSUB.h​:122​:43​: warning​: unused parameter ‘cv’ [-Wunused-parameter]
901- #define XSPROTO(name) void name(pTHX_ CV* cv)
902-

The patch attached silences the warning. Please review (for 5.27.0).

Thank you very much.
Jim Keenan

@p5pRT
Copy link
Author

p5pRT commented May 14, 2017

From @jkeenan

0001-Avoid-unused-parameter-warning-when-compiling-with-g.patch
From b7911fe4c1f885c2c72d97ed9cc223418934f374 Mon Sep 17 00:00:00 2001
From: James E Keenan <jkeenan@cpan.org>
Date: Sun, 14 May 2017 09:57:21 -0400
Subject: [PATCH] Avoid unused-parameter warning when compiling with g++.

---
 XSUB.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/XSUB.h b/XSUB.h
index e74abae..ec7b58d 100644
--- a/XSUB.h
+++ b/XSUB.h
@@ -119,7 +119,7 @@ is a lexical C<$_> in scope.
  * "STATIC", ie. it exports XSUB symbols. You probably don't want that.
  */
 
-#define XSPROTO(name) void name(pTHX_ CV* cv)
+#define XSPROTO(name) void name(pTHX_ CV* cv __attribute__unused__)
 
 #undef XS
 #undef XS_EXTERNAL
-- 
2.7.4

@p5pRT
Copy link
Author

p5pRT commented May 14, 2017

From @jkeenan

Summary of my perl5 (revision 5 version 26 subversion 0) configuration​:
  Commit id​: 9e71673
  Platform​:
  osname=linux
  osvers=4.4.0-77-generic
  archname=x86_64-linux
  uname='linux zareason 4.4.0-77-generic #98-ubuntu smp wed apr 26 08​:34​:02 utc 2017 x86_64 x86_64 x86_64 gnulinux '
  config_args='-des -Dusedevel -Dcc=g++'
  hint=recommended
  useposix=true
  d_sigaction=define
  useithreads=undef
  usemultiplicity=undef
  use64bitint=define
  use64bitall=define
  uselongdouble=undef
  usemymalloc=n
  default_inc_excludes_dot=define
  bincompat5005=undef
  Compiler​:
  cc='g++'
  ccflags ='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
  optimize='-O2'
  cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
  ccversion=''
  gccversion='5.4.0 20160609'
  gccosandvers=''
  intsize=4
  longsize=8
  ptrsize=8
  doublesize=8
  byteorder=12345678
  doublekind=3
  d_longlong=define
  longlongsize=8
  d_longdbl=define
  longdblsize=16
  longdblkind=3
  ivtype='long'
  ivsize=8
  nvtype='double'
  nvsize=8
  Off_t='off_t'
  lseeksize=8
  alignbytes=8
  prototype=define
  Linker and Libraries​:
  ld='g++'
  ldflags =' -fstack-protector-strong -L/usr/local/lib'
  libpth=/usr/include/c++/5 /usr/include/x86_64-linux-gnu/c++/5 /usr/include/c++/5/backward /usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed /usr/include/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib /lib64 /usr/lib64
  libs=-lpthread -lnsl -ldb -ldl -lm -lcrypt -lutil -lc
  perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
  libc=libc-2.23.so
  so=so
  useshrplib=false
  libperl=libperl.a
  gnulibc_version='2.23'
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs
  dlext=so
  d_dlsymun=undef
  ccdlflags='-Wl,-E'
  cccdlflags='-fPIC'
  lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector-strong'

Characteristics of this binary (from libperl)​:
  Compile-time options​:
  HAS_TIMES
  PERLIO_LAYERS
  PERL_COPY_ON_WRITE
  PERL_DONT_CREATE_GVSV
  PERL_MALLOC_WRAP
  PERL_OP_PARENT
  PERL_PRESERVE_IVUV
  PERL_USE_DEVEL
  USE_64_BIT_ALL
  USE_64_BIT_INT
  USE_LARGE_FILES
  USE_LOCALE
  USE_LOCALE_COLLATE
  USE_LOCALE_CTYPE
  USE_LOCALE_NUMERIC
  USE_LOCALE_TIME
  USE_PERLIO
  USE_PERL_ATOF
  Built under linux
  Compiled at May 14 2017 09​:10​:27
  %ENV​:
  PERLBREW_BASHRC_VERSION="0.78"
  PERLBREW_HOME="/home/jkeenan/.perlbrew"
  PERLBREW_MANPATH="/home/jkeenan/perl5/perlbrew/perls/perl-5.24.1/man"
  PERLBREW_PATH="/home/jkeenan/perl5/perlbrew/bin​:/home/jkeenan/perl5/perlbrew/perls/perl-5.24.1/bin"
  PERLBREW_PERL="perl-5.24.1"
  PERLBREW_ROOT="/home/jkeenan/perl5/perlbrew"
  PERLBREW_VERSION="0.78"
  PERL_WORKDIR="/home/jkeenan/gitwork/perl"
  @​INC​:
  lib
  /usr/local/lib/perl5/site_perl/5.26.0/x86_64-linux
  /usr/local/lib/perl5/site_perl/5.26.0
  /usr/local/lib/perl5/5.26.0/x86_64-linux
  /usr/local/lib/perl5/5.26.0

@p5pRT
Copy link
Author

p5pRT commented May 14, 2017

From @jkeenan

On Sun, 14 May 2017 19​:24​:51 GMT, jkeenan@​pobox.com wrote​:

Observed today running 'make' on perl 5 blead when compiling with​:

g++ --version
g++ (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609

$ grep -nC2 'warning​:' g++.en_US.utf8.typescript
886-g++ -c -DPERL_CORE -fwrapv -fno-strict-aliasing -pipe
-fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -ansi -O2 -Wall
-Werror=declaration-after-statement -Wextra -Wwrite-strings perlio.c
887-In file included from perlio.c​:50​:0​:
888​:XSUB.h​:122​:43​: warning​: unused parameter ‘cv’ [-Wunused-parameter]
889- #define XSPROTO(name) void name(pTHX_ CV* cv)
890- ^

Available for smoking in the smoke-me/jkeenan/gplusplus-warning branch.

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented May 14, 2017

From [Unknown Contact. See original ticket]

On Sun, 14 May 2017 19​:24​:51 GMT, jkeenan@​pobox.com wrote​:

Observed today running 'make' on perl 5 blead when compiling with​:

g++ --version
g++ (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609

$ grep -nC2 'warning​:' g++.en_US.utf8.typescript
886-g++ -c -DPERL_CORE -fwrapv -fno-strict-aliasing -pipe
-fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -ansi -O2 -Wall
-Werror=declaration-after-statement -Wextra -Wwrite-strings perlio.c
887-In file included from perlio.c​:50​:0​:
888​:XSUB.h​:122​:43​: warning​: unused parameter ‘cv’ [-Wunused-parameter]
889- #define XSPROTO(name) void name(pTHX_ CV* cv)
890- ^

Available for smoking in the smoke-me/jkeenan/gplusplus-warning branch.

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Jun 1, 2017

From @jkeenan

On Sun, 14 May 2017 19​:24​:51 GMT, jkeenan@​pobox.com wrote​:

Observed today running 'make' on perl 5 blead when compiling with​:

g++ --version
g++ (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609

$ grep -nC2 'warning​:' g++.en_US.utf8.typescript
886-g++ -c -DPERL_CORE -fwrapv -fno-strict-aliasing -pipe
-fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -ansi -O2 -Wall
-Werror=declaration-after-statement -Wextra -Wwrite-strings perlio.c
887-In file included from perlio.c​:50​:0​:
888​:XSUB.h​:122​:43​: warning​: unused parameter ‘cv’ [-Wunused-parameter]
889- #define XSPROTO(name) void name(pTHX_ CV* cv)
890- ^

Patch applied to blead in commit 53dfb2b. Will monitor for 7 days, then close unless problems appear.

Thank you very much.

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Jun 1, 2017

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Jun 7, 2017

From @jkeenan

On Thu, 01 Jun 2017 13​:51​:52 GMT, jkeenan wrote​:

On Sun, 14 May 2017 19​:24​:51 GMT, jkeenan@​pobox.com wrote​:

Observed today running 'make' on perl 5 blead when compiling with​:

g++ --version
g++ (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609

$ grep -nC2 'warning​:' g++.en_US.utf8.typescript
886-g++ -c -DPERL_CORE -fwrapv -fno-strict-aliasing -pipe
-fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -ansi -O2 -Wall
-Werror=declaration-after-statement -Wextra -Wwrite-strings perlio.c
887-In file included from perlio.c​:50​:0​:
888​:XSUB.h​:122​:43​: warning​: unused parameter ‘cv’ [-Wunused-
parameter]
889- #define XSPROTO(name) void name(pTHX_ CV* cv)
890- ^

Patch applied to blead in commit
53dfb2b. Will monitor for 7 days,
then close unless problems appear.

Thank you very much.

Let's explore one smoke-test failure.

[tux], recently you submitted our very first ever smoke test reports using GCC version 7. I'm glad that as part of that effort you tested building perl with g++ version 7.1.1, as reported here​:

http​://perl5.test-smoke.org/report/56002

The g++-7.1.1 build failed in all cases where you did not include these config_args​:

-Duse64bitall -Duselongdouble

#####
Test failures​:
~~ ../t/op/sprintf2.t .......................................... FAILED 1492-1497
  [stdio/perlio/locale​:en_US.utf8] -Dcc=g++ -Duseithreads
  [stdio/perlio/locale​:en_US.utf8] -Dcc=g++ DEBUGGING
  [stdio/perlio/locale​:en_US.utf8] -Dcc=g++
  [stdio/perlio/locale​:en_US.utf8] -Dcc=g++ -Duseithreads DEBUGGING
#####

Have you had a chance to look at these test failures?

I ask because I need to rule out the possibility that the changes in 53dfb2b were the source of the problem.

Thank you very much.

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Jun 8, 2017

From @Tux

On Wed, 07 Jun 2017 14​:57​:18 -0700, "James E Keenan via RT"
<perlbug-followup@​perl.org> wrote​:

On Thu, 01 Jun 2017 13​:51​:52 GMT, jkeenan wrote​:

On Sun, 14 May 2017 19​:24​:51 GMT, jkeenan@​pobox.com wrote​:

Observed today running 'make' on perl 5 blead when compiling with​:

g++ --version
g++ (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609

$ grep -nC2 'warning​:' g++.en_US.utf8.typescript
886-g++ -c -DPERL_CORE -fwrapv -fno-strict-aliasing -pipe
-fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -ansi -O2 -Wall
-Werror=declaration-after-statement -Wextra -Wwrite-strings perlio.c
887-In file included from perlio.c​:50​:0​:
888​:XSUB.h​:122​:43​: warning​: unused parameter ‘cv’ [-Wunused-
parameter]
889- #define XSPROTO(name) void name(pTHX_ CV* cv)
890- ^

Patch applied to blead in commit
53dfb2b. Will monitor for 7 days,
then close unless problems appear.

Thank you very much.

Let's explore one smoke-test failure.

[tux], recently you submitted our very first ever smoke test reports
using GCC version 7. I'm glad that as part of that effort you tested
building perl with g++ version 7.1.1, as reported here​:

http​://perl5.test-smoke.org/report/56002

The g++-7.1.1 build failed in all cases where you did not include
these config_args​:

-Duse64bitall -Duselongdouble

#####
Test failures​:
~~ ../t/op/sprintf2.t ..........................................
FAILED 1492-1497 [stdio/perlio/locale​:en_US.utf8] -Dcc=g++
-Duseithreads [stdio/perlio/locale​:en_US.utf8] -Dcc=g++ DEBUGGING
[stdio/perlio/locale​:en_US.utf8] -Dcc=g++
[stdio/perlio/locale​:en_US.utf8] -Dcc=g++ -Duseithreads DEBUGGING
#####

Have you had a chance to look at these test failures?

I think they are related to Jarkko's ongoing work on fpclassify and
subnormal behavior​:

perl-git/t $ ./perl -I ../lib harness -v op/sprintf2.t |& grep -v '^ok '
# Failed test 1530 - subnormal 0x1.fffffffffffffp-1022 %a 0x1.fffffffffffffp-1022 got 0x0p+0 at op/sprintf2.t line 811
# got "0x0p+0"
# expected "0x1.fffffffffffffp-1022"
# Failed test 1531 - subnormal 0x0.fffffffffffffp-1022 %a 0x1.ffffffffffffep-1023 got 0x0p+0 at op/sprintf2.t line 811
# got "0x0p+0"
# expected "0x1.ffffffffffffep-1023"
# Failed test 1532 - subnormal 0x0.7ffffffffffffp-1022 %a 0x1.ffffffffffffcp-1024 got 0x0p+0 at op/sprintf2.t line 811
# got "0x0p+0"
# expected "0x1.ffffffffffffcp-1024"
# Failed test 1533 - subnormal 0x0.3ffffffffffffp-1022 %a 0x1.ffffffffffff8p-1025 got 0x0p+0 at op/sprintf2.t line 811
# got "0x0p+0"
# expected "0x1.ffffffffffff8p-1025"
# Failed test 1534 - subnormal 0x0.1ffffffffffffp-1022 %a 0x1.ffffffffffffp-1026 got 0x0p+0 at op/sprintf2.t line 811
# got "0x0p+0"
# expected "0x1.ffffffffffffp-1026"
# Failed test 1535 - subnormal 0x0.0ffffffffffffp-1022 %a 0x1.fffffffffffep-1027 got 0x0p+0 at op/sprintf2.t line 811
# got "0x0p+0"
# expected "0x1.fffffffffffep-1027"
op/sprintf2.t ..
# uvsize = 8
# nvsize = 8
# nv_preserves_uv_bits = 53
# d_quad = define
# uselongdouble = undef
not ok 1530 - subnormal 0x1.fffffffffffffp-1022 %a 0x1.fffffffffffffp-1022 got 0x0p+0
not ok 1531 - subnormal 0x0.fffffffffffffp-1022 %a 0x1.ffffffffffffep-1023 got 0x0p+0
not ok 1532 - subnormal 0x0.7ffffffffffffp-1022 %a 0x1.ffffffffffffcp-1024 got 0x0p+0
not ok 1533 - subnormal 0x0.3ffffffffffffp-1022 %a 0x1.ffffffffffff8p-1025 got 0x0p+0
not ok 1534 - subnormal 0x0.1ffffffffffffp-1022 %a 0x1.ffffffffffffp-1026 got 0x0p+0
not ok 1535 - subnormal 0x0.0ffffffffffffp-1022 %a 0x1.fffffffffffep-1027 got 0x0p+0
1..1674
Failed 6/1674 subtests
  (less 30 skipped subtests​: 1638 okay)

Test Summary Report


op/sprintf2.t (Wstat​: 0 Tests​: 1674 Failed​: 6)
  Failed tests​: 1530-1535
Files=1, Tests=1674, 0 wallclock secs ( 0.13 usr 0.00 sys + 0.27 cusr 0.12 csys = 0.52 CPU)
Result​: FAIL

I ask because I need to rule out the possibility that the changes in
53dfb2b were the source of the
problem.

Thank you very much.

--
H.Merijn Brand http​://tux.nl Perl Monger http​://amsterdam.pm.org/
using perl5.00307 .. 5.27 porting perl5 on HP-UX, AIX, and openSUSE
http​://mirrors.develooper.com/hpux/ http​://www.test-smoke.org/
http​://qa.perl.org http​://www.goldmark.org/jeff/stupid-disclaimers/

@p5pRT
Copy link
Author

p5pRT commented Jun 8, 2017

From @jkeenan

On Thu, 08 Jun 2017 10​:55​:43 GMT, hmbrand wrote​:

On Wed, 07 Jun 2017 14​:57​:18 -0700, "James E Keenan via RT"
[snip]

Let's explore one smoke-test failure.

[tux], recently you submitted our very first ever smoke test reports
using GCC version 7. I'm glad that as part of that effort you tested
building perl with g++ version 7.1.1, as reported here​:

http​://perl5.test-smoke.org/report/56002

The g++-7.1.1 build failed in all cases where you did not include
these config_args​:

-Duse64bitall -Duselongdouble

I think they are related to Jarkko's ongoing work on fpclassify and
subnormal behavior​:

Sounds reasonable. Thanks for your rapid response. Marking ticket Resolved.

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Jun 8, 2017

@jkeenan - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant