summaryrefslogtreecommitdiff
path: root/solenv
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2012-03-13 16:09:25 +0100
committerLuboš Luňák <l.lunak@suse.cz>2012-03-13 16:21:04 +0100
commit3d9f5c856a4a77503695e68ce013ebf859fcb212 (patch)
treeaaa75452b54542a52f746da9782ae6c3d2663453 /solenv
parent131e5d35a4edb9f8875a197e8e0382c168834f70 (diff)
make OString work even with old gcc that has SFINAE broken
Since OString already has a ctor accepting const char*, I cannot find out a way to distinguish string literals other than using a template, otherwise const char* somehow takes precedence (all of gcc, clang, msvc). But the template requires the Substitution Is Not A Failure Idiom to actually create only wanted instances. And the compiler can try evaluate the OString ctor as a possibility when comparing an int to an anonymous enum, and anonymous enum as a type without linkage cannot be a template argument before C++11. SFINAE should still work, but not with gcc older than 4.0.2 (which we right now use only on macs). So for that case disable the string literal ctors, which means macs will have one extra strlen call, and also that embedded \0's in string literals will be inconsistent. The tiny performance problem shouldn't matter that much and will eventually go away, the \0 problem should not matter, since before string literal ctors were introduced \0's had not been included anyway unless RTL_CONSTASCII_STRINGPARAM was used. So we should be safe and when removing the CONSTASCII macros \0 cases should be handled by explicitly mentioning the length.
Diffstat (limited to 'solenv')
-rw-r--r--solenv/gbuild/platform/macosx.mk5
-rw-r--r--solenv/gbuild/platform/unxgcc.mk6
-rw-r--r--solenv/inc/unxgcc.mk4
-rw-r--r--solenv/inc/unxmacx.mk3
-rw-r--r--solenv/inc/unxsogi.mk4
-rw-r--r--solenv/inc/unxsogs.mk4
6 files changed, 26 insertions, 0 deletions
diff --git a/solenv/gbuild/platform/macosx.mk b/solenv/gbuild/platform/macosx.mk
index 9a918246f738..22a1fa8e94d9 100644
--- a/solenv/gbuild/platform/macosx.mk
+++ b/solenv/gbuild/platform/macosx.mk
@@ -51,6 +51,11 @@ gb_COMPILERDEFS += \
-DHAVE_GCC_VISIBILITY_FEATURE \
+ifeq ($(HAVE_SFINAE_ANONYMOUS_BROKEN),TRUE)
+gb_COMPILERDEFS += \
+ -DHAVE_SFINAE_ANONYMOUS_BROKEN \
+
+endif
gb_CFLAGS := \
-isysroot $(gb_SDKDIR) \
diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk
index c709fde1e4e8..43f58a7cf0b4 100644
--- a/solenv/gbuild/platform/unxgcc.mk
+++ b/solenv/gbuild/platform/unxgcc.mk
@@ -84,6 +84,12 @@ endif
endif
+ifeq ($(HAVE_SFINAE_ANONYMOUS_BROKEN),TRUE)
+gb_COMPILERDEFS += \
+ -DHAVE_SFINAE_ANONYMOUS_BROKEN \
+
+endif
+
# enable debug STL
ifeq ($(gb_PRODUCT),$(false))
gb_COMPILERDEFS += \
diff --git a/solenv/inc/unxgcc.mk b/solenv/inc/unxgcc.mk
index 3765b2dd6cea..8bfeebc20cf6 100644
--- a/solenv/inc/unxgcc.mk
+++ b/solenv/inc/unxgcc.mk
@@ -51,6 +51,10 @@ CDEFS+=-D_PTHREADS -D_REENTRANT -DNEW_SOLAR -D_USE_NAMESPACE=1
CDEFS += -DHAVE_GCC_VISIBILITY_FEATURE
.ENDIF # "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE"
+.IF "$(HAVE_SFINAE_ANONYMOUS_BROKEN)" == "TRUE"
+CDEFS += -DHAVE_SFINAE_ANONYMOUS_BROKEN
+.ENDIF # "$(HAVE_SFINAE_ANONYMOUS_BROKEN)" == "TRUE"
+
# this is a platform with JAVA support
.IF "$(SOLAR_JAVA)"!=""
JAVADEF=-DSOLAR_JAVA
diff --git a/solenv/inc/unxmacx.mk b/solenv/inc/unxmacx.mk
index 0cb0b62ee02f..8f36772f4d06 100644
--- a/solenv/inc/unxmacx.mk
+++ b/solenv/inc/unxmacx.mk
@@ -60,6 +60,9 @@ EXTRA_CDEFS+:=-isysroot $(MACOSX_SDK_PATH) -DMAC_OS_X_VERSION_MIN_REQUIRED=$(MA
CDEFS += -DHAVE_GCC_VISIBILITY_FEATURE
.ENDIF # "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE"
+.IF "$(HAVE_SFINAE_ANONYMOUS_BROKEN)" == "TRUE"
+CDEFS += -DHAVE_SFINAE_ANONYMOUS_BROKEN
+.ENDIF # "$(HAVE_SFINAE_ANONYMOUS_BROKEN)" == "TRUE"
# MacOS X specific Java compilation/link flags
SOLAR_JAVA*=TRUE
diff --git a/solenv/inc/unxsogi.mk b/solenv/inc/unxsogi.mk
index 2ebcbc468e42..4e811655bfd3 100644
--- a/solenv/inc/unxsogi.mk
+++ b/solenv/inc/unxsogi.mk
@@ -94,6 +94,10 @@ LINKVERSIONMAPFLAG=-Wl,--version-script
CDEFS += -DHAVE_GCC_VISIBILITY_FEATURE
.ENDIF # "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE"
+.IF "$(HAVE_SFINAE_ANONYMOUS_BROKEN)" == "TRUE"
+CDEFS += -DHAVE_SFINAE_ANONYMOUS_BROKEN
+.ENDIF # "$(HAVE_SFINAE_ANONYMOUS_BROKEN)" == "TRUE"
+
# Reihenfolge der libs NICHT egal!
STDLIBCPP=-lstdc++
diff --git a/solenv/inc/unxsogs.mk b/solenv/inc/unxsogs.mk
index 4f80b42c0a4a..e25d690ce49f 100644
--- a/solenv/inc/unxsogs.mk
+++ b/solenv/inc/unxsogs.mk
@@ -93,6 +93,10 @@ LINKVERSIONMAPFLAG=-Wl,--version-script
CDEFS += -DHAVE_GCC_VISIBILITY_FEATURE
.ENDIF # "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE"
+.IF "$(HAVE_SFINAE_ANONYMOUS_BROKEN)" == "TRUE"
+CDEFS += -DHAVE_SFINAE_ANONYMOUS_BROKEN
+.ENDIF # "$(HAVE_SFINAE_ANONYMOUS_BROKEN)" == "TRUE"
+
# Reihenfolge der libs NICHT egal!
STDLIBCPP=-lstdc++