summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2016-06-27 16:55:40 +0200
committerGitHub <noreply@github.com>2016-06-27 16:55:40 +0200
commit1a10d61b3de3020ddf15b02b87dc6905ef5037c6 (patch)
tree137bd24e1149b929f491750dfcf694e47d6d7d13
parent86c3fde2fedfe9270eeaa1a93c0ea15d6fb9962d (diff)
parent9401f1fbc35bdcf4f24be447b1bdf47d157464fa (diff)
Merge pull request #1181 from SaberUK/insp20+null
[2.0] GCC should never assume that this can not be null.
-rwxr-xr-xconfigure5
-rw-r--r--make/template/main.mk5
2 files changed, 9 insertions, 1 deletions
diff --git a/configure b/configure
index fd00ff89c..e8c3deb0d 100755
--- a/configure
+++ b/configure
@@ -965,6 +965,9 @@ EOF
my @dotfiles = qw(main.mk inspircd);
push @dotfiles, 'org.inspircd.plist' if $config{OSNAME} eq 'darwin';
+ # HACK: we need to know if we are on GCC6 to disable the omission of `this` null pointer checks.
+ $config{GCC6} = `$config{CC} --version 2>/dev/null` =~ /gcc/i && $config{GCCVER} ge "6" ? "true" : "false";
+
foreach my $file (@dotfiles) {
open(FILEHANDLE, "make/template/$file") or die "Can't open make/template/$file: $!";
$_ = join '', <FILEHANDLE>;
@@ -974,7 +977,7 @@ EOF
for my $var (qw(
CC SYSTEM BASE_DIR CONFIG_DIR MODULE_DIR BINARY_DIR BUILD_DIR DATA_DIR UID
- STARTSCRIPT DESTINATION SOCKETENGINE LOG_DIR
+ STARTSCRIPT DESTINATION SOCKETENGINE LOG_DIR GCC6
)) {
s/\@$var\@/$config{$var}/g;
}
diff --git a/make/template/main.mk b/make/template/main.mk
index c46d60502..23daa7efc 100644
--- a/make/template/main.mk
+++ b/make/template/main.mk
@@ -89,6 +89,11 @@ INSTMODE_LIB = 0644
D=0
@ENDIF
+GCC6=@GCC6@
+@IFEQ $(GCC6) true
+ CXXFLAGS += -fno-delete-null-pointer-checks
+@ENDIF
+
DBGOK=0
@IFEQ $(D) 0
CXXFLAGS += -O2