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

[PATCH] Avoid gratuitous warning from -Wundef #17181

Closed
p5pRT opened this issue Oct 12, 2019 · 6 comments
Closed

[PATCH] Avoid gratuitous warning from -Wundef #17181

p5pRT opened this issue Oct 12, 2019 · 6 comments

Comments

@p5pRT
Copy link

p5pRT commented Oct 12, 2019

Migrated from rt.perl.org#134494 (status was 'pending release')

Searchable as RT134494$

@p5pRT
Copy link
Author

p5pRT commented Oct 12, 2019

From peter@eisentraut.org

This is a bug report for perl from peter@​eisentraut.org,
generated with the help of perlbug 1.41 running under perl 5.30.0.


Use #ifdef instead of #if to avoid warning if a user of this header
file uses the gcc -Wundef option.



Flags​:
  category=library
  severity=wishlist
  Type=Patch
  PatchStatus=HasPatch


Site configuration information for perl 5.30.0​:

Configured by brew at Thu May 30 18​:27​:37 BST 2019.

Summary of my perl5 (revision 5 version 30 subversion 0) configuration​:

  Platform​:
  osname=darwin
  osvers=18.6.0
  archname=darwin-thread-multi-2level
  uname='darwin mojave-2.local 18.6.0 darwin kernel version 18.6.0​: thu apr 25 23​:16​:27 pdt 2019; root​:xnu-4903.261.4~2releas>
  config_args='-des -Dprefix=/usr/local/Cellar/perl/5.30.0 -Dprivlib=/usr/local/Cellar/perl/5.30.0/lib/perl5/5.30.0 -Dsitelib>
  hint=recommended
  useposix=true
  d_sigaction=define
  useithreads=define
  usemultiplicity=define
  use64bitint=define
  use64bitall=define
  uselongdouble=undef
  usemymalloc=n
  default_inc_excludes_dot=define
  bincompat5005=undef
  Compiler​:
  cc='cc'
  ccflags ='-fno-common -DPERL_DARWIN -mmacosx-version-min=10.14 -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/l>
  optimize='-O3'
  cppflags='-fno-common -DPERL_DARWIN -mmacosx-version-min=10.14 -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/l>
  ccversion=''
  gccversion='4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.46.4)'
  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='cc'
  ldflags =' -mmacosx-version-min=10.14 -fstack-protector-strong -L/usr/local/lib'
  libpth=/usr/local/lib /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/u>
  libs=-lpthread -ldbm -ldl -lm -lutil -lc
  perllibs=-lpthread -ldl -lm -lutil -lc
  libc=
  so=dylib
  useshrplib=true
  libperl=libperl.dylib
  gnulibc_version=''
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs
  dlext=bundle
  d_dlsymun=undef
  ccdlflags=' '
  cccdlflags=' '
  lddlflags=' -mmacosx-version-min=10.14 -bundle -undefined dynamic_lookup -L/usr/local/lib -fstack-protector-strong'


@​INC for perl 5.30.0​:
  /usr/local/Cellar/perl/5.30.0/lib/perl5/site_perl/5.30.0/darwin-thread-multi-2level
  /usr/local/Cellar/perl/5.30.0/lib/perl5/site_perl/5.30.0
  /usr/local/Cellar/perl/5.30.0/lib/perl5/5.30.0/darwin-thread-multi-2level
  /usr/local/Cellar/perl/5.30.0/lib/perl5/5.30.0
  /usr/local/lib/perl5/site_perl/5.30.0


Environment for perl 5.30.0​:
  DYLD_LIBRARY_PATH (unset)
  HOME=/Users/peter
  LANG=en_US.UTF-8
  LANGUAGE (unset)
  LC_TERMINAL=iTerm2
  LC_TERMINAL_VERSION=3.3.6
  LD_LIBRARY_PATH (unset)
  LOGDIR (unset)
  PERL5LIB=/Users/peter/perl5/lib/perl5
  PERLLIB=/usr/local/lib/perl5
  PERL_BADLANG (unset)
  PERL_LOCAL_LIB_ROOT=/Users/peter/perl5
  PERL_MB_OPT=--install_base "/Users/peter/perl5"
  PERL_MM_OPT=INSTALL_BASE=/Users/peter/perl5
  SHELL=/usr/local/bin/zsh

@p5pRT
Copy link
Author

p5pRT commented Oct 12, 2019

From peter@eisentraut.org

0001-Avoid-gratuitous-warning-from-Wundef.patch
From 01b79d136cc7d55f8f5b96d7f474847bae7bf0d8 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Sat, 12 Oct 2019 21:32:13 +0200
Subject: [PATCH] Avoid gratuitous warning from -Wundef

Use #ifdef instead of #if to avoid warning if a user of this header
file uses the gcc -Wundef option.
---
 perl.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/perl.h b/perl.h
index 13ab20a43f..8f6dca3d29 100644
--- a/perl.h
+++ b/perl.h
@@ -1468,7 +1468,7 @@ any magic.
 
 #define UNKNOWN_ERRNO_MSG "(unknown)"
 
-#if VMS
+#ifdef VMS
 #define Strerror(e) strerror((e), vaxc$errno)
 #else
 #define Strerror(e) strerror(e)
-- 
2.23.0

@p5pRT
Copy link
Author

p5pRT commented Oct 13, 2019

From @jkeenan

On Sat, 12 Oct 2019 19​:51​:10 GMT, peter@​eisentraut.org wrote​:

This is a bug report for perl from peter@​eisentraut.org,
generated with the help of perlbug 1.41 running under perl 5.30.0.

-----------------------------------------------------------------
Use #ifdef instead of #if to avoid warning if a user of this header
file uses the gcc -Wundef option.

With each of gcc, g++ and clang, I first configured perl to have the compiler use -Wundef, then built perl and recorded warnings at the end of 'make'.

I then applied the patch to a branch and repeated the process, again having each compiler use -Wundef. Results as expected; see attachment.

Pushed to blead in commit d1747a5.

Thank you very much.

-----------------------------------------------------------------
---
Flags​:
category=library
severity=wishlist
Type=Patch
PatchStatus=HasPatch
---
Site configuration information for perl 5.30.0​:

Configured by brew at Thu May 30 18​:27​:37 BST 2019.

Summary of my perl5 (revision 5 version 30 subversion 0)
configuration​:

Platform​:
osname=darwin
osvers=18.6.0
archname=darwin-thread-multi-2level
uname='darwin mojave-2.local 18.6.0 darwin kernel version 18.6.0​:
thu apr 25 23​:16​:27 pdt 2019; root​:xnu-4903.261.4~2releas>
config_args='-des -Dprefix=/usr/local/Cellar/perl/5.30.0
-Dprivlib=/usr/local/Cellar/perl/5.30.0/lib/perl5/5.30.0 -Dsitelib>
hint=recommended
useposix=true
d_sigaction=define
useithreads=define
usemultiplicity=define
use64bitint=define
use64bitall=define
uselongdouble=undef
usemymalloc=n
default_inc_excludes_dot=define
bincompat5005=undef
Compiler​:
cc='cc'
ccflags ='-fno-common -DPERL_DARWIN -mmacosx-version-min=10.14 -fno-
strict-aliasing -pipe -fstack-protector-strong -I/usr/l>
optimize='-O3'
cppflags='-fno-common -DPERL_DARWIN -mmacosx-version-min=10.14 -fno-
strict-aliasing -pipe -fstack-protector-strong -I/usr/l>
ccversion=''
gccversion='4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.46.4)'
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='cc'
ldflags =' -mmacosx-version-min=10.14 -fstack-protector-strong
-L/usr/local/lib'
libpth=/usr/local/lib
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/u>
libs=-lpthread -ldbm -ldl -lm -lutil -lc
perllibs=-lpthread -ldl -lm -lutil -lc
libc=
so=dylib
useshrplib=true
libperl=libperl.dylib
gnulibc_version=''
Dynamic Linking​:
dlsrc=dl_dlopen.xs
dlext=bundle
d_dlsymun=undef
ccdlflags=' '
cccdlflags=' '
lddlflags=' -mmacosx-version-min=10.14 -bundle -undefined
dynamic_lookup -L/usr/local/lib -fstack-protector-strong'

---
@​INC for perl 5.30.0​:
/usr/local/Cellar/perl/5.30.0/lib/perl5/site_perl/5.30.0/darwin-
thread-multi-2level
/usr/local/Cellar/perl/5.30.0/lib/perl5/site_perl/5.30.0
/usr/local/Cellar/perl/5.30.0/lib/perl5/5.30.0/darwin-thread-
multi-2level
/usr/local/Cellar/perl/5.30.0/lib/perl5/5.30.0
/usr/local/lib/perl5/site_perl/5.30.0

---
Environment for perl 5.30.0​:
DYLD_LIBRARY_PATH (unset)
HOME=/Users/peter
LANG=en_US.UTF-8
LANGUAGE (unset)
LC_TERMINAL=iTerm2
LC_TERMINAL_VERSION=3.3.6
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PERL5LIB=/Users/peter/perl5/lib/perl5
PERLLIB=/usr/local/lib/perl5
PERL_BADLANG (unset)
PERL_LOCAL_LIB_ROOT=/Users/peter/perl5
PERL_MB_OPT=--install_base "/Users/peter/perl5"
PERL_MM_OPT=INSTALL_BASE=/Users/peter/perl5
SHELL=/usr/local/bin/zsh

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

@p5pRT
Copy link
Author

p5pRT commented Oct 13, 2019

From @jkeenan

[p5p] 531 $ report-build-warnings make.blead.gcc.Wundef.output.txt
File​: make.blead.gcc.Wundef.output.txt

  Wimplicit-fallthrough= 35
  Wundef 155
  Wunused-variable 2

[p5p] 532 $ report-build-warnings make.134494-Wundef.gcc.Wundef.output.txt
File​: make.134494-Wundef.gcc.Wundef.output.txt

  Wimplicit-fallthrough= 35
  Wundef 42
  Wunused-variable 2

[perlmonger​: p5p] $ ~/bin/perl/report-build-warnings make.blead.g++.Wundef.output.txt
File​: make.blead.g++.Wundef.output.txt

  Wformat-overflow= 2
  Wimplicit-fallthrough= 32
  Wpragmas 2
  Wundef 156
  Wunused-variable 2

[perlmonger​: p5p] $ ~/bin/perl/report-build-warnings make.134494-Wundef.g++.Wundef.output.txt
File​: make.134494-Wundef.g++.Wundef.output.txt

  Wformat-overflow= 2
  Wimplicit-fallthrough= 32
  Wpragmas 2
  Wundef 42
  Wunused-variable 2

[p5p] 533 $ report-build-warnings make.blead.clang.Wundef.output.txt
File​: make.blead.clang.Wundef.output.txt

  Wtautological-constant-out-of-range-compare 2
  Wundef 155
  Wunused-variable 2

[p5p] 534 $ report-build-warnings make.134494-Wundef.clang.Wundef.output.txt
File​: make.134494-Wundef.clang.Wundef.output.txt

  Wtautological-constant-out-of-range-compare 2
  Wundef 42
  Wunused-variable 2

@p5pRT
Copy link
Author

p5pRT commented Oct 13, 2019

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

@p5pRT
Copy link
Author

p5pRT commented Oct 13, 2019

@jkeenan - Status changed from 'open' to 'pending release'

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