[OpenWrt-Devel] uClibc++: Fix two bugs
diff mbox series

Message ID 20191004034709.14177-1-rosenp@gmail.com
State Superseded
Headers show
Series
  • [OpenWrt-Devel] uClibc++: Fix two bugs
Related show

Commit Message

Rosen Penev Oct. 4, 2019, 3:47 a.m. UTC
The first allows usage of several functions in the std namespace, which
broke compilation of gddrescue specifically with uClibc-ng and uClibc++.

The second allows usage of long long with normal C++11, which is part of
the standard. Before, std=gnu++11 needed to be passsed to work around it.

As a result of the second patch, the pedantic patch can safely be removed.

Both patches have been sent upstream.

Added -std=c++11 to CFLAGS to guarentee proper inclusion of long long.

Fixed up license information according to SPDX.

Small cleanups for consistency.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 package/libs/uclibc++/Makefile                |  11 +-
 .../patches/002-undef-functions.patch         |  40 +++++
 .../uclibc++/patches/004-no-pedantic.patch    |  13 --
 ...ibc-Make-long-long-available-to-C-11.patch | 156 ++++++++++++++++++
 4 files changed, 201 insertions(+), 19 deletions(-)
 create mode 100644 package/libs/uclibc++/patches/002-undef-functions.patch
 delete mode 100644 package/libs/uclibc++/patches/004-no-pedantic.patch
 create mode 100644 package/libs/uclibc++/patches/004-uClibc-Make-long-long-available-to-C-11.patch

Comments

Rosen Penev Oct. 5, 2019, 2:47 a.m. UTC | #1
On Thu, Oct 3, 2019 at 8:47 PM Rosen Penev <rosenp@gmail.com> wrote:
>
> The first allows usage of several functions in the std namespace, which
> broke compilation of gddrescue specifically with uClibc-ng and uClibc++.
>
> The second allows usage of long long with normal C++11, which is part of
> the standard. Before, std=gnu++11 needed to be passsed to work around it.
>
> As a result of the second patch, the pedantic patch can safely be removed.
>
> Both patches have been sent upstream.
I will note that both patches have been accepted upstream.

I will also note that I just discovered a totally boneheaded mistake I
made earlier when adding long long support. I will post a new version
with that patch included.
>
> Added -std=c++11 to CFLAGS to guarentee proper inclusion of long long.
>
> Fixed up license information according to SPDX.
>
> Small cleanups for consistency.
>
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
>  package/libs/uclibc++/Makefile                |  11 +-
>  .../patches/002-undef-functions.patch         |  40 +++++
>  .../uclibc++/patches/004-no-pedantic.patch    |  13 --
>  ...ibc-Make-long-long-available-to-C-11.patch | 156 ++++++++++++++++++
>  4 files changed, 201 insertions(+), 19 deletions(-)
>  create mode 100644 package/libs/uclibc++/patches/002-undef-functions.patch
>  delete mode 100644 package/libs/uclibc++/patches/004-no-pedantic.patch
>  create mode 100644 package/libs/uclibc++/patches/004-uClibc-Make-long-long-available-to-C-11.patch
>
> diff --git a/package/libs/uclibc++/Makefile b/package/libs/uclibc++/Makefile
> index 3adf70b360..7a0d9094ff 100644
> --- a/package/libs/uclibc++/Makefile
> +++ b/package/libs/uclibc++/Makefile
> @@ -10,18 +10,17 @@ include $(TOPDIR)/rules.mk
>
>  PKG_NAME:=uclibc++
>  PKG_VERSION:=0.2.5
> -PKG_RELEASE:=2
> +PKG_RELEASE:=3
>
>  PKG_SOURCE:=uClibc++-$(PKG_VERSION).tar.xz
>  PKG_SOURCE_URL:=https://cxx.uclibc.org/src/
>  PKG_HASH:=596fb9ed7295564ce4c70ae6076a18f92e72f70310d70c98520bbca85c77895a
> -
>  PKG_BUILD_DIR:=$(BUILD_DIR)/uClibc++-$(PKG_VERSION)
> -PKG_BUILD_PARALLEL:=1
> -PKG_USE_MIPS16:=0
> -PKG_LICENSE:=LGPL-2.1+
>
> +PKG_LICENSE:=LGPL-2.1-or-later
>  PKG_INSTALL:=1
> +PKG_BUILD_PARALLEL:=1
> +PKG_USE_MIPS16:=0
>
>  include $(INCLUDE_DIR)/package.mk
>
> @@ -45,7 +44,7 @@ UCLIBC_TARGET_ARCH:=$(shell echo $(ARCH) | sed -e s'/-.*//' \
>         -e 's/mipsel.*/mips/' \
>  )
>
> -TARGET_CFLAGS += $(FPIC) -nostdinc++
> +TARGET_CFLAGS += $(FPIC) -nostdinc++ -std=c++11
>  TARGET_LDFLAGS += -Wl,--gc-sections
>
>  ifneq ($(CONFIG_CCACHE),)
> diff --git a/package/libs/uclibc++/patches/002-undef-functions.patch b/package/libs/uclibc++/patches/002-undef-functions.patch
> new file mode 100644
> index 0000000000..008a8232db
> --- /dev/null
> +++ b/package/libs/uclibc++/patches/002-undef-functions.patch
> @@ -0,0 +1,40 @@
> +From 8245f62c1e7aba150f666b3c3a1dda646dee6d4b Mon Sep 17 00:00:00 2001
> +From: Rosen Penev <rosenp@gmail.com>
> +Date: Fri, 27 Sep 2019 13:12:44 -0700
> +Subject: [PATCH] cstdio: Add undef for four functions
> +
> +When compiling with uClibc-ng, these functions get defined as macros and
> +become unavailable for std.
> +
> +Fixes programs that use the std versions of these functions.
> +
> +This matches libstdcpp behavior.
> +
> +Signed-off-by: Rosen Penev <rosenp@gmail.com>
> +---
> + include/cstdio | 9 +++++++++
> + 1 file changed, 9 insertions(+)
> +
> +diff --git a/include/cstdio b/include/cstdio
> +index f959ff5..0a42458 100644
> +--- a/include/cstdio
> ++++ b/include/cstdio
> +@@ -21,6 +21,15 @@
> + #ifndef __HEADER_CSTDIO
> + #define __HEADER_CSTDIO 1
> +
> ++#undef clearerr
> ++#undef feof
> ++#undef ferror
> ++#undef fgetc
> ++#undef fputc
> ++#undef getc
> ++#undef getchar
> ++#undef putc
> ++#undef putchar
> +
> + namespace std{
> +       using ::FILE;
> +--
> +2.17.1
> +
> diff --git a/package/libs/uclibc++/patches/004-no-pedantic.patch b/package/libs/uclibc++/patches/004-no-pedantic.patch
> deleted file mode 100644
> index 5128ca3f83..0000000000
> --- a/package/libs/uclibc++/patches/004-no-pedantic.patch
> +++ /dev/null
> @@ -1,13 +0,0 @@
> ---- a/Rules.mak
> -+++ b/Rules.mak
> -@@ -200,10 +200,6 @@ $(eval $(call check-gxx-var,-std=gnu++14))
> - $(eval $(call check-gxx-var,-Wno-sized-deallocation))
> - $(eval $(call check-gxx-var,-Wno-tautological-compare))
> -
> --# Add a bunch of extra pedantic annoyingly strict checks
> --XWARNINGS=$(call qstrip,$(UCLIBCXX_WARNINGS)) -Wno-trigraphs -pedantic
> --CPU_CFLAGS=$(call qstrip,$(CPU_CFLAGS-y))
> --
> - # Some nice CFLAGS to work with
> - GEN_CFLAGS:=-fno-builtin
> - CFLAGS:=$(XWARNINGS) $(CPU_CFLAGS)
> diff --git a/package/libs/uclibc++/patches/004-uClibc-Make-long-long-available-to-C-11.patch b/package/libs/uclibc++/patches/004-uClibc-Make-long-long-available-to-C-11.patch
> new file mode 100644
> index 0000000000..ba99689e40
> --- /dev/null
> +++ b/package/libs/uclibc++/patches/004-uClibc-Make-long-long-available-to-C-11.patch
> @@ -0,0 +1,156 @@
> +From 8151579eb36d9366632242415ff3f5177fa5e1e2 Mon Sep 17 00:00:00 2001
> +From: Rosen Penev <rosenp@gmail.com>
> +Date: Thu, 3 Oct 2019 18:58:43 -0700
> +Subject: [PATCH] uClibc++: Make long long available to C++11
> +
> +C++11 makes long long available. It is no longer a GNU extension.
> +
> +Signed-off-by: Rosen Penev <rosenp@gmail.com>
> +---
> + include/istream         | 4 ++--
> + include/istream_helpers | 2 +-
> + include/ostream         | 8 ++++----
> + include/ostream_helpers | 8 ++++----
> + tests/sstreamtest.cpp   | 4 ++--
> + 5 files changed, 13 insertions(+), 13 deletions(-)
> +
> +diff --git a/include/istream b/include/istream
> +index 72a8834..2d58abd 100644
> +--- a/include/istream
> ++++ b/include/istream
> +@@ -72,7 +72,7 @@ namespace std{
> +               basic_istream<charT,traits>& operator>>(void*& p);
> +               basic_istream<charT,traits>& operator>>(basic_streambuf<char_type,traits>* sb);
> +
> +-#ifndef __STRICT_ANSI__
> ++#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
> +               basic_istream<charT,traits>& operator>>(long long& n);
> +               basic_istream<charT,traits>& operator>>(unsigned long long& n);
> + #endif
> +@@ -455,7 +455,7 @@ namespace std{
> +               return *this;
> +       }
> +
> +-#ifndef __STRICT_ANSI__
> ++#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
> +       template <class charT, class traits> _UCXXEXPORT basic_istream<charT,traits>&
> +               basic_istream<charT,traits>::operator>>(long long& n)
> +       {
> +diff --git a/include/istream_helpers b/include/istream_helpers
> +index d87e0c7..f2c793f 100644
> +--- a/include/istream_helpers
> ++++ b/include/istream_helpers
> +@@ -301,7 +301,7 @@ namespace std{
> +       };
> +
> +
> +-#ifndef __STRICT_ANSI__
> ++#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
> +       template <class traits> class _UCXXEXPORT __istream_readin<traits, char, long long>{
> +       public:
> +               inline static void readin(basic_istream<char, traits >& stream, long long & var)
> +diff --git a/include/ostream b/include/ostream
> +index 289514c..3072589 100644
> +--- a/include/ostream
> ++++ b/include/ostream
> +@@ -85,7 +85,7 @@ namespace std {
> +               basic_ostream<charT,traits>& operator<<(long double f);
> +               basic_ostream<charT,traits>& operator<<(void* p);
> +               basic_ostream<charT,traits>& operator<<(basic_streambuf<char_type,traits>* sb);
> +-#ifndef __STRICT_ANSI__
> ++#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
> +               basic_ostream<charT,traits>& operator<<(long long n);
> +               basic_ostream<charT,traits>& operator<<(unsigned long long n);
> + #endif
> +@@ -221,7 +221,7 @@ namespace std {
> +               return *this;
> +       }
> +
> +-#ifndef __STRICT_ANSI__
> ++#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
> +       template <class charT, class traits> _UCXXEXPORT basic_ostream<charT,traits>& basic_ostream<charT, traits>::operator<<(long long n)
> +       {
> +               sentry s(*this);
> +@@ -487,7 +487,7 @@ namespace std {
> + #endif
> +
> +
> +-#ifndef __STRICT_ANSI__
> ++#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
> +
> + //Support for output of long long data types
> +
> +@@ -509,7 +509,7 @@ template<class Ch, class Tr> _UCXXEXPORT basic_ostream<Ch, Tr>&
> + }
> +
> +
> +-#endif        //__STRICT_ANSI__
> ++#endif // !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
> +
> +
> +
> +diff --git a/include/ostream_helpers b/include/ostream_helpers
> +index fa50407..f4d33f9 100644
> +--- a/include/ostream_helpers
> ++++ b/include/ostream_helpers
> +@@ -142,7 +142,7 @@ namespace std{
> +               }
> +       };
> +
> +-#ifndef __STRICT_ANSI__
> ++#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
> +
> +       template <class traits> class _UCXXEXPORT __ostream_printout<traits, char, signed long long int>{
> +       public:
> +@@ -237,7 +237,7 @@ namespace std{
> +       };
> +
> +
> +-#endif        //__STRICT_ANSI__
> ++#endif // !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
> +
> +       template <class traits> class _UCXXEXPORT __ostream_printout<traits, char, double>{
> +       public:
> +@@ -357,7 +357,7 @@ namespace std{
> +               }
> +       };
> +
> +-#ifndef __STRICT_ANSI__
> ++#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
> +
> +       template <class traits> class _UCXXEXPORT __ostream_printout<traits, wchar_t, signed long long int>{
> +       public:
> +@@ -428,7 +428,7 @@ namespace std{
> +       };
> +
> +
> +-#endif        //__STRICT_ANSI__
> ++#endif // !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
> +
> +       template <class traits> class _UCXXEXPORT __ostream_printout<traits, wchar_t, double>{
> +       public:
> +diff --git a/tests/sstreamtest.cpp b/tests/sstreamtest.cpp
> +index 36b3470..ea946a9 100644
> +--- a/tests/sstreamtest.cpp
> ++++ b/tests/sstreamtest.cpp
> +@@ -9,7 +9,7 @@ int main(){
> +       int i;
> +       std::string s;
> +       char c;
> +-#ifndef __STRICT_ANSI__
> ++#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
> +       long long ll;
> +       unsigned long long ull;
> + #endif
> +@@ -32,7 +32,7 @@ int main(){
> +
> +
> +
> +-#ifndef __STRICT_ANSI__
> ++#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
> +       a.str("678 76 54");
> +       a >> ll >> ull >> s;
> +       std::cout << "ll (should be 678): " << ll << std::endl;
> +--
> +2.17.1
> +
> --
> 2.17.1
>

Patch
diff mbox series

diff --git a/package/libs/uclibc++/Makefile b/package/libs/uclibc++/Makefile
index 3adf70b360..7a0d9094ff 100644
--- a/package/libs/uclibc++/Makefile
+++ b/package/libs/uclibc++/Makefile
@@ -10,18 +10,17 @@  include $(TOPDIR)/rules.mk
 
 PKG_NAME:=uclibc++
 PKG_VERSION:=0.2.5
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE:=uClibc++-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=https://cxx.uclibc.org/src/
 PKG_HASH:=596fb9ed7295564ce4c70ae6076a18f92e72f70310d70c98520bbca85c77895a
-
 PKG_BUILD_DIR:=$(BUILD_DIR)/uClibc++-$(PKG_VERSION)
-PKG_BUILD_PARALLEL:=1
-PKG_USE_MIPS16:=0
-PKG_LICENSE:=LGPL-2.1+
 
+PKG_LICENSE:=LGPL-2.1-or-later
 PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=1
+PKG_USE_MIPS16:=0
 
 include $(INCLUDE_DIR)/package.mk
 
@@ -45,7 +44,7 @@  UCLIBC_TARGET_ARCH:=$(shell echo $(ARCH) | sed -e s'/-.*//' \
 	-e 's/mipsel.*/mips/' \
 )
 
-TARGET_CFLAGS += $(FPIC) -nostdinc++
+TARGET_CFLAGS += $(FPIC) -nostdinc++ -std=c++11
 TARGET_LDFLAGS += -Wl,--gc-sections
 
 ifneq ($(CONFIG_CCACHE),)
diff --git a/package/libs/uclibc++/patches/002-undef-functions.patch b/package/libs/uclibc++/patches/002-undef-functions.patch
new file mode 100644
index 0000000000..008a8232db
--- /dev/null
+++ b/package/libs/uclibc++/patches/002-undef-functions.patch
@@ -0,0 +1,40 @@ 
+From 8245f62c1e7aba150f666b3c3a1dda646dee6d4b Mon Sep 17 00:00:00 2001
+From: Rosen Penev <rosenp@gmail.com>
+Date: Fri, 27 Sep 2019 13:12:44 -0700
+Subject: [PATCH] cstdio: Add undef for four functions
+
+When compiling with uClibc-ng, these functions get defined as macros and
+become unavailable for std.
+
+Fixes programs that use the std versions of these functions.
+
+This matches libstdcpp behavior.
+
+Signed-off-by: Rosen Penev <rosenp@gmail.com>
+---
+ include/cstdio | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/include/cstdio b/include/cstdio
+index f959ff5..0a42458 100644
+--- a/include/cstdio
++++ b/include/cstdio
+@@ -21,6 +21,15 @@
+ #ifndef __HEADER_CSTDIO
+ #define __HEADER_CSTDIO 1
+ 
++#undef clearerr
++#undef feof
++#undef ferror
++#undef fgetc
++#undef fputc
++#undef getc
++#undef getchar
++#undef putc
++#undef putchar
+ 
+ namespace std{
+ 	using ::FILE;
+-- 
+2.17.1
+
diff --git a/package/libs/uclibc++/patches/004-no-pedantic.patch b/package/libs/uclibc++/patches/004-no-pedantic.patch
deleted file mode 100644
index 5128ca3f83..0000000000
--- a/package/libs/uclibc++/patches/004-no-pedantic.patch
+++ /dev/null
@@ -1,13 +0,0 @@ 
---- a/Rules.mak
-+++ b/Rules.mak
-@@ -200,10 +200,6 @@ $(eval $(call check-gxx-var,-std=gnu++14))
- $(eval $(call check-gxx-var,-Wno-sized-deallocation))
- $(eval $(call check-gxx-var,-Wno-tautological-compare))
- 
--# Add a bunch of extra pedantic annoyingly strict checks
--XWARNINGS=$(call qstrip,$(UCLIBCXX_WARNINGS)) -Wno-trigraphs -pedantic
--CPU_CFLAGS=$(call qstrip,$(CPU_CFLAGS-y))
--
- # Some nice CFLAGS to work with
- GEN_CFLAGS:=-fno-builtin
- CFLAGS:=$(XWARNINGS) $(CPU_CFLAGS)
diff --git a/package/libs/uclibc++/patches/004-uClibc-Make-long-long-available-to-C-11.patch b/package/libs/uclibc++/patches/004-uClibc-Make-long-long-available-to-C-11.patch
new file mode 100644
index 0000000000..ba99689e40
--- /dev/null
+++ b/package/libs/uclibc++/patches/004-uClibc-Make-long-long-available-to-C-11.patch
@@ -0,0 +1,156 @@ 
+From 8151579eb36d9366632242415ff3f5177fa5e1e2 Mon Sep 17 00:00:00 2001
+From: Rosen Penev <rosenp@gmail.com>
+Date: Thu, 3 Oct 2019 18:58:43 -0700
+Subject: [PATCH] uClibc++: Make long long available to C++11
+
+C++11 makes long long available. It is no longer a GNU extension.
+
+Signed-off-by: Rosen Penev <rosenp@gmail.com>
+---
+ include/istream         | 4 ++--
+ include/istream_helpers | 2 +-
+ include/ostream         | 8 ++++----
+ include/ostream_helpers | 8 ++++----
+ tests/sstreamtest.cpp   | 4 ++--
+ 5 files changed, 13 insertions(+), 13 deletions(-)
+
+diff --git a/include/istream b/include/istream
+index 72a8834..2d58abd 100644
+--- a/include/istream
++++ b/include/istream
+@@ -72,7 +72,7 @@ namespace std{
+ 		basic_istream<charT,traits>& operator>>(void*& p);
+ 		basic_istream<charT,traits>& operator>>(basic_streambuf<char_type,traits>* sb);
+ 
+-#ifndef __STRICT_ANSI__
++#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
+ 		basic_istream<charT,traits>& operator>>(long long& n);
+ 		basic_istream<charT,traits>& operator>>(unsigned long long& n);
+ #endif
+@@ -455,7 +455,7 @@ namespace std{
+ 		return *this;
+ 	}
+ 
+-#ifndef __STRICT_ANSI__
++#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
+ 	template <class charT, class traits> _UCXXEXPORT basic_istream<charT,traits>&
+ 		basic_istream<charT,traits>::operator>>(long long& n)
+ 	{
+diff --git a/include/istream_helpers b/include/istream_helpers
+index d87e0c7..f2c793f 100644
+--- a/include/istream_helpers
++++ b/include/istream_helpers
+@@ -301,7 +301,7 @@ namespace std{
+ 	};
+ 
+ 
+-#ifndef __STRICT_ANSI__
++#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
+ 	template <class traits> class _UCXXEXPORT __istream_readin<traits, char, long long>{
+ 	public:
+ 		inline static void readin(basic_istream<char, traits >& stream, long long & var)
+diff --git a/include/ostream b/include/ostream
+index 289514c..3072589 100644
+--- a/include/ostream
++++ b/include/ostream
+@@ -85,7 +85,7 @@ namespace std {
+ 		basic_ostream<charT,traits>& operator<<(long double f);
+ 		basic_ostream<charT,traits>& operator<<(void* p);
+ 		basic_ostream<charT,traits>& operator<<(basic_streambuf<char_type,traits>* sb);
+-#ifndef __STRICT_ANSI__
++#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
+ 		basic_ostream<charT,traits>& operator<<(long long n);
+ 		basic_ostream<charT,traits>& operator<<(unsigned long long n);
+ #endif
+@@ -221,7 +221,7 @@ namespace std {
+ 		return *this;
+ 	}
+ 
+-#ifndef __STRICT_ANSI__
++#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
+ 	template <class charT, class traits> _UCXXEXPORT basic_ostream<charT,traits>& basic_ostream<charT, traits>::operator<<(long long n)
+ 	{
+ 		sentry s(*this);
+@@ -487,7 +487,7 @@ namespace std {
+ #endif
+ 
+ 
+-#ifndef __STRICT_ANSI__
++#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
+ 
+ //Support for output of long long data types
+ 
+@@ -509,7 +509,7 @@ template<class Ch, class Tr> _UCXXEXPORT basic_ostream<Ch, Tr>&
+ }
+ 
+ 
+-#endif	//__STRICT_ANSI__
++#endif // !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
+ 
+ 
+ 
+diff --git a/include/ostream_helpers b/include/ostream_helpers
+index fa50407..f4d33f9 100644
+--- a/include/ostream_helpers
++++ b/include/ostream_helpers
+@@ -142,7 +142,7 @@ namespace std{
+ 		}
+ 	};
+ 
+-#ifndef __STRICT_ANSI__
++#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
+ 
+ 	template <class traits> class _UCXXEXPORT __ostream_printout<traits, char, signed long long int>{
+ 	public:
+@@ -237,7 +237,7 @@ namespace std{
+ 	};
+ 
+ 
+-#endif	//__STRICT_ANSI__
++#endif // !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
+ 
+ 	template <class traits> class _UCXXEXPORT __ostream_printout<traits, char, double>{
+ 	public:
+@@ -357,7 +357,7 @@ namespace std{
+ 		}
+ 	};
+ 
+-#ifndef __STRICT_ANSI__
++#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
+ 
+ 	template <class traits> class _UCXXEXPORT __ostream_printout<traits, wchar_t, signed long long int>{
+ 	public:
+@@ -428,7 +428,7 @@ namespace std{
+ 	};
+ 
+ 
+-#endif	//__STRICT_ANSI__
++#endif // !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
+ 
+ 	template <class traits> class _UCXXEXPORT __ostream_printout<traits, wchar_t, double>{
+ 	public:
+diff --git a/tests/sstreamtest.cpp b/tests/sstreamtest.cpp
+index 36b3470..ea946a9 100644
+--- a/tests/sstreamtest.cpp
++++ b/tests/sstreamtest.cpp
+@@ -9,7 +9,7 @@ int main(){
+ 	int i;
+ 	std::string s;
+ 	char c;
+-#ifndef __STRICT_ANSI__
++#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
+ 	long long ll;
+ 	unsigned long long ull;
+ #endif
+@@ -32,7 +32,7 @@ int main(){
+ 
+ 
+ 
+-#ifndef __STRICT_ANSI__
++#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
+ 	a.str("678 76 54");
+ 	a >> ll >> ull >> s;
+ 	std::cout << "ll (should be 678): " << ll << std::endl;
+-- 
+2.17.1
+