From ace2b29c6070a4c6edcd427e953773648086f5ba Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Tue, 28 Jan 2014 15:21:43 +0100
Subject: [PATCH] little bug found thanks to first Clang compilation; linking
 under CLang given up

---
 pub/CHANGELOG       |   5 ++
 pub/configure       | 156 +++++++++++++++++++++++---------------------
 pub/configure.ac    |   9 ++-
 pub/src/manip.cpp   |   2 +-
 pub/src/xax_lex.lpp |   1 +
 5 files changed, 95 insertions(+), 78 deletions(-)

diff --git a/pub/CHANGELOG b/pub/CHANGELOG
index a9e01869..d363449f 100644
--- a/pub/CHANGELOG
+++ b/pub/CHANGELOG
@@ -1,3 +1,8 @@
+Release
+
+- bugfix:
+  - little bug found thanks to first Clang compilation
+
 Release 2.1.8f of 23jan14:
 
 - bugfix:
diff --git a/pub/configure b/pub/configure
index 41f0802c..c35129a2 100755
--- a/pub/configure
+++ b/pub/configure
@@ -2865,6 +2865,81 @@ fi
 ##  Select compiler and preprocessors                                         ##
 ################################################################################
 
+# AC_PROG_CXX(["clang -D__float128=void -stdlib=libc++" g++])
+# clang:
+#  * -D__float128=void is workaround,
+#    see http://llvm.org/bugs/show_bug.cgi?id=13530#c3
+#  * linking with libc++ and libc++abi doesn't work
+#  * first convert to CMake ??
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+DEPDIR="${am__leading_dot}deps"
+
+ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+	@echo this is the am__doit target
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5
+$as_echo_n "checking for style of include used by $am_make... " >&6; }
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# Ignore all kinds of additional output from 'make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+  am__include=include
+  am__quote=
+  _am_result=GNU
+  ;;
+esac
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   case `$am_make -s -f confmf 2> /dev/null` in #(
+   *the\ am__doit\ target*)
+     am__include=.include
+     am__quote="\""
+     _am_result=BSD
+     ;;
+   esac
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5
+$as_echo "$_am_result" >&6; }
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then :
+  enableval=$enable_dependency_tracking;
+fi
+
+if test "x$enable_dependency_tracking" != xno; then
+  am_depcomp="$ac_aux_dir/depcomp"
+  AMDEPBACKSLASH='\'
+  am__nodep='_no'
+fi
+ if test "x$enable_dependency_tracking" != xno; then
+  AMDEP_TRUE=
+  AMDEP_FALSE='#'
+else
+  AMDEP_TRUE='#'
+  AMDEP_FALSE=
+fi
+
+
 ac_ext=cpp
 ac_cpp='$CXXCPP $CPPFLAGS'
 ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -3366,74 +3441,11 @@ else
     CXXFLAGS=
   fi
 fi
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-DEPDIR="${am__leading_dot}deps"
-
-ac_config_commands="$ac_config_commands depfiles"
-
-
-am_make=${MAKE-make}
-cat > confinc << 'END'
-am__doit:
-	@echo this is the am__doit target
-.PHONY: am__doit
-END
-# If we don't find an include directive, just comment out the code.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5
-$as_echo_n "checking for style of include used by $am_make... " >&6; }
-am__include="#"
-am__quote=
-_am_result=none
-# First try GNU make style include.
-echo "include confinc" > confmf
-# Ignore all kinds of additional output from 'make'.
-case `$am_make -s -f confmf 2> /dev/null` in #(
-*the\ am__doit\ target*)
-  am__include=include
-  am__quote=
-  _am_result=GNU
-  ;;
-esac
-# Now try BSD make style include.
-if test "$am__include" = "#"; then
-   echo '.include "confinc"' > confmf
-   case `$am_make -s -f confmf 2> /dev/null` in #(
-   *the\ am__doit\ target*)
-     am__include=.include
-     am__quote="\""
-     _am_result=BSD
-     ;;
-   esac
-fi
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5
-$as_echo "$_am_result" >&6; }
-rm -f confinc confmf
-
-# Check whether --enable-dependency-tracking was given.
-if test "${enable_dependency_tracking+set}" = set; then :
-  enableval=$enable_dependency_tracking;
-fi
-
-if test "x$enable_dependency_tracking" != xno; then
-  am_depcomp="$ac_aux_dir/depcomp"
-  AMDEPBACKSLASH='\'
-  am__nodep='_no'
-fi
- if test "x$enable_dependency_tracking" != xno; then
-  AMDEP_TRUE=
-  AMDEP_FALSE='#'
-else
-  AMDEP_TRUE='#'
-  AMDEP_FALSE=
-fi
-
-
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
 depcc="$CXX"  am_compiler_list=
 
@@ -3563,12 +3575,6 @@ else
 fi
 
 
-ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
 
     ax_cxx_compile_cxx11_required=truednl
   ac_ext=cpp
@@ -3740,7 +3746,7 @@ $as_echo "#define HAVE_CXX11 1" >>confdefs.h
 
   fi
  # provided in directory m4
-AM_CXXFLAGS="-g -pedantic -Wall -Wno-sign-compare -Wno-unused-result -Werror"
+AM_CXXFLAGS="-g -pedantic -Wall -Wno-sign-compare -Wno-unused-result -Wno-parentheses -Werror"
 
 # for valgrind --leak-check=full frida, use -O0 -fno-inline
 
diff --git a/pub/configure.ac b/pub/configure.ac
index 5d744123..f482228a 100644
--- a/pub/configure.ac
+++ b/pub/configure.ac
@@ -23,10 +23,15 @@ AM_MAINTAINER_MODE([disable]) # work around rebuild rules
 ##  Select compiler and preprocessors                                         ##
 ################################################################################
 
-AC_PROG_CXX
+# AC_PROG_CXX(["clang -D__float128=void -stdlib=libc++" g++])
+# clang:
+#  * -D__float128=void is workaround,
+#    see http://llvm.org/bugs/show_bug.cgi?id=13530#c3
+#  * linking with libc++ and libc++abi doesn't work
+#  * first convert to CMake ??
 AC_LANG(C++)
 AX_CXX_COMPILE_STDCXX_11 # provided in directory m4
-AC_SUBST(AM_CXXFLAGS,"-g -pedantic -Wall -Wno-sign-compare -Wno-unused-result -Werror")
+AC_SUBST(AM_CXXFLAGS,"-g -pedantic -Wall -Wno-sign-compare -Wno-unused-result -Wno-parentheses -Werror")
 # for valgrind --leak-check=full frida, use -O0 -fno-inline
 
 # source files that use -D settings must #include "../config.h"
diff --git a/pub/src/manip.cpp b/pub/src/manip.cpp
index 582538de..be225fc7 100644
--- a/pub/src/manip.cpp
+++ b/pub/src/manip.cpp
@@ -770,7 +770,7 @@ void NManip::ZExchange()
             num2 = iask( "exchange with coordinate" );
             if ( num2>=nzmax )
                 throw "no more than " + S(nzmax) + " z coordinates";
-            else if ( num1==num1 )
+            else if ( num1==num2 )
                 throw "nothing to exchange";
             mod = 'x';
             com = "exchanged z coordinates "+S(num1)+" and "+S(num2);
diff --git a/pub/src/xax_lex.lpp b/pub/src/xax_lex.lpp
index 63196a36..efd244b5 100644
--- a/pub/src/xax_lex.lpp
+++ b/pub/src/xax_lex.lpp
@@ -34,6 +34,7 @@ struct xaxtype {
     PRgr   rgr;
 };
 #define YYSTYPE xaxtype
+#define YY_NO_INPUT 1
 
 #define YY_DECL int xaxlex(YYSTYPE *xaxlval)
 %}
-- 
GitLab