Merge release-5-0 into master
authorTeemu Murtola <teemu.murtola@gmail.com>
Wed, 9 Jul 2014 05:02:21 +0000 (08:02 +0300)
committerTeemu Murtola <teemu.murtola@gmail.com>
Wed, 9 Jul 2014 05:02:21 +0000 (08:02 +0300)
Conflicts:
cmake/gmxCFlags.cmake (adjacent changes)

Change-Id: I45088d7b5256613971b9926fc5fa50511a2ed743

12 files changed:
CMakeLists.txt
CPackInit.cmake
cmake/TestFloatFormat.c
cmake/gmxCFlags.cmake
cmake/gmxTestCXX11.cmake
cmake/gmxTestFloatFormat.cmake
install-guide/CMakeLists.txt
src/gromacs/math/utilities.c
src/gromacs/selection/scanner.cpp
src/gromacs/selection/scanner.l
src/gromacs/selection/tests/selectioncollection.cpp
src/gromacs/utility/cstringutil.h

index 8810d30888ce597373d994f6ce6f8cf0b1b1943e..ca7094d156fa2e63b53170e0e133cf676b740782 100644 (file)
@@ -138,9 +138,13 @@ set(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_SOURCE_DIR}/admin/InstallWelcome.txt")
 # Its GPL/LGPL, so they do not have to agree to a license for mere usage, but some installers require this...
 set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
 set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/admin/InstallInfo.txt")
-set(CPACK_SOURCE_IGNORE_FILES "\\\\.isreposource$;\\\\.git/;\\\\.gitignore$")
+set(CPACK_SOURCE_IGNORE_FILES "\\\\.isreposource$;\\\\.git/;\\\\.gitignore$;\\\\.gitattributes;")
 set(CPACK_PROJECT_CONFIG_FILE "${CMAKE_SOURCE_DIR}/CPackInit.cmake")
-set(CPACK_SOURCE_INSTALLED_DIRECTORIES "${CMAKE_SOURCE_DIR};/;${CMAKE_BINARY_DIR}/src/programs/completion;src/programs/completion;${CMAKE_BINARY_DIR}/share/man/man1;share/man/man1;${CMAKE_BINARY_DIR}/share/man/man7;share/man/man7;${CMAKE_BINARY_DIR}/share/html/final;share/html/final")
+# CPack source archives include only the directories we list here.
+# This variable is a list of pairs of names of source and destination
+# directories. Most of these are used for content GROMACS generates as
+# part of the configuration or build.
+set(CPACK_SOURCE_INSTALLED_DIRECTORIES "${CMAKE_SOURCE_DIR};/;${CMAKE_BINARY_DIR}/src/programs/completion;src/programs/completion;${CMAKE_BINARY_DIR}/share/man/man1;share/man/man1;${CMAKE_BINARY_DIR}/share/man/man7;share/man/man7;${CMAKE_BINARY_DIR}/share/html/final;share/html/final;${CMAKE_BINARY_DIR}/install-guide/final;/")
 set(CPACK_PACKAGE_CONTACT "gmx-users@gromacs.org")
 
 #must come after all cpack settings!
index 779124f2a1c255226d19378e3b5f11c074a653e6..7d3985f99450122b22e1ebe9ecdbe2788fc3c17a 100644 (file)
 if(CPACK_SOURCE_PACKAGE_FILE_NAME) #building source package
     get_filename_component(CMAKE_BINARY_DIR ${CPACK_OUTPUT_CONFIG_FILE} PATH)
     if (NOT EXISTS "${CMAKE_BINARY_DIR}/share/man/man1/gmx-view.1" OR
-        NOT EXISTS "${CMAKE_BINARY_DIR}/INSTALL" OR
-        NOT EXISTS "${CMAKE_BINARY_DIR}/share/html/final/online.html")
+        NOT EXISTS "${CMAKE_BINARY_DIR}/install-guide/final/INSTALL" OR
+        NOT EXISTS "${CMAKE_BINARY_DIR}/share/html/final/online.html" OR
+        NOT EXISTS "${CMAKE_BINARY_DIR}/src/programs/completion/gmx-completion.bash" OR
+        NOT EXISTS "${CMAKE_BINARY_DIR}/share/html/final/programs/gmx-view.html")
         message(FATAL_ERROR
-            "To create a complete source package all man and HTML pages need "
-            "to be generated, and the INSTALL file generated. "
-            "Run 'make man html' to build these parts. You can also set "
-            "GMX_BUILD_HELP=ON to automatically build the HTML parts. "
-            "The latter also requires you to execute 'make install-guide'.")
+            "To create a complete source package, bash completions, "
+            "man and HTML pages, and INSTALL need to be generated. "
+            "Run 'make completion man html install-guide' to build "
+            "these parts. You can also configure with "
+            "GMX_BUILD_HELP=ON to automatically build the HTML parts.")
     endif()
 endif()
index 7467f805a6b5cc4ebc47bfb5d39e19059e1d913a..d0676d5dfa7eb0bde37309de2c721cc9df32e9b0 100644 (file)
@@ -3,8 +3,10 @@ main()
 {
   /* Check that a double is 8 bytes - compilation dies if it isnt */
   extern char xyz [sizeof(double) == 8 ? 1 : -1];
+  int i;
+  double d;
 
-  double abc [] = {
+  double abc [10] = {
     /* Zero-terminated strings encoded as floating-point numbers */
     /* "GROMACSX" in ascii    */
     (double)  3.80279098314984902657e+35 , (double) 0.0,
@@ -18,5 +20,13 @@ main()
     (double) -5.22995989424860458374e+10 , (double) 0.0,
   };
 
-  return 0;
+  /* Make sure some compilers do not optimize away the entire structure
+   * with floating-point data by using it to produce a return value.
+   */
+  for(i=0,d=0;i<10;i++)
+  {
+    d+=abc[i];
+  }
+
+  return (d==12345.0);
 }
index d779a2cb583d1ffe60b3399b5f468b1c054b0881..4521a8aa0281f0908d27833d2b02d5e920a31baa 100644 (file)
@@ -110,6 +110,9 @@ MACRO(gmx_c_flags)
         # Since 4.8 on by default. For previous version disabling is a no-op. Only disabling for Release because with assert
         # the warnings are OK.
         GMX_TEST_CFLAG(CFLAGS_WARN_REL "-Wno-array-bounds" GMXC_CFLAGS_RELEASE_ONLY)
+        if(CYGWIN)
+            GMX_TEST_CFLAG(CFLAGS_WARN_SUBSCRIPT "-Wno-char-subscripts" GMXC_CFLAGS)
+        endif()
         # new in gcc 4.5
         GMX_TEST_CFLAG(CFLAGS_EXCESS_PREC "-fexcess-precision=fast" GMXC_CFLAGS_RELEASE)
         GMX_TEST_CFLAG(CFLAGS_COPT "-funroll-all-loops"
index fdcc07f591bd822a53a584eec73440d44df4c2ef..eaa8888e48adaac75fec32ac6e292130000ceccb 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2012,2013, by the GROMACS development team, led by
+# Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
 # and including many others, as listed in the AUTHORS file in the
 # top-level source directory and at http://www.gromacs.org.
 
 include(CheckCXXSourceCompiles)
 MACRO(GMX_TEST_CXX11 VARIABLE FLAG)
-    if(NOT WIN32)
-        set(CXX11_FLAG "-std=c++0x")
-    else()
+    if(WIN32)
         set(CXX11_FLAG "/Qstd=c++0x")
+    elseif(CYGWIN)
+        set(CXX11_FLAG "-std=gnu++0x") #required for strdup
+    else()
+        set(CXX11_FLAG "-std=c++0x")
     endif()
     CHECK_CXX_COMPILER_FLAG("${CXX11_FLAG}" CXXFLAG_STD_CXX0X)
     if(NOT CXXFLAG_STD_CXX0X)
index 00671573fc875732032f309c6718ba06d209cbe3..e20c49d8c4f8a37946f69345311a3437f40ad945 100644 (file)
@@ -104,6 +104,7 @@ MACRO(GMX_TEST_FLOAT_FORMAT FP_IEEE754 FP_BIG_ENDIAN_BYTE FP_BIG_ENDIAN_WORD)
             MESSAGE(STATUS "Checking floating point format - IEEE754 (LE byte, LE word)")
         else()
             MESSAGE(STATUS "Checking floating point format - unknown")
+            MESSAGE(WARNING "Cannot detect your floating-point format. It is extremely unlikely to be anything else than IEEE754, but if we do not know the endian we need to rely on your OS providing the math functions erfd() and erfcd() rather than using our built-in ones.")
         endif()
     ENDIF()
 ENDMACRO(GMX_TEST_FLOAT_FORMAT FP_IEEE754 FP_BIG_ENDIAN_BYTE FP_BIG_ENDIAN_WORD)
index a54d82cd148a1a21114aa5913f3db3fd60f70a8e..fb5faaa7e0e3f6dd44c2dfa71fa86478f3da098c 100644 (file)
@@ -68,10 +68,13 @@ if(INSTALL_GUIDE_BUILD_IS_POSSIBLE)
         VERBATIM
         )
 
-    # Make the INSTALL file for CPack for the tarball
+    # Make the INSTALL file for CPack for the tarball. This gets put
+    # into the tarball via the CPack rules in the top-level
+    # CMakeLists.txt
     add_custom_command(
-        OUTPUT ${CMAKE_BINARY_DIR}/INSTALL
-        COMMAND pandoc -t plain -o ../INSTALL install-guide.md
+        OUTPUT final/INSTALL
+        COMMAND ${CMAKE_COMMAND} -E make_directory final
+        COMMAND pandoc -t plain -o final/INSTALL install-guide.md
         DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/install-guide.md
         VERBATIM
         )
@@ -80,7 +83,7 @@ if(INSTALL_GUIDE_BUILD_IS_POSSIBLE)
     add_custom_target(install-guide
         DEPENDS
            ${CMAKE_CURRENT_BINARY_DIR}/install-guide.html
-           ${CMAKE_BINARY_DIR}/INSTALL
+           final/INSTALL
         VERBATIM
         )
 endif()
index 3babac712453991eceb5cf2f74492434d3a76516..962c08cc5c49f79681c9d9adcdfb3b825293dffd 100644 (file)
@@ -171,6 +171,7 @@ static const double
 
 double gmx_erfd(double x)
 {
+#ifdef GMX_FLOAT_FORMAT_IEEE754
     gmx_int32_t hx, ix, i;
     double      R, S, P, Q, s, y, z, r;
 
@@ -276,11 +277,16 @@ double gmx_erfd(double x)
     {
         return r/x-one;
     }
+#else
+    /* No IEEE754 information. We need to trust that the OS provides erf(). */
+    return erf(x);
+#endif
 }
 
 
 double gmx_erfcd(double x)
 {
+#ifdef GMX_FLOAT_FORMAT_IEEE754
     gmx_int32_t hx, ix;
     double      R, S, P, Q, s, y, z, r;
 
@@ -401,6 +407,10 @@ double gmx_erfcd(double x)
             return two-tiny;
         }
     }
+#else
+    /* No IEEE754 information. We need to trust that the OS provides erfc(). */
+    return erfc(x);
+#endif
 }
 
 
index c71d736329649bee5ce6e588a2e25b5a520f1e79..ca91e29742d56c6d3b8ede5bd184f94df2808f7c 100644 (file)
@@ -379,7 +379,7 @@ static yyconst flex_int16_t yy_accept[76] =
 static yyconst flex_int32_t yy_ec[256] =
     {   0,
         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        2,    2,    2,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    2,    4,    5,    6,    1,    1,    7,    1,    1,
         1,    1,    8,    1,    8,    9,    1,   10,   10,   10,
@@ -418,14 +418,14 @@ static yyconst flex_int32_t yy_meta[33] =
 
 static yyconst flex_int16_t yy_base[80] =
     {   0,
-        0,    0,   89,   88,   10,   12,    0,    0,  111,  114,
-      108,  114,   96,   32,    0,  101,   97,   29,  114,   93,
-       92,    0,  101,   94,   79,   75,   76,   73,   74,   73,
-       64,   19,   71,   29,   74,   91,  114,   37,  114,   87,
-        0,  114,   36,   44,   48,   82,   52,    0,  114,   71,
-       65,   60,    0,    0,   61,  114,    0,   58,   64,    0,
-       57,   57,   73,   60,    0,   53,    0,    0,    0,   71,
-       66,   62,   41,    0,  114,   70,   74,   76,   43
+        0,    0,   93,   92,   10,   12,    0,    0,  115,  118,
+       35,   37,  101,   37,    0,  106,  102,   35,  118,   98,
+       97,    0,  106,   99,   84,   80,   81,   78,   79,   78,
+       69,   25,   76,   26,   79,   54,  118,   43,  118,   93,
+        0,  118,   48,   50,   52,   88,   65,    0,  118,   77,
+       71,   66,    0,    0,   67,  118,    0,   64,   70,    0,
+       63,   56,   79,   67,    0,   59,    0,    0,    0,   73,
+       69,   61,   44,    0,  118,   77,   81,   83,   50
     } ;
 
 static yyconst flex_int16_t yy_def[80] =
@@ -440,44 +440,44 @@ static yyconst flex_int16_t yy_def[80] =
        75,   75,   79,   79,    0,   75,   75,   75,   75
     } ;
 
-static yyconst flex_int16_t yy_nxt[147] =
+static yyconst flex_int16_t yy_nxt[151] =
     {   0,
        10,   11,   12,   13,   14,   15,   16,   10,   17,   18,
        19,   20,   21,   22,   22,   23,   24,   25,   22,   22,
        22,   26,   27,   28,   22,   22,   22,   29,   22,   30,
-       22,   31,   33,   34,   33,   34,   39,   44,   45,   57,
-       35,   39,   35,   47,   53,   43,   48,   40,   47,   59,
-       62,   60,   40,   43,   53,   62,   44,   45,   62,   63,
-       75,   64,   47,   62,   70,   74,   71,   47,   75,   64,
-       38,   72,   38,   38,   41,   71,   41,   41,   46,   46,
-       71,   73,   72,   60,   69,   67,   68,   67,   66,   65,
-       75,   38,   36,   61,   58,   56,   55,   54,   53,   52,
-
-       51,   50,   75,   49,   37,   37,   43,   42,   37,   36,
-       75,   32,   32,    9,   75,   75,   75,   75,   75,   75,
+       22,   31,   33,   34,   33,   34,   36,   36,   36,   36,
+       35,   39,   35,   44,   45,   57,   59,   39,   60,   47,
+       53,   53,   40,   48,   47,   36,   36,   43,   40,   43,
+       44,   45,   62,   70,   62,   71,   47,   62,   74,   62,
+       72,   47,   63,   75,   64,   75,   64,   38,   71,   38,
+       38,   41,   71,   41,   41,   46,   46,   73,   72,   60,
+       69,   67,   68,   67,   66,   65,   75,   38,   61,   58,
+
+       56,   55,   54,   53,   52,   51,   50,   75,   49,   37,
+       37,   43,   42,   37,   75,   32,   32,    9,   75,   75,
        75,   75,   75,   75,   75,   75,   75,   75,   75,   75,
        75,   75,   75,   75,   75,   75,   75,   75,   75,   75,
-       75,   75,   75,   75,   75,   75
+       75,   75,   75,   75,   75,   75,   75,   75,   75,   75
     } ;
 
-static yyconst flex_int16_t yy_chk[147] =
+static yyconst flex_int16_t yy_chk[151] =
     {   0,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    5,    5,    6,    6,   14,   18,   18,   32,
-        5,   38,    6,   18,   32,   43,   79,   14,   18,   34,
-       43,   34,   38,   44,   34,   43,   45,   45,   44,   47,
-       47,   47,   45,   44,   62,   73,   62,   45,   64,   64,
-       76,   72,   76,   76,   77,   71,   77,   77,   78,   78,
-       70,   66,   63,   61,   59,   58,   55,   52,   51,   50,
-       46,   40,   36,   35,   33,   31,   30,   29,   28,   27,
-
-       26,   25,   24,   23,   21,   20,   17,   16,   13,   11,
-        9,    4,    3,   75,   75,   75,   75,   75,   75,   75,
+        1,    1,    5,    5,    6,    6,   11,   11,   12,   12,
+        5,   14,    6,   18,   18,   32,   34,   38,   34,   18,
+       32,   34,   14,   79,   18,   36,   36,   43,   38,   44,
+       45,   45,   43,   62,   44,   62,   45,   43,   73,   44,
+       72,   45,   47,   47,   47,   64,   64,   76,   71,   76,
+       76,   77,   70,   77,   77,   78,   78,   66,   63,   61,
+       59,   58,   55,   52,   51,   50,   46,   40,   35,   33,
+
+       31,   30,   29,   28,   27,   26,   25,   24,   23,   21,
+       20,   17,   16,   13,    9,    4,    3,   75,   75,   75,
        75,   75,   75,   75,   75,   75,   75,   75,   75,   75,
        75,   75,   75,   75,   75,   75,   75,   75,   75,   75,
-       75,   75,   75,   75,   75,   75
+       75,   75,   75,   75,   75,   75,   75,   75,   75,   75
     } ;
 
 /* The intent behind this definition is that it'll catch
@@ -1004,6 +1004,7 @@ YY_RULE_SETUP
 { return _gmx_sel_lexer_process_identifier(yylval, yytext, yyleng, state); }
        YY_BREAK
 case 18:
+/* rule 18 can match eol */
 YY_RULE_SETUP
 #line 160 "scanner.l"
 { _gmx_sel_lexer_add_token(" ", 1, state); }
@@ -1023,7 +1024,7 @@ YY_RULE_SETUP
 #line 163 "scanner.l"
 YY_FATAL_ERROR( "flex scanner jammed" );
        YY_BREAK
-#line 1027 "scanner.cpp"
+#line 1028 "scanner.cpp"
 
        case YY_END_OF_BUFFER:
                {
index c01aac26d0f164f197f7c835ac8389e7bd6dc23f..abbeb04d6c8e96571b1cc30e1598bcf6dfe84d36 100644 (file)
@@ -157,6 +157,6 @@ not|"!"         { ADD_TOKEN; return NOT; }
 
 {IDENTIFIER}    { return _gmx_sel_lexer_process_identifier(yylval, yytext, yyleng, state); }
 
-[[:blank:]]+    { _gmx_sel_lexer_add_token(" ", 1, state); }
+[[:space:]]+    { _gmx_sel_lexer_add_token(" ", 1, state); }
 [_[:alnum:]]+   { yylval->str = gmx_strndup(yytext, yyleng); ADD_TOKEN; return STR; }
 .               { ADD_TOKEN; return yytext[0]; }
index 7a22779ef2f0037bfc97ffa7394e66dce4fe94b4..713394e26c5c4831ad06c5298697b98d3a23609e 100644 (file)
@@ -417,6 +417,15 @@ TEST_F(SelectionCollectionTest, ParsesSelectionsFromFile)
     EXPECT_STREQ("resname RB RC", sel_[1].selectionText());
 }
 
+TEST_F(SelectionCollectionTest, HandlesAtypicalWhitespace)
+{
+    ASSERT_NO_THROW_GMX(sel_ = sc_.parseFromString("atomnr\n1\r\nto\t10;\vatomnr 3\f to 14\r"));
+    ASSERT_EQ(2U, sel_.size());
+    EXPECT_STREQ("atomnr 1 to 10", sel_[0].selectionText());
+    // TODO: Get rid of the trailing whitespace.
+    EXPECT_STREQ("atomnr 3 to 14 ", sel_[1].selectionText());
+}
+
 TEST_F(SelectionCollectionTest, HandlesInvalidRegularExpressions)
 {
     ASSERT_NO_FATAL_FAILURE(loadTopology("simple.gro"));
index bfd1d6f0adbabd7d08dfbbfea369a301f0e67a4c..a8b7460e4a7f5a39d08e19bdaced6b33c2a84f73 100644 (file)
 
 #include "gmx_header_config.h"
 
-/* Suppress Cygwin compiler warnings from using newlib version of
- * ctype.h */
-#ifdef GMX_CYGWIN
-#include <ctype.h>
-
-#undef isdigit
-#undef isstring
-#undef isspace
-#undef isalnum
-#undef isalpha
-#undef ispunct
-#undef isxdigit
-#undef isupper
-#undef islower
-#undef toupper
-#undef tolower
-#endif
-
 #ifdef __cplusplus
 extern "C" {
 #endif