summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2014-05-05 10:22:25 +1000
committerTony Cook <tony@develop-help.com>2014-05-12 09:33:51 +1000
commitc8180b0692cef05079a2e250b3faccaca4592b10 (patch)
treecc6ab9b97e03a19ca2c818b682b36196683d1d78 /win32
parentf78f6d13e94ec2059acb931e3ca33869aa58f1e7 (diff)
downloadperl-c8180b0692cef05079a2e250b3faccaca4592b10.tar.gz
[perl #121505] include -fwrapv by default for GCC 4.3 and later
Diffstat (limited to 'win32')
-rw-r--r--win32/makefile.mk19
1 files changed, 17 insertions, 2 deletions
diff --git a/win32/makefile.mk b/win32/makefile.mk
index f2675cc9d7..90aefe510c 100644
--- a/win32/makefile.mk
+++ b/win32/makefile.mk
@@ -141,6 +141,12 @@ USE_LARGE_FILES *= define
CCTYPE *= GCC
#
+# If you are using GCC, 4.3 or later by default we add the -fwrapv option.
+# See https://rt.perl.org/Ticket/Display.html?id=121505
+#
+#GCCWRAPV *= define
+
+#
# If you are using Intel C++ Compiler uncomment this
#
#__ICC *= define
@@ -408,6 +414,8 @@ INST_HTML = $(INST_TOP)$(INST_VER)\html
.USESHELL :
+MINIBUILDOPT *=
+
.IF "$(CCTYPE)" == "GCC"
.IF "$(GCCCROSS)" == "define"
@@ -420,6 +428,13 @@ LIB32 = $(ARCHPREFIX)ar rc
IMPLIB = $(ARCHPREFIX)dlltool
RSC = $(ARCHPREFIX)windres
+GCCWRAPV *= $(shell for /f "delims=. tokens=1,2,3" %i in ('$(CC) -dumpversion') do @if "%i"=="4" (if "%j" geq "3" echo define) else if "%i" geq "5" (echo define))
+
+.IF "$(GCCWRAPV)" == "define"
+BUILDOPT += -fwrapv
+MINIBUILDOPT += -fwrapv
+.ENDIF
+
i = .i
o = .o
a = .a
@@ -1139,10 +1154,10 @@ $(MINIDIR) :
if not exist "$(MINIDIR)" mkdir "$(MINIDIR)"
$(MINICORE_OBJ) : $(CORE_NOCFG_H)
- $(CC) -c $(CFLAGS) -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL $(OBJOUT_FLAG)$@ ..\$(*B).c
+ $(CC) -c $(CFLAGS) $(MINIBUILDOPT) -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL $(OBJOUT_FLAG)$@ ..\$(*B).c
$(MINIWIN32_OBJ) : $(CORE_NOCFG_H)
- $(CC) -c $(CFLAGS) -DPERL_IS_MINIPERL $(OBJOUT_FLAG)$@ $(*B).c
+ $(CC) -c $(CFLAGS) $(MINIBUILDOPT) -DPERL_IS_MINIPERL $(OBJOUT_FLAG)$@ $(*B).c
# -DPERL_IMPLICIT_SYS needs C++ for perllib.c
# rules wrapped in .IFs break Win9X build (we end up with unbalanced []s unless