From c19880725d71e38d79fc9991957b2788d5d844db Mon Sep 17 00:00:00 2001 From: Christopher Meng Date: Tue, 5 Aug 2014 16:33:41 +0800 Subject: [PATCH 1/4] Revert back. --- ustl.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ustl.spec b/ustl.spec index 5d17be0..2ca9c1d 100644 --- a/ustl.spec +++ b/ustl.spec @@ -50,7 +50,7 @@ sed -i -e 's|/usr/lib|%{_libdir}|g' \ %build ./configure --with-libstdc++ --force-inline --prefix=%{buildroot}%{_prefix} -%make_build CXXFLAGS+="%{optflags}" +make %{?_smp_mflags} CXXFLAGS+="%{optflags}" %install %make_install LIBDIR="%{buildroot}%{_libdir}" From 6484c5e1190cd5b002a0dc4eea80b44c5aac13a2 Mon Sep 17 00:00:00 2001 From: Denis Fateyev Date: Mon, 29 Feb 2016 23:03:52 +0600 Subject: [PATCH 2/4] ustl: 2.3 epel release --- .gitignore | 1 + sources | 2 +- ustl-2.3-cumulative.patch | 940 ++++++++++++++++++++++++++++++++++++++ ustl.spec | 50 +- 4 files changed, 980 insertions(+), 13 deletions(-) create mode 100644 ustl-2.3-cumulative.patch diff --git a/.gitignore b/.gitignore index 490ec85..cc3d89b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /ustl-2.1.tar.gz +/ustl-2.3.tar.gz diff --git a/sources b/sources index 9076f97..e5d6975 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -12189009af2ce5c31d72782441eca291 ustl-2.1.tar.gz +47ef6c27b7411b955d2098061b20aefa ustl-2.3.tar.gz diff --git a/ustl-2.3-cumulative.patch b/ustl-2.3-cumulative.patch new file mode 100644 index 0000000..112292c --- /dev/null +++ b/ustl-2.3-cumulative.patch @@ -0,0 +1,940 @@ +* e582337 Fix potentially uninitialized value read from an invalid stream. Fixes #51. +* 7c8e011 Add constexpr to definition of string::npos +* a560904 Move forced inline define after inclusion of libstdc++ headers due to inline namespaces there. Fixes #48. +* 4ed1ca7 Merge pull request #47 from ivas/heap_patch +* c346071 Fix incorrect make_heap implementation. Correct tests. Improve pop_heap performance. +* 8599ee9 Merge pull request #46 from ivas/patch-1 +* 20d8ab2 Update uheap.h +* b602eb8 Do not remove lvalue make_pair for c++11 +* 7b90651 Support dash shell for configure +* e8155cb Update size benchmark results for the current release. +* e323d78 Fix compiling --with-libstdc++ + +diff --git a/bvt/bvt24.cc b/bvt/bvt24.cc +index 1ba6cee..6362d59 100644 +--- a/bvt/bvt24.cc ++++ b/bvt/bvt24.cc +@@ -46,8 +46,8 @@ static void PrintHeap (const vector& v) + void TestHeapOperations (void) + { + static const int c_Values [31] = { // 31 values make a full 4-layer tree +- 93, 92, 90, 86, 83, 86, 77, 40, 72, 36, 68, 82, 62, 67, 63, 15, +- 26, 26, 49, 21, 11, 62, 67, 27, 29, 30, 35, 23, 59, 35, 29 ++ 93, 12, 90, 86, 83, 86, 17, 40, 72, 36, 68, 42, 62, 67, 63, 65, ++ 26, 26, 49, 21, 11, 62, 67, 27, 11, 30, 35, 23, 59, 35, 99 + }; + vector v; + v.reserve (VectorSize(c_Values)); +diff --git a/bvt/bvt24.std b/bvt/bvt24.std +index ff09fcf..737babe 100644 +--- a/bvt/bvt24.std ++++ b/bvt/bvt24.std +@@ -2,179 +2,179 @@ + 93 + ------------------------------------------------ + 93 +- 92 ++ 12 + ------------------------------------------------ + 93 +- 92 90 ++ 12 90 + ------------------------------------------------ + 93 +- 92 90 +- 86 ++ 86 90 ++ 12 + ------------------------------------------------ + 93 +- 92 90 +- 86 83 ++ 86 90 ++ 12 83 + ------------------------------------------------ + 93 +- 92 90 +- 86 83 86 ++ 86 90 ++ 12 83 86 + ------------------------------------------------ + 93 +- 92 90 +- 86 83 86 77 ++ 86 90 ++ 12 83 86 17 + ------------------------------------------------ + 93 +- 92 90 +- 86 83 86 77 +- 40 ++ 86 90 ++ 40 83 86 17 ++ 12 + ------------------------------------------------ + 93 +- 92 90 +- 86 83 86 77 +- 40 72 ++ 86 90 ++ 72 83 86 17 ++ 12 40 + ------------------------------------------------ + 93 +- 92 90 +- 86 83 86 77 +- 40 72 36 ++ 86 90 ++ 72 83 86 17 ++ 12 40 36 + ------------------------------------------------ + 93 +- 92 90 +- 86 83 86 77 +- 40 72 36 68 ++ 86 90 ++ 72 83 86 17 ++ 12 40 36 68 + ------------------------------------------------ + 93 +- 92 90 +- 86 83 86 77 +- 40 72 36 68 82 ++ 86 90 ++ 72 83 86 17 ++ 12 40 36 68 42 + ------------------------------------------------ + 93 +- 92 90 +- 86 83 86 77 +- 40 72 36 68 82 62 ++ 86 90 ++ 72 83 86 17 ++ 12 40 36 68 42 62 + ------------------------------------------------ + 93 +- 92 90 +- 86 83 86 77 +- 40 72 36 68 82 62 67 ++ 86 90 ++ 72 83 86 67 ++ 12 40 36 68 42 62 17 + ------------------------------------------------ + 93 +- 92 90 +- 86 83 86 77 +- 40 72 36 68 82 62 67 63 ++ 86 90 ++ 72 83 86 67 ++ 12 40 36 68 42 62 17 63 + ------------------------------------------------ + 93 +- 92 90 +- 86 83 86 77 +- 40 72 36 68 82 62 67 63 +- 15 ++ 86 90 ++ 72 83 86 67 ++ 65 40 36 68 42 62 17 63 ++ 12 + ------------------------------------------------ + 93 +- 92 90 +- 86 83 86 77 +- 40 72 36 68 82 62 67 63 +- 15 26 ++ 86 90 ++ 72 83 86 67 ++ 65 40 36 68 42 62 17 63 ++ 12 26 + ------------------------------------------------ + 93 +- 92 90 +- 86 83 86 77 +- 40 72 36 68 82 62 67 63 +- 15 26 26 ++ 86 90 ++ 72 83 86 67 ++ 65 40 36 68 42 62 17 63 ++ 12 26 26 + ------------------------------------------------ + 93 +- 92 90 +- 86 83 86 77 +- 40 72 36 68 82 62 67 63 +- 15 26 26 49 ++ 86 90 ++ 72 83 86 67 ++ 65 49 36 68 42 62 17 63 ++ 12 26 26 40 + ------------------------------------------------ + 93 +- 92 90 +- 86 83 86 77 +- 40 72 36 68 82 62 67 63 +- 15 26 26 49 21 ++ 86 90 ++ 72 83 86 67 ++ 65 49 36 68 42 62 17 63 ++ 12 26 26 40 21 + ------------------------------------------------ + 93 +- 92 90 +- 86 83 86 77 +- 40 72 36 68 82 62 67 63 +- 15 26 26 49 21 11 ++ 86 90 ++ 72 83 86 67 ++ 65 49 36 68 42 62 17 63 ++ 12 26 26 40 21 11 + ------------------------------------------------ + 93 +- 92 90 +- 86 83 86 77 +- 40 72 36 68 82 62 67 63 +- 15 26 26 49 21 11 62 ++ 86 90 ++ 72 83 86 67 ++ 65 49 36 68 42 62 17 63 ++ 12 26 26 40 21 11 62 + ------------------------------------------------ + 93 +- 92 90 +- 86 83 86 77 +- 40 72 36 68 82 62 67 63 +- 15 26 26 49 21 11 62 67 ++ 86 90 ++ 72 83 86 67 ++ 65 49 36 68 42 62 17 63 ++ 12 26 26 40 21 11 62 67 + ------------------------------------------------ + 93 +- 92 90 +- 86 83 86 77 +- 40 72 36 68 82 62 67 63 +- 15 26 26 49 21 11 62 67 27 ++ 86 90 ++ 72 83 86 67 ++ 65 49 36 68 42 62 17 63 ++ 12 26 26 40 21 11 62 67 27 + ------------------------------------------------ + 93 +- 92 90 +- 86 83 86 77 +- 40 72 36 68 82 62 67 63 +- 15 26 26 49 21 11 62 67 27 29 ++ 86 90 ++ 72 83 86 67 ++ 65 49 36 68 42 62 17 63 ++ 12 26 26 40 21 11 62 67 27 11 + ------------------------------------------------ + 93 +- 92 90 +- 86 83 86 77 +- 40 72 36 68 82 62 67 63 +- 15 26 26 49 21 11 62 67 27 29 30 ++ 86 90 ++ 72 83 86 67 ++ 65 49 36 68 42 62 17 63 ++ 12 26 26 40 21 11 62 67 27 11 30 + ------------------------------------------------ + 93 +- 92 90 +- 86 83 86 77 +- 40 72 36 68 82 62 67 63 +- 15 26 26 49 21 11 62 67 27 29 30 35 ++ 86 90 ++ 72 83 86 67 ++ 65 49 36 68 42 62 17 63 ++ 12 26 26 40 21 11 62 67 27 11 30 35 + ------------------------------------------------ + 93 +- 92 90 +- 86 83 86 77 +- 40 72 36 68 82 62 67 63 +- 15 26 26 49 21 11 62 67 27 29 30 35 23 ++ 86 90 ++ 72 83 86 67 ++ 65 49 36 68 42 62 23 63 ++ 12 26 26 40 21 11 62 67 27 11 30 35 17 + ------------------------------------------------ + 93 +- 92 90 +- 86 83 86 77 +- 40 72 36 68 82 62 67 63 +- 15 26 26 49 21 11 62 67 27 29 30 35 23 59 ++ 86 90 ++ 72 83 86 67 ++ 65 49 36 68 42 62 59 63 ++ 12 26 26 40 21 11 62 67 27 11 30 35 17 23 + ------------------------------------------------ + 93 +- 92 90 +- 86 83 86 77 +- 40 72 36 68 82 62 67 63 +- 15 26 26 49 21 11 62 67 27 29 30 35 23 59 35 ++ 86 90 ++ 72 83 86 67 ++ 65 49 36 68 42 62 59 63 ++ 12 26 26 40 21 11 62 67 27 11 30 35 17 23 35 + ------------------------------------------------ +- 93 +- 92 90 +- 86 83 86 77 +- 40 72 36 68 82 62 67 63 +- 15 26 26 49 21 11 62 67 27 29 30 35 23 59 35 29 ++ 99 ++ 86 93 ++ 72 83 86 90 ++ 65 49 36 68 42 62 59 67 ++ 12 26 26 40 21 11 62 67 27 11 30 35 17 23 35 63 + ------------------------------------------------ + make_heap on the full range: +- 93 +- 92 90 +- 86 83 86 77 +- 40 72 36 68 82 62 67 63 +- 15 26 26 49 21 11 62 67 27 29 30 35 23 59 35 29 ++ 99 ++ 86 93 ++ 72 83 86 90 ++ 65 49 36 68 42 62 67 63 ++ 40 26 26 12 21 11 62 67 27 11 30 35 23 59 35 17 + ------------------------------------------------ + pop_heap: +- 92 ++ 93 + 86 90 +- 72 83 86 77 +- 40 49 36 68 82 62 67 63 +- 15 26 26 29 21 11 62 67 27 29 30 35 23 59 35 ++ 72 83 86 67 ++ 65 49 36 68 42 62 59 63 ++ 40 26 26 12 21 11 62 67 27 11 30 35 23 17 35 + ------------------------------------------------ + sort_heap: +- 11 15 21 23 26 26 27 29 29 30 35 35 36 40 49 59 62 62 63 67 67 68 72 77 82 83 86 86 90 92 93 ++ 11 11 12 17 21 23 26 26 27 30 35 35 36 40 42 49 59 62 62 63 65 67 67 68 72 83 86 86 90 93 99 + ------------------------------------------------ + priority_queue push and pop: +- 93 92 90 86 86 83 82 77 72 68 67 67 63 62 62 59 49 40 36 35 35 30 29 29 27 26 26 23 21 15 11 ++ 99 93 90 86 86 83 72 68 67 67 65 63 62 62 59 49 42 40 36 35 35 30 27 26 26 23 21 17 12 11 11 +diff --git a/config.h.in b/config.h.in +index 30a1b5e..1189ddc 100644 +--- a/config.h.in ++++ b/config.h.in +@@ -95,9 +95,6 @@ + /// gcc has lately decided that inline is just a suggestion + /// Define to 1 if when you say 'inline' you mean it! + #undef WANT_ALWAYS_INLINE +-#if WANT_ALWAYS_INLINE +- #define inline INLINE inline +-#endif + + /// Define to 1 if you have the header file. + #undef HAVE_ASSERT_H +diff --git a/configure b/configure +index 29daf75..b03b742 100755 +--- a/configure ++++ b/configure +@@ -1,4 +1,4 @@ +-#! /bin/bash ++#! /bin/sh + # + # This file is free software, distributed under the MIT License. + ###################################################################### +@@ -88,6 +88,8 @@ s/@PKG_MINOR@/$PKG_MINOR/g" + ###################################################################### + + die() { rm -f config.sed config.cpu config.cpu.c; exit; } ++sub() { printf "%s\n" "$1">>config.sed; } ++escpath() { echo $1 | sed 's/\//\\\//g'; } + + #### Compile the configurator and generate initial config.sed ######## + +@@ -261,50 +263,47 @@ case "$SYSNAME" in + esac + + if [ "$SYSNAME" = "sun" ]; then +- echo "s/-Wredundant-decls/-Wno-redundant-decls/g +- s/@SHBLDFL@/-G/g" >>config.sed ++ sub "s/-Wredundant-decls/-Wno-redundant-decls/;s/@SHBLDFL@/-G/" + else +- echo 's/#undef \(HAVE_THREE_CHAR_TYPES\)/#define \1 1/g' >>config.sed ++ sub "s/#undef \(HAVE_THREE_CHAR_TYPES\)/#define \1 1/" + fi + if [ "$SYSNAME" = "bsd" ]; then +- echo 's/ @libgcc_eh@//g +- s/#define WITHOUT_LIBSTDCPP 1/#undef WITHOUT_LIBSTDCPP/g +- s/NOLIBSTDCPP = -nodefaultlibs /#NOLIBSTDCPP = -nodefaultlibs/g +- s/-Wredundant-decls/-Wno-redundant-decls/g +- s/-Winline/-Wno-inline/g +- s/#define HAVE_VA_COPY 1/#undef HAVE_VA_COPY/g' >>config.sed ++ sub 's/ @libgcc_eh@//g ++ s/#define WITHOUT_LIBSTDCPP 1/#undef WITHOUT_LIBSTDCPP/ ++ s/NOLIBSTDCPP = -nodefaultlibs /#NOLIBSTDCPP = -nodefaultlibs/ ++ s/-Wredundant-decls/-Wno-redundant-decls/ ++ s/-Winline/-Wno-inline/ ++ s/#define HAVE_VA_COPY 1/#undef HAVE_VA_COPY/' + fi + if [ "$SYSNAME" = "linux" -o "$SYSNAME" = "bsd" ]; then +- echo 's/@SHBLDFL@/-shared -Wl,-soname=$1/g' >>config.sed ++ sub 's/@SHBLDFL@/-shared -Wl,-soname=$1/' + elif [ "$SYSNAME" = "alpha" ]; then +- echo "s/BUILD_SHARED = 1 /#BUILD_SHARED = 1/g +- s/#BUILD_STATIC = 1/BUILD_STATIC = 1 /g" >>config.sed ++ sub "s/BUILD_SHARED = 1 /#BUILD_SHARED = 1/;s/#BUILD_STATIC = 1/BUILD_STATIC = 1 /" + fi + if [ "$SYSNAME" = "mac" ]; then +- echo 's/ @libgcc_eh@//g ++ sub 's/ @libgcc_eh@//g + s/lib$1.so/lib$1.dylib/g + s/lib$1.so.${MAJOR}.${MINOR}.${BUILD}/lib$1.${MAJOR}.${MINOR}.${BUILD}.dylib/g + s/lib$1.so.${MAJOR}.${MINOR}/lib$1.${MAJOR}.${MINOR}.dylib/g + s/lib$1.so.${MAJOR}/lib$1.${MAJOR}.dylib/g + s/ -s -Wl,-gc-sections/ -mmacosx-version-min=10.9/g +- s/@SHBLDFL@/-Wl,-single_module -compatibility_version 1 -current_version 1 -install_name $1 -Wl,-Y,1455 -dynamiclib -mmacosx-version-min=10.9/g' >>config.sed ++ s/@SHBLDFL@/-Wl,-single_module -compatibility_version 1 -current_version 1 -install_name $1 -Wl,-Y,1455 -dynamiclib -mmacosx-version-min=10.9/g' + if [ "$CC" = "clang" ]; then +- echo 's/ @libsupc++@/ @libc++abi@/g' >>config.sed ++ sub "s/ @libsupc++@/ @libc++abi@/g" + fi + fi + if [ "$SYSNAME" = "alpha" -o "$SYSNAME" = "mac" ]; then +- echo 's/#undef \(SIZE_OF_BOOL\)/#define \1 SIZE_OF_LONG/g' >>config.sed ++ sub "s/#undef \(SIZE_OF_BOOL\)/#define \1 SIZE_OF_LONG/" + else +- echo 's/#undef \(SIZE_OF_BOOL\)/#define \1 SIZE_OF_CHAR/g' >>config.sed ++ sub "s/#undef \(SIZE_OF_BOOL\)/#define \1 SIZE_OF_CHAR/" + fi + if [ "$SYSNAME" = "linux" ]; then +- echo 's/#undef \(HAVE_RINTF\)/#define \1 1/g' >>config.sed ++ sub "s/#undef \(HAVE_RINTF\)/#define \1 1/" + else +- echo 's/-p --ignore-fail-on-non-empty//g +- s/ -mfpmath=sse//g' >>config.sed ++ sub "s/-p --ignore-fail-on-non-empty//;s/ -mfpmath=sse//" + fi + if [ "$SYSNAME" = "mac" -o "$SYSNAME" = "bsd" ]; then +- echo 's/#define \(HAVE_STRSIGNAL\) 1/#undef \1/g' >>config.sed ++ sub "s/#define \(HAVE_STRSIGNAL\) 1/#undef \1/g" + fi + + #### Printing helper functions ####################################### +@@ -350,9 +349,9 @@ PrintVersion() { + + SubVar() { + local esc2 +- esc2=`echo $2 | sed 's/\//\\\&/g'` ++ esc2=`escpath $2` + eval ac_var_$1='$esc2'; +- echo "s/@$1@/$esc2/g" >>config.sed ++ sub "s/@$1@/$esc2/g" + } + + SubComp() { +@@ -361,7 +360,7 @@ SubComp() { + while [ ! -z "$cc" ]; do + name=`expr "$cc" : '[^}]*name=\[\([^]]*\)\]'` + seds=`expr "$cc" : '[^}]*seds=\[\([^]]*\)\]'` +- [ "$name" = "$1" ] && echo $seds >>config.sed ++ [ "$name" = "$1" ] && sub "$seds" + cc=`expr "$cc" : '[^}]*}\(.*\)'` + done + } +@@ -379,7 +378,7 @@ done + + #### Set directory prefixes ########################################## + +-echo "s/@prefix@/${ac_var_prefix:=\/usr\/local}/g ++sub "s/@prefix@/${ac_var_prefix:=\/usr\/local}/g + s/@bindir@/$ac_var_prefix\/bin/g + s/@datadir@/${ac_var_datadir:=$ac_var_prefix\/share}/g + s/@sysconfdir@/$ac_var_prefix\/etc/g +@@ -391,15 +390,15 @@ s/@libdir@/${ac_var_libdir:=$ac_var_prefix\/lib}/g + s/@localedir@/$ac_var_datarootdir\/locale/g + s/@mandir@/$ac_var_datarootdir\/man/g + s/@builddir@/\/tmp\/$USER\/make/g +-s/@gccincludedir@/${ac_var_gccincludedir:=`echo $PINCDIR | sed 's/\//\\\&/g'`}/g +-s/@gcclibdir@/${ac_var_gcclibdir:=`echo $PLIBDIR | sed 's/\//\\\&/g'`}/g ++s/@gccincludedir@/${ac_var_gccincludedir:=`escpath $PINCDIR`}/g ++s/@gcclibdir@/${ac_var_gcclibdir:=`escpath $PLIBDIR`}/g + s/@customincdir@/${ac_var_customincdir:=$ac_var_prefix\/include}/g +-s/@customlibdir@/${ac_var_customlibdir:=$ac_var_prefix\/lib}/g" >>config.sed ++s/@customlibdir@/${ac_var_customlibdir:=$ac_var_prefix\/lib}/g" + + if [ "$ac_var_prefix" != "\/usr\/local" -a "$ac_var_prefix" != "\/usr" ]; then +- echo "s/ @CUSTOMINCDIR@/ -I$ac_var_customincdir/g;s/ @CUSTOMLIBDIR@/ -L$ac_var_customlibdir/g" >>config.sed ++ sub "s/ @CUSTOMINCDIR@/ -I$ac_var_customincdir/g;s/ @CUSTOMLIBDIR@/ -L$ac_var_customlibdir/g" + else +- echo "s/ @CUSTOMINCDIR@//g;s/ @CUSTOMLIBDIR@//g" >>config.sed ++ sub "s/ @CUSTOMINCDIR@//g;s/ @CUSTOMLIBDIR@//g" + fi + + #### Find headers, libs, programs, and subs ########################## +@@ -411,7 +410,7 @@ INCPATH=`echo $INCPATH | sed 's/\\\\//g'` + for i in $HEADERS; do + for p in $INCPATH; do + if [ -r "$p/$i" ]; then +- echo 's/#undef \(HAVE_'`echo $i|tr a-z/.- A-Z___`'\)/#define \1 1/' >>config.sed ++ sub "s/#undef \(HAVE_`echo $i|tr a-z/.- A-Z___`\)/#define \1 1/" + break + fi + done +@@ -431,31 +430,34 @@ for i in $LIBS; do + done + [ -z "$found" ] || break + done +- echo "s/ @lib$i@/$found/g" >>config.sed ++ sub "s/ @lib$i@/$found/g" + done + + for i in $PROGS; do + pname=`expr "$i" : '\([^=]*\)=[^=]*'` + pcall=`expr "$i" : '[^=]*=\([^=]*\)'` +- esciv="`eval echo \$\{$pname\}|sed 's/\//\\\\\//g'`" ++ ppath=`eval echo \$\{$pname\}` ++ ppath=`escpath "$ppath"` + # First check if an environment variable is set +- [ ! -z "$esciv" ] && echo "s/@$pname@/$esciv/g" >>config.sed ++ [ ! -z "$ppath" ] && sub "s/@$pname@/$ppath/g" + # Check if the program exists +- [ -x `which $pcall 2>/dev/null` ] && echo "s/@$pname@/$pcall/g" >>config.sed ++ [ -x `which $pcall 2>/dev/null` ] && sub "s/@$pname@/$pcall/g" + done + # If nothing found in first loop, set the first pair anyway. + for i in $PROGS; do + pname=`expr "$i" : '\([^=]*\)=[^=]*'` + pcall=`expr "$i" : '[^=]*=\([^=]*\)'` +- echo "s/@$pname@/$pcall/g" >>config.sed ++ sub "s/@$pname@/$pcall/g" + done + # And, finally, the environment variables + for i in $ENVIRONS; do + esciv="`eval echo '"'\$\{$i\}'"'|sed 's/\//\\\&/g'`" +- [ ! -z "$esciv" ] && esciv=" $esciv" +- echo "s/ @$i@/$esciv/g" >>config.sed ++ ppath=`eval echo \$\{$pname\}` ++ ppath=`escpath "$ppath"` ++ [ ! -z "$ppath" ] && ppath=" $ppath" ++ sub "s/ @$i@/$ppath/g" + done +-echo "$CUSTSUBS" >>config.sed ++sub "$CUSTSUBS" + } + SubHeadLibsProgs + +diff --git a/docs/index.html b/docs/index.html +index 32e309e..7a9f8ff 100644 +--- a/docs/index.html ++++ b/docs/index.html +@@ -240,7 +240,7 @@ returns the string length in bytes, length in characters. + You can iterate by characters instead of bytes with a special utf8 + iterator: +

+-for (auto i = s.utf8_begin(); i < s.utf8_end(); ++ i)
++for (auto i = s.utf8_begin(); i < s.utf8_end(); ++i)
+     DrawChar (*i);
+ 

+ or just copy all the chars into an array and iterate over that: +@@ -591,59 +591,58 @@ int main (void) + } +

+ Feel free to compile it and see for yourself. I'm compiling on a Core i7 +-with gcc 4.7.2 and -Os -DNDEBUG=1 -march=native. The libstdc++ ++with gcc 5.3 and -Os -DNDEBUG=1 -march=native. The libstdc++ + version is linked implicitly with it, and uSTL version is linked with gcc + (instead of g++) and -lustl. Both executables are stripped. + The libstdc++ version looks like this: +

+ % ls -l std/tes
+-6896 tes
++6912 tes
+ % size std/tes
+ text	data	bss	dec	hex	filename
+-3522	656	8	4186	105a	std/tes
++3464	656	8	4128	1020	std/tes
+ % size -A std/tes.o
+ std/tes.o:
+-section                                                                                                      size
+-.group                                                                                                          8
+-.group                                                                                                          8
+-.group                                                                                                          8
+-.group                                                                                                          8
+-.group                                                                                                          8
+-.text                                                                                                          11
+-.data                                                                                                           0
+-.bss                                                                                                            0
+-.text._ZNKSt6vectorIiSaIiEE12_M_check_lenEmPKc                                                                 61
+-.text._ZNSt11__copy_moveILb0ELb1ESt26random_access_iterator_tagE8__copy_mIiEEPT_PKS3_S6_S4_                    45
+-.text._ZNSt20__copy_move_backwardILb0ELb1ESt26random_access_iterator_tagE13__copy_move_bIiEEPT_PKS3_S6_S4_     58
+-.rodata.str1.1                                                                                                 45
+-.text._ZNSt6vectorIiSaIiEE14_M_fill_insertEN9__gnu_cxx17__normal_iteratorIPiS1_EEmRKi                         386
+-.text._ZNSt6vectorIiSaIiEE13_M_insert_auxEN9__gnu_cxx17__normal_iteratorIPiS1_EERKi                           232
+-.text.startup                                                                                                 294
+-.gcc_except_table                                                                                              20
+-.comment                                                                                                       18
+-.note.GNU-stack                                                                                                 0
+-.eh_frame                                                                                                     368
+-Total                                                                                                        1578
++section														size
++.group														  12
++.group														  12
++.group														  12
++.group														  12
++.group														  12
++.text														   0
++.data														   0
++.bss														   0
++.text._ZNKSt6vectorIiSaIiEE12_M_check_lenEmPKc									  72
++.text._ZNSt20__copy_move_backwardILb0ELb1ESt26random_access_iterator_tagE13__copy_move_bIiEEPT_PKS3_S6_S4_	  51
++.text._ZNSt11__copy_moveILb0ELb1ESt26random_access_iterator_tagE8__copy_mIiEEPT_PKS3_S6_S4_			  42
++.rodata.str1.1													  45
++.text._ZNSt6vectorIiSaIiEE13_M_insert_auxEN9__gnu_cxx17__normal_iteratorIPiS1_EERKi				 226
++.text._ZNSt6vectorIiSaIiEE14_M_fill_insertEN9__gnu_cxx17__normal_iteratorIPiS1_EEmRKi				 386
++.text.startup													 301
++.gcc_except_table												  20
++.comment													  18
++.note.GNU-stack													   0
++.eh_frame													 344
++Total														1565
+ 

+ The uSTL version looks like this: +

+ % ls -l ustl/tes
+-5704 tes
++5848 tes
+ % size ustl/tes
+ text	data	bss	dec	hex	filename
+-2383	640	8	3031	bd7	ustl/tes
++2505	640	8	3153	c51	ustl/tes
+ % size -A ustl/tes.o
+-ustl/tes.o:
+-section             size
+-.text                  0
+-.data                  0
+-.bss                   0
+-.text.startup        277
+-.gcc_except_table     19
+-.comment              18
+-.note.GNU-stack        0
+-.eh_frame             72
+-Total                386
++.text			  0
++.data			  0
++.bss			  0
++.text.unlikely		  0
++.text.startup		273
++.gcc_except_table	 15
++.comment		 18
++.note.GNU-stack		  0
++.eh_frame		 72
++Total			378
+ 

+ As you can see, the libstdc++ version instantiates quite a bit of code + for just this one vector type, with out-of-line functions for copy, move, +@@ -658,31 +657,31 @@ executable just for container overhead. + But wait, there is more! Let's look at the total memory footprint: +

+ % footprint std/tes
+-   text	   data	    bss	    dec	    hex	filename
+-   3522	    656	      8	   4186	   105a	tes
+-  83357	    968	    664	  84989	  14bfd	libgcc_s.so.1
+-1031819	   1100	     72	1032991	  fc31f	libm.so.6
+- 935489	  36200	  85088	1056777	 102009	libstdc++.so.6
+-1715642	  20560	  17800	1754002	 1ac392	libc.so.6
+-3769829	  59484	 103632	3932945	 3c0311	(TOTALS)
++   text    data     bss     dec     hex filename
++   3464     656       8    4128    1020 tes
++  86254     976     672   87902   1575e libgcc_s.so.1
++1033970     892      12 1034874   fca7a libm.so.6
++1514876   46936   14240 1576052  180c74 libstdc++.so.6
++1678707   20344   17240 1716291  1a3043 libc.so.6
++4317271   69804   32172 4419247  436eaf (TOTALS)
+ 
+ % footprint ustl/tes
+    text	   data	    bss	    dec	    hex	filename
+-   2383	    640	      8	   3031	    bd7	tes
+-  83357	    968	    664	  84989	  14bfd	libgcc_s.so.1
+- 151398	  10848	  73240	 235486	  397de	libustl.so.2
+-1715642	  20560	  17800	1754002	 1ac392	libc.so.6
+-1952780	  33016	  91712	2077508	 1fb344	(TOTALS)
++   2505     640       8    3153     c51 tes
++  86254     976     672   87902   1575e libgcc_s.so.1
++ 141262    7840     536  149638   24886 libustl.so.2
++1678707   20344   17240 1716291  1a3043 libc.so.6
++1908728   29800   18456 1956984  1ddc78 (TOTALS)
+ 

+-As you can see, the footprint for the uSTL version is 47% smaller, +-saving 1855437 bytes. If you don't count libc, measuring only the +-C++-specific overhead, libstdc++ loads 2178943 while libustl only 323506, +-seven times less! Finally, most of uSTL's size comes from gcc's +-support libraries; if you compile uSTL configured --with-libstdc++ +-option, then you'll see that it only takes up 72322 bytes, of which only +-23350 are used by .text, meaning that only about a third of the library +-size is my fault. gcc developers will have to reduce the size of libsupc++ +-before any further size reduction would be practical. ++As you can see, the footprint for the uSTL version is less than half ++the size, saving 2.5 megabytes. If you don't count libc, measuring only ++the C++-specific overhead, std/tes loads 2.7 megabytes of libraries, ++while ustl/tes loads only 237k, eleven times less! ++

++Finally, if you build a static libustl.a, it is only 33k. Linking with ++libsupc++.a adds 75k, of which 45k is ABI name demangling, only used for ++printing backtraces. Linking statically can thus lower the C++ overhead ++to less than 64k, a forty-fold reduction from libstdc++.so. +

+ One final note concerns the current gcc versions, 4.4 and later. gcc + developers have decided, for various reasons, to treat the inline keyword +@@ -697,8 +696,10 @@ seems inappropriate. Therefore I've pretty much given up on it. The only + solution I can come up with is to just clobber the optimizer over the head + with #define inline __attribute__((always_inline)) inline. It + is enabled if you configure with --force-inline. The above +-examples are compiled with this option. Interestingly, libstdc++ +-developers have taken the same approach, defining _GLIBCXX_ALWAYS_INLINE. ++examples are compiled with this option. Amusingly, libstdc++ developers ++have taken the same approach, defining _GLIBCXX_ALWAYS_INLINE. If even ++gcc developers do not trust gcc to make the correct inlining decisions, ++why the policy? Oh well... +

+

Bug reporting

+

+diff --git a/sistream.cc b/sistream.cc +index 71a61cc..5d908af 100644 +--- a/sistream.cc ++++ b/sistream.cc +@@ -171,7 +171,7 @@ istringstream& istringstream::read (void* buffer, size_type sz) + istringstream& istringstream::get (char* p, size_type n, char delim) + { + _gcount = 0; +- for (char c, *pend = p+n-1; p < pend && (remaining() || underflow()); ++p, ++_gcount) { ++ for (char c = 0, *pend = p+n-1; p < pend && (remaining() || underflow()); ++p, ++_gcount) { + istream::iread (c); + if (c == delim) { + ungetc(); +diff --git a/typeinfo.h b/typeinfo.h +index a7367e9..6865b07 100644 +--- a/typeinfo.h ++++ b/typeinfo.h +@@ -7,9 +7,7 @@ + // type information for exception classes. + + #pragma once +-#ifndef WITHOUT_LIBSTDCPP +- #include +-#else ++#if WITHOUT_LIBSTDCPP + #include "uexception.h" + + namespace __cxxabiv1 { class __class_type_info; } +@@ -33,7 +31,6 @@ private: + protected: + const char* __name; + }; +- + } // namespace std + +-#endif ++#endif // WITHOUT_LIBSTDCPP +diff --git a/uatomic.h b/uatomic.h +index 40cfb5d..fd5e090 100644 +--- a/uatomic.h ++++ b/uatomic.h +@@ -4,7 +4,7 @@ + // This file is free software, distributed under the MIT License. + + #pragma once +-#include "config.h" ++#include "utypes.h" + #if HAVE_CPP11 + + //{{{ memory_order ----------------------------------------------------- +diff --git a/uexception.h b/uexception.h +index 53c2085..5d9b593 100644 +--- a/uexception.h ++++ b/uexception.h +@@ -5,10 +5,6 @@ + + #pragma once + #include "utypes.h" +-#ifndef WITHOUT_LIBSTDCPP +- #include +- #include +-#endif + #include "bktrace.h" + + #if WITHOUT_LIBSTDCPP +@@ -123,5 +119,7 @@ protected: + + #if WITHOUT_LIBSTDCPP + } // namespace std +-namespace ustl { typedef std::bad_alloc bad_alloc; } ++namespace ustl { ++ typedef std::bad_alloc bad_alloc; + #endif ++} // namespace ustl +diff --git a/uheap.h b/uheap.h +index d09ada0..dc5423d 100644 +--- a/uheap.h ++++ b/uheap.h +@@ -24,6 +24,27 @@ bool is_heap (RandomAccessIterator first, RandomAccessIterator last, Compare com + return true; + } + ++/// Utility function to "trickle down" the root item - swaps the root item with its ++/// largest child and "recursively" fixes the proper subtree. ++template ++void _trickle_down_heap (RandomAccessIterator first, Distance iHole, Distance heapSize, Compare comp) ++{ ++ typedef typename iterator_traits::value_type value_type; ++ const value_type v(first[iHole]); ++ Distance iChild; ++ while ((iChild = 2 * iHole + 1) < heapSize) { ++ if (iChild + 1 < heapSize) ++ iChild += comp(first[iChild], first[iChild + 1]); ++ if (comp(v, first[iChild])) { ++ first[iHole] = first[iChild]; ++ iHole = iChild; ++ } ++ else ++ break; ++ } ++ first[iHole] = v; ++} ++ + /// \brief make_heap turns the range [first, last) into a heap + /// At completion, is_heap (first, last, comp) is true. + /// The algorithm is adapted from "Classic Data Structures in C++" by Timothy Budd. +@@ -33,19 +54,15 @@ bool is_heap (RandomAccessIterator first, RandomAccessIterator last, Compare com + template + void make_heap (RandomAccessIterator first, RandomAccessIterator last, Compare comp) + { +- typedef typename iterator_traits::value_type value_type; +- const value_type v (*first); +- uoff_t iChild, iHole = 0, iEnd (distance (first, last)); +- while ((iChild = 2 * iHole + 1) < iEnd) { +- if (iChild + 1 < iEnd) // Pick the greater child +- iChild += comp (first[iChild], first[iChild + 1]); +- if (comp (first[iChild], v)) +- break; // Done when parent is greater than both children. +- first[iHole] = first[iChild]; +- iHole = iChild; ++ if (last <= first) ++ return; ++ typedef typename iterator_traits::difference_type distance_type; ++ distance_type heapSize(last - first); ++ RandomAccessIterator i = first + (last - first - 1)/2; ++ while (i >= first) { ++ _trickle_down_heap(first, distance_type(i - first), heapSize, comp); ++ --i; + } +- if (iHole < iEnd) +- first[iHole] = v; + } + + /// \brief Inserts the *--last into the preceeding range assumed to be a heap. +@@ -77,8 +94,9 @@ void pop_heap (RandomAccessIterator first, RandomAccessIterator last, Compare co + { + if (--last <= first) + return; +- iter_swap (first, last); +- make_heap (first, last, comp); ++ typedef typename iterator_traits::difference_type distance_type; ++ iter_swap(first, last); ++ _trickle_down_heap(first, distance_type(0), distance_type(last - first), comp); + } + + /// Sorts heap [first, last) in descending order according to comp. +@@ -128,7 +146,7 @@ public: + inline size_type size (void) const { return _v.size(); } + inline bool empty (void) const { return _v.empty(); } + inline reference top (void) const { return _v.at(0); } +- inline void push (reference v) { _v.push_back (v); make_heap (_v.begin(), _v.end(), _c); } ++ inline void push (reference v) { _v.push_back (v); push_heap (_v.begin(), _v.end(), _c); } + inline void pop (void) { pop_heap (_v.begin(), _v.end()); _v.pop_back(); } + private: + base_ctr _v; ///< Element container. +diff --git a/unew.h b/unew.h +index 73ef89c..9e1ee5a 100644 +--- a/unew.h ++++ b/unew.h +@@ -42,6 +42,4 @@ inline void* operator new[] (size_t, void* p) noexcept { return p; } + inline void operator delete (void*, void*) noexcept { } + inline void operator delete[](void*, void*) noexcept { } + +-#else +-#include + #endif // WITHOUT_LIBSTDCPP +diff --git a/upair.h b/upair.h +index e6cdc24..ef67aca 100644 +--- a/upair.h ++++ b/upair.h +@@ -54,13 +54,11 @@ template + inline pair make_pair (T1&& a, T2&& b) + { return pair (forward(a), forward(b)); } + +-#else ++#endif + + /// Returns a pair object with (a,b) + template + inline pair make_pair (const T1& a, const T2& b) + { return pair (a, b); } + +-#endif +- + } // namespace ustl +diff --git a/ustring.cc b/ustring.cc +index a087684..a528373 100644 +--- a/ustring.cc ++++ b/ustring.cc +@@ -13,7 +13,7 @@ namespace ustl { + + //---------------------------------------------------------------------- + +-const string::pos_type string::npos; ++/*static*/ constexpr const string::pos_type string::npos; + + //---------------------------------------------------------------------- + +diff --git a/utypes.h b/utypes.h +index c5cf043..f9a69b0 100644 +--- a/utypes.h ++++ b/utypes.h +@@ -4,6 +4,8 @@ + // This file is free software, distributed under the MIT License. + + #pragma once ++#define __STDC_LIMIT_MACROS // For WCHAR_MIN and WCHAR_MAX in stdint. ++#define __STDC_CONSTANT_MACROS // For UINT??_C macros to avoid using L and UL suffixes on constants. + #include "config.h" + #ifndef STDC_HEADERS + #error "This library requires standard C and C++ headers to compile." +@@ -11,8 +13,6 @@ + #ifndef STDUNIX_HEADERS + #error "This library requires standard UNIX headers to compile." + #endif +-#define __STDC_LIMIT_MACROS // For WCHAR_MIN and WCHAR_MAX in stdint. +-#define __STDC_CONSTANT_MACROS // For UINT??_C macros to avoid using L and UL suffixes on constants. + #if HAVE_STDINT_H + #include + #elif HAVE_INTTYPES_H +@@ -27,6 +27,11 @@ + #include + #include + #include ++#ifndef WITHOUT_LIBSTDCPP ++ #include ++ #include ++ #include ++#endif + #ifndef SIZE_MAX + #define SIZE_MAX UINT_MAX + #endif +@@ -62,3 +67,6 @@ typedef uoff_t streamoff; ///< Offset into a stream + #if !defined(UINTPTR_MAX) || !defined(UINT32_C) + #error "If you include stdint.h before ustl.h, define __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS first" + #endif ++#if WANT_ALWAYS_INLINE ++ #define inline INLINE inline ++#endif diff --git a/ustl.spec b/ustl.spec index aa7f3e4..2a9aa43 100644 --- a/ustl.spec +++ b/ustl.spec @@ -1,11 +1,18 @@ Name: ustl -Version: 2.1 -Release: 3%{?dist} +Version: 2.3 +Release: 1%{?dist} Summary: A size-optimized STL implementation License: MIT URL: http://msharov.github.io/ustl/ Source0: https://github.com/msharov/ustl/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz +# HEAD, fixes libstdc++ compat, warnings, etc. (see commit messages inside) +Patch0: ustl-%{version}-cumulative.patch + +BuildRequires: gcc-c++ +BuildRequires: make +BuildRequires: sed + %description The C++ standard template library (STL) is a collection of common containers and algorithms in template form. Unfortunately its standard incarnation @@ -39,17 +46,21 @@ developing applications that use %{name}. %prep %setup -q +%patch0 -p1 + # No silent build. sed -i -e 's|\t@|\t|g' Makefile # Don't strip the symbols, substituted with correct ldflags. -sed -i -e 's|-s |%{?__global_ldflags} |g' Config.mk.in -sed -i -e 's|/usr/lib|%{_libdir}|g' \ - -e 's|CXXFLAGS :=|override CXXFLAGS +=|g' \ - Config.mk.in +sed -i -e 's|/usr/lib|%{_libdir}|g' \ + -i -e 's|-s |-Wl,-z,relro |g' \ + -e 's|CXXFLAGS :=|override CXXFLAGS +=|g' \ + Config.mk.in -# Do not interfere with optflags -sed -i -e 's|-march=native||g' configure +# Do not interfere with optflags, hardened build flags. +sed -i -e 's|-march=native||g' \ + -i -e 's|-shared |-shared -Wl,-z,now |g' \ + configure %build ./configure \ @@ -59,10 +70,11 @@ sed -i -e 's|-march=native||g' configure %endif --with-libstdc++ --force-inline -make %{?_smp_mflags} CXXFLAGS+="%{optflags}" +make %{?_smp_mflags} \ + CXXFLAGS+="%{optflags} -fPIC" %install -%make_install LIBDIR="%{buildroot}%{_libdir}" +make install LIBDIR="%{buildroot}%{_libdir}" chmod 755 -v %{buildroot}%{_libdir}/* @@ -74,16 +86,30 @@ make check %postun -p /sbin/ldconfig %files -%doc LICENSE +%{!?_licensedir:%global license %doc} +%license LICENSE +%doc README %{_libdir}/libustl.so.* %files devel -%doc README docs/ +%doc docs/* %{_includedir}/ustl.h %{_includedir}/ustl/ %{_libdir}/libustl.so %changelog +* Mon Feb 29 2016 Denis Fateyev - 2.3-1 +- Update EPEL branches to 2.3 version + +* Fri Feb 05 2016 Fedora Release Engineering - 2.1-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Fri Jun 19 2015 Fedora Release Engineering - 2.1-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Mon Aug 18 2014 Fedora Release Engineering - 2.1-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + * Fri Aug 08 2014 Yaakov Selkowitz - 2.1-3 - Remove -march=native - Disable SSE on ix86 (not supported by default optflags) From 9f64ddf92313ef079afc163171b8a230cb887334 Mon Sep 17 00:00:00 2001 From: Denis Fateyev Date: Sun, 22 May 2016 02:48:19 +0600 Subject: [PATCH 3/4] ustl: 2.4 release --- .gitignore | 1 + sources | 2 +- ustl-2.3-cumulative.patch | 940 -------------------------------------- ustl.spec | 10 +- 4 files changed, 7 insertions(+), 946 deletions(-) delete mode 100644 ustl-2.3-cumulative.patch diff --git a/.gitignore b/.gitignore index cc3d89b..8b620b6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /ustl-2.1.tar.gz /ustl-2.3.tar.gz +/ustl-2.4.tar.gz diff --git a/sources b/sources index e5d6975..1583f85 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -47ef6c27b7411b955d2098061b20aefa ustl-2.3.tar.gz +240c30cdd63d3b1af24cbe692a3963de ustl-2.4.tar.gz diff --git a/ustl-2.3-cumulative.patch b/ustl-2.3-cumulative.patch deleted file mode 100644 index 112292c..0000000 --- a/ustl-2.3-cumulative.patch +++ /dev/null @@ -1,940 +0,0 @@ -* e582337 Fix potentially uninitialized value read from an invalid stream. Fixes #51. -* 7c8e011 Add constexpr to definition of string::npos -* a560904 Move forced inline define after inclusion of libstdc++ headers due to inline namespaces there. Fixes #48. -* 4ed1ca7 Merge pull request #47 from ivas/heap_patch -* c346071 Fix incorrect make_heap implementation. Correct tests. Improve pop_heap performance. -* 8599ee9 Merge pull request #46 from ivas/patch-1 -* 20d8ab2 Update uheap.h -* b602eb8 Do not remove lvalue make_pair for c++11 -* 7b90651 Support dash shell for configure -* e8155cb Update size benchmark results for the current release. -* e323d78 Fix compiling --with-libstdc++ - -diff --git a/bvt/bvt24.cc b/bvt/bvt24.cc -index 1ba6cee..6362d59 100644 ---- a/bvt/bvt24.cc -+++ b/bvt/bvt24.cc -@@ -46,8 +46,8 @@ static void PrintHeap (const vector& v) - void TestHeapOperations (void) - { - static const int c_Values [31] = { // 31 values make a full 4-layer tree -- 93, 92, 90, 86, 83, 86, 77, 40, 72, 36, 68, 82, 62, 67, 63, 15, -- 26, 26, 49, 21, 11, 62, 67, 27, 29, 30, 35, 23, 59, 35, 29 -+ 93, 12, 90, 86, 83, 86, 17, 40, 72, 36, 68, 42, 62, 67, 63, 65, -+ 26, 26, 49, 21, 11, 62, 67, 27, 11, 30, 35, 23, 59, 35, 99 - }; - vector v; - v.reserve (VectorSize(c_Values)); -diff --git a/bvt/bvt24.std b/bvt/bvt24.std -index ff09fcf..737babe 100644 ---- a/bvt/bvt24.std -+++ b/bvt/bvt24.std -@@ -2,179 +2,179 @@ - 93 - ------------------------------------------------ - 93 -- 92 -+ 12 - ------------------------------------------------ - 93 -- 92 90 -+ 12 90 - ------------------------------------------------ - 93 -- 92 90 -- 86 -+ 86 90 -+ 12 - ------------------------------------------------ - 93 -- 92 90 -- 86 83 -+ 86 90 -+ 12 83 - ------------------------------------------------ - 93 -- 92 90 -- 86 83 86 -+ 86 90 -+ 12 83 86 - ------------------------------------------------ - 93 -- 92 90 -- 86 83 86 77 -+ 86 90 -+ 12 83 86 17 - ------------------------------------------------ - 93 -- 92 90 -- 86 83 86 77 -- 40 -+ 86 90 -+ 40 83 86 17 -+ 12 - ------------------------------------------------ - 93 -- 92 90 -- 86 83 86 77 -- 40 72 -+ 86 90 -+ 72 83 86 17 -+ 12 40 - ------------------------------------------------ - 93 -- 92 90 -- 86 83 86 77 -- 40 72 36 -+ 86 90 -+ 72 83 86 17 -+ 12 40 36 - ------------------------------------------------ - 93 -- 92 90 -- 86 83 86 77 -- 40 72 36 68 -+ 86 90 -+ 72 83 86 17 -+ 12 40 36 68 - ------------------------------------------------ - 93 -- 92 90 -- 86 83 86 77 -- 40 72 36 68 82 -+ 86 90 -+ 72 83 86 17 -+ 12 40 36 68 42 - ------------------------------------------------ - 93 -- 92 90 -- 86 83 86 77 -- 40 72 36 68 82 62 -+ 86 90 -+ 72 83 86 17 -+ 12 40 36 68 42 62 - ------------------------------------------------ - 93 -- 92 90 -- 86 83 86 77 -- 40 72 36 68 82 62 67 -+ 86 90 -+ 72 83 86 67 -+ 12 40 36 68 42 62 17 - ------------------------------------------------ - 93 -- 92 90 -- 86 83 86 77 -- 40 72 36 68 82 62 67 63 -+ 86 90 -+ 72 83 86 67 -+ 12 40 36 68 42 62 17 63 - ------------------------------------------------ - 93 -- 92 90 -- 86 83 86 77 -- 40 72 36 68 82 62 67 63 -- 15 -+ 86 90 -+ 72 83 86 67 -+ 65 40 36 68 42 62 17 63 -+ 12 - ------------------------------------------------ - 93 -- 92 90 -- 86 83 86 77 -- 40 72 36 68 82 62 67 63 -- 15 26 -+ 86 90 -+ 72 83 86 67 -+ 65 40 36 68 42 62 17 63 -+ 12 26 - ------------------------------------------------ - 93 -- 92 90 -- 86 83 86 77 -- 40 72 36 68 82 62 67 63 -- 15 26 26 -+ 86 90 -+ 72 83 86 67 -+ 65 40 36 68 42 62 17 63 -+ 12 26 26 - ------------------------------------------------ - 93 -- 92 90 -- 86 83 86 77 -- 40 72 36 68 82 62 67 63 -- 15 26 26 49 -+ 86 90 -+ 72 83 86 67 -+ 65 49 36 68 42 62 17 63 -+ 12 26 26 40 - ------------------------------------------------ - 93 -- 92 90 -- 86 83 86 77 -- 40 72 36 68 82 62 67 63 -- 15 26 26 49 21 -+ 86 90 -+ 72 83 86 67 -+ 65 49 36 68 42 62 17 63 -+ 12 26 26 40 21 - ------------------------------------------------ - 93 -- 92 90 -- 86 83 86 77 -- 40 72 36 68 82 62 67 63 -- 15 26 26 49 21 11 -+ 86 90 -+ 72 83 86 67 -+ 65 49 36 68 42 62 17 63 -+ 12 26 26 40 21 11 - ------------------------------------------------ - 93 -- 92 90 -- 86 83 86 77 -- 40 72 36 68 82 62 67 63 -- 15 26 26 49 21 11 62 -+ 86 90 -+ 72 83 86 67 -+ 65 49 36 68 42 62 17 63 -+ 12 26 26 40 21 11 62 - ------------------------------------------------ - 93 -- 92 90 -- 86 83 86 77 -- 40 72 36 68 82 62 67 63 -- 15 26 26 49 21 11 62 67 -+ 86 90 -+ 72 83 86 67 -+ 65 49 36 68 42 62 17 63 -+ 12 26 26 40 21 11 62 67 - ------------------------------------------------ - 93 -- 92 90 -- 86 83 86 77 -- 40 72 36 68 82 62 67 63 -- 15 26 26 49 21 11 62 67 27 -+ 86 90 -+ 72 83 86 67 -+ 65 49 36 68 42 62 17 63 -+ 12 26 26 40 21 11 62 67 27 - ------------------------------------------------ - 93 -- 92 90 -- 86 83 86 77 -- 40 72 36 68 82 62 67 63 -- 15 26 26 49 21 11 62 67 27 29 -+ 86 90 -+ 72 83 86 67 -+ 65 49 36 68 42 62 17 63 -+ 12 26 26 40 21 11 62 67 27 11 - ------------------------------------------------ - 93 -- 92 90 -- 86 83 86 77 -- 40 72 36 68 82 62 67 63 -- 15 26 26 49 21 11 62 67 27 29 30 -+ 86 90 -+ 72 83 86 67 -+ 65 49 36 68 42 62 17 63 -+ 12 26 26 40 21 11 62 67 27 11 30 - ------------------------------------------------ - 93 -- 92 90 -- 86 83 86 77 -- 40 72 36 68 82 62 67 63 -- 15 26 26 49 21 11 62 67 27 29 30 35 -+ 86 90 -+ 72 83 86 67 -+ 65 49 36 68 42 62 17 63 -+ 12 26 26 40 21 11 62 67 27 11 30 35 - ------------------------------------------------ - 93 -- 92 90 -- 86 83 86 77 -- 40 72 36 68 82 62 67 63 -- 15 26 26 49 21 11 62 67 27 29 30 35 23 -+ 86 90 -+ 72 83 86 67 -+ 65 49 36 68 42 62 23 63 -+ 12 26 26 40 21 11 62 67 27 11 30 35 17 - ------------------------------------------------ - 93 -- 92 90 -- 86 83 86 77 -- 40 72 36 68 82 62 67 63 -- 15 26 26 49 21 11 62 67 27 29 30 35 23 59 -+ 86 90 -+ 72 83 86 67 -+ 65 49 36 68 42 62 59 63 -+ 12 26 26 40 21 11 62 67 27 11 30 35 17 23 - ------------------------------------------------ - 93 -- 92 90 -- 86 83 86 77 -- 40 72 36 68 82 62 67 63 -- 15 26 26 49 21 11 62 67 27 29 30 35 23 59 35 -+ 86 90 -+ 72 83 86 67 -+ 65 49 36 68 42 62 59 63 -+ 12 26 26 40 21 11 62 67 27 11 30 35 17 23 35 - ------------------------------------------------ -- 93 -- 92 90 -- 86 83 86 77 -- 40 72 36 68 82 62 67 63 -- 15 26 26 49 21 11 62 67 27 29 30 35 23 59 35 29 -+ 99 -+ 86 93 -+ 72 83 86 90 -+ 65 49 36 68 42 62 59 67 -+ 12 26 26 40 21 11 62 67 27 11 30 35 17 23 35 63 - ------------------------------------------------ - make_heap on the full range: -- 93 -- 92 90 -- 86 83 86 77 -- 40 72 36 68 82 62 67 63 -- 15 26 26 49 21 11 62 67 27 29 30 35 23 59 35 29 -+ 99 -+ 86 93 -+ 72 83 86 90 -+ 65 49 36 68 42 62 67 63 -+ 40 26 26 12 21 11 62 67 27 11 30 35 23 59 35 17 - ------------------------------------------------ - pop_heap: -- 92 -+ 93 - 86 90 -- 72 83 86 77 -- 40 49 36 68 82 62 67 63 -- 15 26 26 29 21 11 62 67 27 29 30 35 23 59 35 -+ 72 83 86 67 -+ 65 49 36 68 42 62 59 63 -+ 40 26 26 12 21 11 62 67 27 11 30 35 23 17 35 - ------------------------------------------------ - sort_heap: -- 11 15 21 23 26 26 27 29 29 30 35 35 36 40 49 59 62 62 63 67 67 68 72 77 82 83 86 86 90 92 93 -+ 11 11 12 17 21 23 26 26 27 30 35 35 36 40 42 49 59 62 62 63 65 67 67 68 72 83 86 86 90 93 99 - ------------------------------------------------ - priority_queue push and pop: -- 93 92 90 86 86 83 82 77 72 68 67 67 63 62 62 59 49 40 36 35 35 30 29 29 27 26 26 23 21 15 11 -+ 99 93 90 86 86 83 72 68 67 67 65 63 62 62 59 49 42 40 36 35 35 30 27 26 26 23 21 17 12 11 11 -diff --git a/config.h.in b/config.h.in -index 30a1b5e..1189ddc 100644 ---- a/config.h.in -+++ b/config.h.in -@@ -95,9 +95,6 @@ - /// gcc has lately decided that inline is just a suggestion - /// Define to 1 if when you say 'inline' you mean it! - #undef WANT_ALWAYS_INLINE --#if WANT_ALWAYS_INLINE -- #define inline INLINE inline --#endif - - /// Define to 1 if you have the header file. - #undef HAVE_ASSERT_H -diff --git a/configure b/configure -index 29daf75..b03b742 100755 ---- a/configure -+++ b/configure -@@ -1,4 +1,4 @@ --#! /bin/bash -+#! /bin/sh - # - # This file is free software, distributed under the MIT License. - ###################################################################### -@@ -88,6 +88,8 @@ s/@PKG_MINOR@/$PKG_MINOR/g" - ###################################################################### - - die() { rm -f config.sed config.cpu config.cpu.c; exit; } -+sub() { printf "%s\n" "$1">>config.sed; } -+escpath() { echo $1 | sed 's/\//\\\//g'; } - - #### Compile the configurator and generate initial config.sed ######## - -@@ -261,50 +263,47 @@ case "$SYSNAME" in - esac - - if [ "$SYSNAME" = "sun" ]; then -- echo "s/-Wredundant-decls/-Wno-redundant-decls/g -- s/@SHBLDFL@/-G/g" >>config.sed -+ sub "s/-Wredundant-decls/-Wno-redundant-decls/;s/@SHBLDFL@/-G/" - else -- echo 's/#undef \(HAVE_THREE_CHAR_TYPES\)/#define \1 1/g' >>config.sed -+ sub "s/#undef \(HAVE_THREE_CHAR_TYPES\)/#define \1 1/" - fi - if [ "$SYSNAME" = "bsd" ]; then -- echo 's/ @libgcc_eh@//g -- s/#define WITHOUT_LIBSTDCPP 1/#undef WITHOUT_LIBSTDCPP/g -- s/NOLIBSTDCPP = -nodefaultlibs /#NOLIBSTDCPP = -nodefaultlibs/g -- s/-Wredundant-decls/-Wno-redundant-decls/g -- s/-Winline/-Wno-inline/g -- s/#define HAVE_VA_COPY 1/#undef HAVE_VA_COPY/g' >>config.sed -+ sub 's/ @libgcc_eh@//g -+ s/#define WITHOUT_LIBSTDCPP 1/#undef WITHOUT_LIBSTDCPP/ -+ s/NOLIBSTDCPP = -nodefaultlibs /#NOLIBSTDCPP = -nodefaultlibs/ -+ s/-Wredundant-decls/-Wno-redundant-decls/ -+ s/-Winline/-Wno-inline/ -+ s/#define HAVE_VA_COPY 1/#undef HAVE_VA_COPY/' - fi - if [ "$SYSNAME" = "linux" -o "$SYSNAME" = "bsd" ]; then -- echo 's/@SHBLDFL@/-shared -Wl,-soname=$1/g' >>config.sed -+ sub 's/@SHBLDFL@/-shared -Wl,-soname=$1/' - elif [ "$SYSNAME" = "alpha" ]; then -- echo "s/BUILD_SHARED = 1 /#BUILD_SHARED = 1/g -- s/#BUILD_STATIC = 1/BUILD_STATIC = 1 /g" >>config.sed -+ sub "s/BUILD_SHARED = 1 /#BUILD_SHARED = 1/;s/#BUILD_STATIC = 1/BUILD_STATIC = 1 /" - fi - if [ "$SYSNAME" = "mac" ]; then -- echo 's/ @libgcc_eh@//g -+ sub 's/ @libgcc_eh@//g - s/lib$1.so/lib$1.dylib/g - s/lib$1.so.${MAJOR}.${MINOR}.${BUILD}/lib$1.${MAJOR}.${MINOR}.${BUILD}.dylib/g - s/lib$1.so.${MAJOR}.${MINOR}/lib$1.${MAJOR}.${MINOR}.dylib/g - s/lib$1.so.${MAJOR}/lib$1.${MAJOR}.dylib/g - s/ -s -Wl,-gc-sections/ -mmacosx-version-min=10.9/g -- s/@SHBLDFL@/-Wl,-single_module -compatibility_version 1 -current_version 1 -install_name $1 -Wl,-Y,1455 -dynamiclib -mmacosx-version-min=10.9/g' >>config.sed -+ s/@SHBLDFL@/-Wl,-single_module -compatibility_version 1 -current_version 1 -install_name $1 -Wl,-Y,1455 -dynamiclib -mmacosx-version-min=10.9/g' - if [ "$CC" = "clang" ]; then -- echo 's/ @libsupc++@/ @libc++abi@/g' >>config.sed -+ sub "s/ @libsupc++@/ @libc++abi@/g" - fi - fi - if [ "$SYSNAME" = "alpha" -o "$SYSNAME" = "mac" ]; then -- echo 's/#undef \(SIZE_OF_BOOL\)/#define \1 SIZE_OF_LONG/g' >>config.sed -+ sub "s/#undef \(SIZE_OF_BOOL\)/#define \1 SIZE_OF_LONG/" - else -- echo 's/#undef \(SIZE_OF_BOOL\)/#define \1 SIZE_OF_CHAR/g' >>config.sed -+ sub "s/#undef \(SIZE_OF_BOOL\)/#define \1 SIZE_OF_CHAR/" - fi - if [ "$SYSNAME" = "linux" ]; then -- echo 's/#undef \(HAVE_RINTF\)/#define \1 1/g' >>config.sed -+ sub "s/#undef \(HAVE_RINTF\)/#define \1 1/" - else -- echo 's/-p --ignore-fail-on-non-empty//g -- s/ -mfpmath=sse//g' >>config.sed -+ sub "s/-p --ignore-fail-on-non-empty//;s/ -mfpmath=sse//" - fi - if [ "$SYSNAME" = "mac" -o "$SYSNAME" = "bsd" ]; then -- echo 's/#define \(HAVE_STRSIGNAL\) 1/#undef \1/g' >>config.sed -+ sub "s/#define \(HAVE_STRSIGNAL\) 1/#undef \1/g" - fi - - #### Printing helper functions ####################################### -@@ -350,9 +349,9 @@ PrintVersion() { - - SubVar() { - local esc2 -- esc2=`echo $2 | sed 's/\//\\\&/g'` -+ esc2=`escpath $2` - eval ac_var_$1='$esc2'; -- echo "s/@$1@/$esc2/g" >>config.sed -+ sub "s/@$1@/$esc2/g" - } - - SubComp() { -@@ -361,7 +360,7 @@ SubComp() { - while [ ! -z "$cc" ]; do - name=`expr "$cc" : '[^}]*name=\[\([^]]*\)\]'` - seds=`expr "$cc" : '[^}]*seds=\[\([^]]*\)\]'` -- [ "$name" = "$1" ] && echo $seds >>config.sed -+ [ "$name" = "$1" ] && sub "$seds" - cc=`expr "$cc" : '[^}]*}\(.*\)'` - done - } -@@ -379,7 +378,7 @@ done - - #### Set directory prefixes ########################################## - --echo "s/@prefix@/${ac_var_prefix:=\/usr\/local}/g -+sub "s/@prefix@/${ac_var_prefix:=\/usr\/local}/g - s/@bindir@/$ac_var_prefix\/bin/g - s/@datadir@/${ac_var_datadir:=$ac_var_prefix\/share}/g - s/@sysconfdir@/$ac_var_prefix\/etc/g -@@ -391,15 +390,15 @@ s/@libdir@/${ac_var_libdir:=$ac_var_prefix\/lib}/g - s/@localedir@/$ac_var_datarootdir\/locale/g - s/@mandir@/$ac_var_datarootdir\/man/g - s/@builddir@/\/tmp\/$USER\/make/g --s/@gccincludedir@/${ac_var_gccincludedir:=`echo $PINCDIR | sed 's/\//\\\&/g'`}/g --s/@gcclibdir@/${ac_var_gcclibdir:=`echo $PLIBDIR | sed 's/\//\\\&/g'`}/g -+s/@gccincludedir@/${ac_var_gccincludedir:=`escpath $PINCDIR`}/g -+s/@gcclibdir@/${ac_var_gcclibdir:=`escpath $PLIBDIR`}/g - s/@customincdir@/${ac_var_customincdir:=$ac_var_prefix\/include}/g --s/@customlibdir@/${ac_var_customlibdir:=$ac_var_prefix\/lib}/g" >>config.sed -+s/@customlibdir@/${ac_var_customlibdir:=$ac_var_prefix\/lib}/g" - - if [ "$ac_var_prefix" != "\/usr\/local" -a "$ac_var_prefix" != "\/usr" ]; then -- echo "s/ @CUSTOMINCDIR@/ -I$ac_var_customincdir/g;s/ @CUSTOMLIBDIR@/ -L$ac_var_customlibdir/g" >>config.sed -+ sub "s/ @CUSTOMINCDIR@/ -I$ac_var_customincdir/g;s/ @CUSTOMLIBDIR@/ -L$ac_var_customlibdir/g" - else -- echo "s/ @CUSTOMINCDIR@//g;s/ @CUSTOMLIBDIR@//g" >>config.sed -+ sub "s/ @CUSTOMINCDIR@//g;s/ @CUSTOMLIBDIR@//g" - fi - - #### Find headers, libs, programs, and subs ########################## -@@ -411,7 +410,7 @@ INCPATH=`echo $INCPATH | sed 's/\\\\//g'` - for i in $HEADERS; do - for p in $INCPATH; do - if [ -r "$p/$i" ]; then -- echo 's/#undef \(HAVE_'`echo $i|tr a-z/.- A-Z___`'\)/#define \1 1/' >>config.sed -+ sub "s/#undef \(HAVE_`echo $i|tr a-z/.- A-Z___`\)/#define \1 1/" - break - fi - done -@@ -431,31 +430,34 @@ for i in $LIBS; do - done - [ -z "$found" ] || break - done -- echo "s/ @lib$i@/$found/g" >>config.sed -+ sub "s/ @lib$i@/$found/g" - done - - for i in $PROGS; do - pname=`expr "$i" : '\([^=]*\)=[^=]*'` - pcall=`expr "$i" : '[^=]*=\([^=]*\)'` -- esciv="`eval echo \$\{$pname\}|sed 's/\//\\\\\//g'`" -+ ppath=`eval echo \$\{$pname\}` -+ ppath=`escpath "$ppath"` - # First check if an environment variable is set -- [ ! -z "$esciv" ] && echo "s/@$pname@/$esciv/g" >>config.sed -+ [ ! -z "$ppath" ] && sub "s/@$pname@/$ppath/g" - # Check if the program exists -- [ -x `which $pcall 2>/dev/null` ] && echo "s/@$pname@/$pcall/g" >>config.sed -+ [ -x `which $pcall 2>/dev/null` ] && sub "s/@$pname@/$pcall/g" - done - # If nothing found in first loop, set the first pair anyway. - for i in $PROGS; do - pname=`expr "$i" : '\([^=]*\)=[^=]*'` - pcall=`expr "$i" : '[^=]*=\([^=]*\)'` -- echo "s/@$pname@/$pcall/g" >>config.sed -+ sub "s/@$pname@/$pcall/g" - done - # And, finally, the environment variables - for i in $ENVIRONS; do - esciv="`eval echo '"'\$\{$i\}'"'|sed 's/\//\\\&/g'`" -- [ ! -z "$esciv" ] && esciv=" $esciv" -- echo "s/ @$i@/$esciv/g" >>config.sed -+ ppath=`eval echo \$\{$pname\}` -+ ppath=`escpath "$ppath"` -+ [ ! -z "$ppath" ] && ppath=" $ppath" -+ sub "s/ @$i@/$ppath/g" - done --echo "$CUSTSUBS" >>config.sed -+sub "$CUSTSUBS" - } - SubHeadLibsProgs - -diff --git a/docs/index.html b/docs/index.html -index 32e309e..7a9f8ff 100644 ---- a/docs/index.html -+++ b/docs/index.html -@@ -240,7 +240,7 @@ returns the string length in bytes, length in characters. - You can iterate by characters instead of bytes with a special utf8 - iterator: -

--for (auto i = s.utf8_begin(); i < s.utf8_end(); ++ i)
-+for (auto i = s.utf8_begin(); i < s.utf8_end(); ++i)
-     DrawChar (*i);
- 

- or just copy all the chars into an array and iterate over that: -@@ -591,59 +591,58 @@ int main (void) - } -

- Feel free to compile it and see for yourself. I'm compiling on a Core i7 --with gcc 4.7.2 and -Os -DNDEBUG=1 -march=native. The libstdc++ -+with gcc 5.3 and -Os -DNDEBUG=1 -march=native. The libstdc++ - version is linked implicitly with it, and uSTL version is linked with gcc - (instead of g++) and -lustl. Both executables are stripped. - The libstdc++ version looks like this: -

- % ls -l std/tes
--6896 tes
-+6912 tes
- % size std/tes
- text	data	bss	dec	hex	filename
--3522	656	8	4186	105a	std/tes
-+3464	656	8	4128	1020	std/tes
- % size -A std/tes.o
- std/tes.o:
--section                                                                                                      size
--.group                                                                                                          8
--.group                                                                                                          8
--.group                                                                                                          8
--.group                                                                                                          8
--.group                                                                                                          8
--.text                                                                                                          11
--.data                                                                                                           0
--.bss                                                                                                            0
--.text._ZNKSt6vectorIiSaIiEE12_M_check_lenEmPKc                                                                 61
--.text._ZNSt11__copy_moveILb0ELb1ESt26random_access_iterator_tagE8__copy_mIiEEPT_PKS3_S6_S4_                    45
--.text._ZNSt20__copy_move_backwardILb0ELb1ESt26random_access_iterator_tagE13__copy_move_bIiEEPT_PKS3_S6_S4_     58
--.rodata.str1.1                                                                                                 45
--.text._ZNSt6vectorIiSaIiEE14_M_fill_insertEN9__gnu_cxx17__normal_iteratorIPiS1_EEmRKi                         386
--.text._ZNSt6vectorIiSaIiEE13_M_insert_auxEN9__gnu_cxx17__normal_iteratorIPiS1_EERKi                           232
--.text.startup                                                                                                 294
--.gcc_except_table                                                                                              20
--.comment                                                                                                       18
--.note.GNU-stack                                                                                                 0
--.eh_frame                                                                                                     368
--Total                                                                                                        1578
-+section														size
-+.group														  12
-+.group														  12
-+.group														  12
-+.group														  12
-+.group														  12
-+.text														   0
-+.data														   0
-+.bss														   0
-+.text._ZNKSt6vectorIiSaIiEE12_M_check_lenEmPKc									  72
-+.text._ZNSt20__copy_move_backwardILb0ELb1ESt26random_access_iterator_tagE13__copy_move_bIiEEPT_PKS3_S6_S4_	  51
-+.text._ZNSt11__copy_moveILb0ELb1ESt26random_access_iterator_tagE8__copy_mIiEEPT_PKS3_S6_S4_			  42
-+.rodata.str1.1													  45
-+.text._ZNSt6vectorIiSaIiEE13_M_insert_auxEN9__gnu_cxx17__normal_iteratorIPiS1_EERKi				 226
-+.text._ZNSt6vectorIiSaIiEE14_M_fill_insertEN9__gnu_cxx17__normal_iteratorIPiS1_EEmRKi				 386
-+.text.startup													 301
-+.gcc_except_table												  20
-+.comment													  18
-+.note.GNU-stack													   0
-+.eh_frame													 344
-+Total														1565
- 

- The uSTL version looks like this: -

- % ls -l ustl/tes
--5704 tes
-+5848 tes
- % size ustl/tes
- text	data	bss	dec	hex	filename
--2383	640	8	3031	bd7	ustl/tes
-+2505	640	8	3153	c51	ustl/tes
- % size -A ustl/tes.o
--ustl/tes.o:
--section             size
--.text                  0
--.data                  0
--.bss                   0
--.text.startup        277
--.gcc_except_table     19
--.comment              18
--.note.GNU-stack        0
--.eh_frame             72
--Total                386
-+.text			  0
-+.data			  0
-+.bss			  0
-+.text.unlikely		  0
-+.text.startup		273
-+.gcc_except_table	 15
-+.comment		 18
-+.note.GNU-stack		  0
-+.eh_frame		 72
-+Total			378
- 

- As you can see, the libstdc++ version instantiates quite a bit of code - for just this one vector type, with out-of-line functions for copy, move, -@@ -658,31 +657,31 @@ executable just for container overhead. - But wait, there is more! Let's look at the total memory footprint: -

- % footprint std/tes
--   text	   data	    bss	    dec	    hex	filename
--   3522	    656	      8	   4186	   105a	tes
--  83357	    968	    664	  84989	  14bfd	libgcc_s.so.1
--1031819	   1100	     72	1032991	  fc31f	libm.so.6
-- 935489	  36200	  85088	1056777	 102009	libstdc++.so.6
--1715642	  20560	  17800	1754002	 1ac392	libc.so.6
--3769829	  59484	 103632	3932945	 3c0311	(TOTALS)
-+   text    data     bss     dec     hex filename
-+   3464     656       8    4128    1020 tes
-+  86254     976     672   87902   1575e libgcc_s.so.1
-+1033970     892      12 1034874   fca7a libm.so.6
-+1514876   46936   14240 1576052  180c74 libstdc++.so.6
-+1678707   20344   17240 1716291  1a3043 libc.so.6
-+4317271   69804   32172 4419247  436eaf (TOTALS)
- 
- % footprint ustl/tes
-    text	   data	    bss	    dec	    hex	filename
--   2383	    640	      8	   3031	    bd7	tes
--  83357	    968	    664	  84989	  14bfd	libgcc_s.so.1
-- 151398	  10848	  73240	 235486	  397de	libustl.so.2
--1715642	  20560	  17800	1754002	 1ac392	libc.so.6
--1952780	  33016	  91712	2077508	 1fb344	(TOTALS)
-+   2505     640       8    3153     c51 tes
-+  86254     976     672   87902   1575e libgcc_s.so.1
-+ 141262    7840     536  149638   24886 libustl.so.2
-+1678707   20344   17240 1716291  1a3043 libc.so.6
-+1908728   29800   18456 1956984  1ddc78 (TOTALS)
- 

--As you can see, the footprint for the uSTL version is 47% smaller, --saving 1855437 bytes. If you don't count libc, measuring only the --C++-specific overhead, libstdc++ loads 2178943 while libustl only 323506, --seven times less! Finally, most of uSTL's size comes from gcc's --support libraries; if you compile uSTL configured --with-libstdc++ --option, then you'll see that it only takes up 72322 bytes, of which only --23350 are used by .text, meaning that only about a third of the library --size is my fault. gcc developers will have to reduce the size of libsupc++ --before any further size reduction would be practical. -+As you can see, the footprint for the uSTL version is less than half -+the size, saving 2.5 megabytes. If you don't count libc, measuring only -+the C++-specific overhead, std/tes loads 2.7 megabytes of libraries, -+while ustl/tes loads only 237k, eleven times less! -+

-+Finally, if you build a static libustl.a, it is only 33k. Linking with -+libsupc++.a adds 75k, of which 45k is ABI name demangling, only used for -+printing backtraces. Linking statically can thus lower the C++ overhead -+to less than 64k, a forty-fold reduction from libstdc++.so. -

- One final note concerns the current gcc versions, 4.4 and later. gcc - developers have decided, for various reasons, to treat the inline keyword -@@ -697,8 +696,10 @@ seems inappropriate. Therefore I've pretty much given up on it. The only - solution I can come up with is to just clobber the optimizer over the head - with #define inline __attribute__((always_inline)) inline. It - is enabled if you configure with --force-inline. The above --examples are compiled with this option. Interestingly, libstdc++ --developers have taken the same approach, defining _GLIBCXX_ALWAYS_INLINE. -+examples are compiled with this option. Amusingly, libstdc++ developers -+have taken the same approach, defining _GLIBCXX_ALWAYS_INLINE. If even -+gcc developers do not trust gcc to make the correct inlining decisions, -+why the policy? Oh well... -

-

Bug reporting

-

-diff --git a/sistream.cc b/sistream.cc -index 71a61cc..5d908af 100644 ---- a/sistream.cc -+++ b/sistream.cc -@@ -171,7 +171,7 @@ istringstream& istringstream::read (void* buffer, size_type sz) - istringstream& istringstream::get (char* p, size_type n, char delim) - { - _gcount = 0; -- for (char c, *pend = p+n-1; p < pend && (remaining() || underflow()); ++p, ++_gcount) { -+ for (char c = 0, *pend = p+n-1; p < pend && (remaining() || underflow()); ++p, ++_gcount) { - istream::iread (c); - if (c == delim) { - ungetc(); -diff --git a/typeinfo.h b/typeinfo.h -index a7367e9..6865b07 100644 ---- a/typeinfo.h -+++ b/typeinfo.h -@@ -7,9 +7,7 @@ - // type information for exception classes. - - #pragma once --#ifndef WITHOUT_LIBSTDCPP -- #include --#else -+#if WITHOUT_LIBSTDCPP - #include "uexception.h" - - namespace __cxxabiv1 { class __class_type_info; } -@@ -33,7 +31,6 @@ private: - protected: - const char* __name; - }; -- - } // namespace std - --#endif -+#endif // WITHOUT_LIBSTDCPP -diff --git a/uatomic.h b/uatomic.h -index 40cfb5d..fd5e090 100644 ---- a/uatomic.h -+++ b/uatomic.h -@@ -4,7 +4,7 @@ - // This file is free software, distributed under the MIT License. - - #pragma once --#include "config.h" -+#include "utypes.h" - #if HAVE_CPP11 - - //{{{ memory_order ----------------------------------------------------- -diff --git a/uexception.h b/uexception.h -index 53c2085..5d9b593 100644 ---- a/uexception.h -+++ b/uexception.h -@@ -5,10 +5,6 @@ - - #pragma once - #include "utypes.h" --#ifndef WITHOUT_LIBSTDCPP -- #include -- #include --#endif - #include "bktrace.h" - - #if WITHOUT_LIBSTDCPP -@@ -123,5 +119,7 @@ protected: - - #if WITHOUT_LIBSTDCPP - } // namespace std --namespace ustl { typedef std::bad_alloc bad_alloc; } -+namespace ustl { -+ typedef std::bad_alloc bad_alloc; - #endif -+} // namespace ustl -diff --git a/uheap.h b/uheap.h -index d09ada0..dc5423d 100644 ---- a/uheap.h -+++ b/uheap.h -@@ -24,6 +24,27 @@ bool is_heap (RandomAccessIterator first, RandomAccessIterator last, Compare com - return true; - } - -+/// Utility function to "trickle down" the root item - swaps the root item with its -+/// largest child and "recursively" fixes the proper subtree. -+template -+void _trickle_down_heap (RandomAccessIterator first, Distance iHole, Distance heapSize, Compare comp) -+{ -+ typedef typename iterator_traits::value_type value_type; -+ const value_type v(first[iHole]); -+ Distance iChild; -+ while ((iChild = 2 * iHole + 1) < heapSize) { -+ if (iChild + 1 < heapSize) -+ iChild += comp(first[iChild], first[iChild + 1]); -+ if (comp(v, first[iChild])) { -+ first[iHole] = first[iChild]; -+ iHole = iChild; -+ } -+ else -+ break; -+ } -+ first[iHole] = v; -+} -+ - /// \brief make_heap turns the range [first, last) into a heap - /// At completion, is_heap (first, last, comp) is true. - /// The algorithm is adapted from "Classic Data Structures in C++" by Timothy Budd. -@@ -33,19 +54,15 @@ bool is_heap (RandomAccessIterator first, RandomAccessIterator last, Compare com - template - void make_heap (RandomAccessIterator first, RandomAccessIterator last, Compare comp) - { -- typedef typename iterator_traits::value_type value_type; -- const value_type v (*first); -- uoff_t iChild, iHole = 0, iEnd (distance (first, last)); -- while ((iChild = 2 * iHole + 1) < iEnd) { -- if (iChild + 1 < iEnd) // Pick the greater child -- iChild += comp (first[iChild], first[iChild + 1]); -- if (comp (first[iChild], v)) -- break; // Done when parent is greater than both children. -- first[iHole] = first[iChild]; -- iHole = iChild; -+ if (last <= first) -+ return; -+ typedef typename iterator_traits::difference_type distance_type; -+ distance_type heapSize(last - first); -+ RandomAccessIterator i = first + (last - first - 1)/2; -+ while (i >= first) { -+ _trickle_down_heap(first, distance_type(i - first), heapSize, comp); -+ --i; - } -- if (iHole < iEnd) -- first[iHole] = v; - } - - /// \brief Inserts the *--last into the preceeding range assumed to be a heap. -@@ -77,8 +94,9 @@ void pop_heap (RandomAccessIterator first, RandomAccessIterator last, Compare co - { - if (--last <= first) - return; -- iter_swap (first, last); -- make_heap (first, last, comp); -+ typedef typename iterator_traits::difference_type distance_type; -+ iter_swap(first, last); -+ _trickle_down_heap(first, distance_type(0), distance_type(last - first), comp); - } - - /// Sorts heap [first, last) in descending order according to comp. -@@ -128,7 +146,7 @@ public: - inline size_type size (void) const { return _v.size(); } - inline bool empty (void) const { return _v.empty(); } - inline reference top (void) const { return _v.at(0); } -- inline void push (reference v) { _v.push_back (v); make_heap (_v.begin(), _v.end(), _c); } -+ inline void push (reference v) { _v.push_back (v); push_heap (_v.begin(), _v.end(), _c); } - inline void pop (void) { pop_heap (_v.begin(), _v.end()); _v.pop_back(); } - private: - base_ctr _v; ///< Element container. -diff --git a/unew.h b/unew.h -index 73ef89c..9e1ee5a 100644 ---- a/unew.h -+++ b/unew.h -@@ -42,6 +42,4 @@ inline void* operator new[] (size_t, void* p) noexcept { return p; } - inline void operator delete (void*, void*) noexcept { } - inline void operator delete[](void*, void*) noexcept { } - --#else --#include - #endif // WITHOUT_LIBSTDCPP -diff --git a/upair.h b/upair.h -index e6cdc24..ef67aca 100644 ---- a/upair.h -+++ b/upair.h -@@ -54,13 +54,11 @@ template - inline pair make_pair (T1&& a, T2&& b) - { return pair (forward(a), forward(b)); } - --#else -+#endif - - /// Returns a pair object with (a,b) - template - inline pair make_pair (const T1& a, const T2& b) - { return pair (a, b); } - --#endif -- - } // namespace ustl -diff --git a/ustring.cc b/ustring.cc -index a087684..a528373 100644 ---- a/ustring.cc -+++ b/ustring.cc -@@ -13,7 +13,7 @@ namespace ustl { - - //---------------------------------------------------------------------- - --const string::pos_type string::npos; -+/*static*/ constexpr const string::pos_type string::npos; - - //---------------------------------------------------------------------- - -diff --git a/utypes.h b/utypes.h -index c5cf043..f9a69b0 100644 ---- a/utypes.h -+++ b/utypes.h -@@ -4,6 +4,8 @@ - // This file is free software, distributed under the MIT License. - - #pragma once -+#define __STDC_LIMIT_MACROS // For WCHAR_MIN and WCHAR_MAX in stdint. -+#define __STDC_CONSTANT_MACROS // For UINT??_C macros to avoid using L and UL suffixes on constants. - #include "config.h" - #ifndef STDC_HEADERS - #error "This library requires standard C and C++ headers to compile." -@@ -11,8 +13,6 @@ - #ifndef STDUNIX_HEADERS - #error "This library requires standard UNIX headers to compile." - #endif --#define __STDC_LIMIT_MACROS // For WCHAR_MIN and WCHAR_MAX in stdint. --#define __STDC_CONSTANT_MACROS // For UINT??_C macros to avoid using L and UL suffixes on constants. - #if HAVE_STDINT_H - #include - #elif HAVE_INTTYPES_H -@@ -27,6 +27,11 @@ - #include - #include - #include -+#ifndef WITHOUT_LIBSTDCPP -+ #include -+ #include -+ #include -+#endif - #ifndef SIZE_MAX - #define SIZE_MAX UINT_MAX - #endif -@@ -62,3 +67,6 @@ typedef uoff_t streamoff; ///< Offset into a stream - #if !defined(UINTPTR_MAX) || !defined(UINT32_C) - #error "If you include stdint.h before ustl.h, define __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS first" - #endif -+#if WANT_ALWAYS_INLINE -+ #define inline INLINE inline -+#endif diff --git a/ustl.spec b/ustl.spec index 2a9aa43..8c0ec01 100644 --- a/ustl.spec +++ b/ustl.spec @@ -1,14 +1,11 @@ Name: ustl -Version: 2.3 +Version: 2.4 Release: 1%{?dist} Summary: A size-optimized STL implementation License: MIT URL: http://msharov.github.io/ustl/ Source0: https://github.com/msharov/ustl/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz -# HEAD, fixes libstdc++ compat, warnings, etc. (see commit messages inside) -Patch0: ustl-%{version}-cumulative.patch - BuildRequires: gcc-c++ BuildRequires: make BuildRequires: sed @@ -46,7 +43,6 @@ developing applications that use %{name}. %prep %setup -q -%patch0 -p1 # No silent build. sed -i -e 's|\t@|\t|g' Makefile @@ -98,6 +94,10 @@ make check %{_libdir}/libustl.so %changelog +* Fri May 20 2016 Denis Fateyev - 2.4-1 +- Update to 2.4 version +- Dropping obsolete patches + * Mon Feb 29 2016 Denis Fateyev - 2.3-1 - Update EPEL branches to 2.3 version From 37447f74c15d3f71c24f4918b6bf0ccd16ba19f8 Mon Sep 17 00:00:00 2001 From: Denis Fateyev Date: Tue, 27 Dec 2016 01:11:00 +0600 Subject: [PATCH 4/4] ustl: 2.5 release --- .gitignore | 1 + sources | 2 +- ustl.spec | 5 ++++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 8b620b6..5b35722 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /ustl-2.1.tar.gz /ustl-2.3.tar.gz /ustl-2.4.tar.gz +/ustl-2.5.tar.gz diff --git a/sources b/sources index 1583f85..26173d2 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -240c30cdd63d3b1af24cbe692a3963de ustl-2.4.tar.gz +SHA512 (ustl-2.5.tar.gz) = 3ed26daa5773df9e667d4311778b026fc012d7dadf35eb4fcf26b7c0dacb3fa120ce8e3a9db4c5929bfa1325342a28c601471b63d8c40e70e5d96eb3976fdd27 diff --git a/ustl.spec b/ustl.spec index 8c0ec01..2231990 100644 --- a/ustl.spec +++ b/ustl.spec @@ -1,5 +1,5 @@ Name: ustl -Version: 2.4 +Version: 2.5 Release: 1%{?dist} Summary: A size-optimized STL implementation License: MIT @@ -94,6 +94,9 @@ make check %{_libdir}/libustl.so %changelog +* Sat Dec 24 2016 Denis Fateyev - 2.5-1 +- Update to 2.5 version + * Fri May 20 2016 Denis Fateyev - 2.4-1 - Update to 2.4 version - Dropping obsolete patches