diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2015-09-21 20:05:23 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2015-09-21 20:05:23 (GMT) |
commit | 9edd184ae9771c83b3569f3411babdcdd4170b3e (patch) | |
tree | ff055ff74688957e2dc75ddd60629f5d2c5d81b1 /config | |
parent | 0e4ee6d829d658af60ec21ea57138e6607f2ace6 (diff) | |
download | hdf5-9edd184ae9771c83b3569f3411babdcdd4170b3e.zip hdf5-9edd184ae9771c83b3569f3411babdcdd4170b3e.tar.gz hdf5-9edd184ae9771c83b3569f3411babdcdd4170b3e.tar.bz2 |
[svn-r27846] Fix generated files process.
Add script for post processing of flex/bison files.
Diffstat (limited to 'config')
-rw-r--r-- | config/cmake/HDF5Macros.cmake | 71 | ||||
-rw-r--r-- | config/cmake/HDF5_Process_Flex_Files.cmake | 81 | ||||
-rw-r--r-- | config/cmake/cacheinit.cmake | 2 | ||||
-rw-r--r-- | config/cmake/mccacheinit.cmake | 2 | ||||
-rw-r--r-- | config/cmake/userblockTest.cmake | 8 |
5 files changed, 85 insertions, 79 deletions
diff --git a/config/cmake/HDF5Macros.cmake b/config/cmake/HDF5Macros.cmake index 9b36f53..bd86f34 100644 --- a/config/cmake/HDF5Macros.cmake +++ b/config/cmake/HDF5Macros.cmake @@ -39,75 +39,4 @@ macro (H5_SET_LIB_OPTIONS libtarget libname libtype) endif (${libtype} MATCHES "SHARED") endif (HDF5_BUILD_FRAMEWORKS) endif (APPLE) - endmacro (H5_SET_LIB_OPTIONS) - -macro (H5_GEN_PERL_FILES) - find_package (Perl) - if (PERL_FOUND) - add_custom_command ( - OUTPUT ${HDF5_BINARY_DIR}/H5Edefin.h - PRE_BUILD - COMMAND ${PERL_EXECUTABLE} - ARGS ${HDF5_SOURCE_DIR}/bin/make_err ${HDF5_SOURCE_DIR}/src/H5err.txt - DEPENDS ${HDF5_SOURCE_DIR}/src/H5err.txt - COMMENT " Creating err header" - ) - - add_custom_command ( - OUTPUT ${HDF5_BINARY_DIR}/H5version.h - PRE_BUILD - COMMAND ${PERL_EXECUTABLE} - ARGS ${HDF5_SOURCE_DIR}/bin/make_vers ${HDF5_SOURCE_DIR}/src/H5vers.txt - DEPENDS ${HDF5_SOURCE_DIR}/src/H5vers.txt - COMMENT " Creating API version macro" - ) - - add_custom_command ( - OUTPUT ${HDF5_BINARY_DIR}/H5overflow.h - PRE_BUILD - COMMAND ${PERL_EXECUTABLE} - ARGS ${HDF5_SOURCE_DIR}/bin/make_overflow ${HDF5_SOURCE_DIR}/src/H5overflow.txt - DEPENDS ${HDF5_SOURCE_DIR}/src/H5overflow.txt - COMMENT " Creating Assignment overflow macro" - ) - - add_custom_target(run_perl_scripts ALL - DEPENDS ${HDF5_BINARY_DIR}/H5Edefin.h ${HDF5_BINARY_DIR}/H5version.h ${HDF5_BINARY_DIR}/H5overflow.h - ) - else (PERL_FOUND) - message (STATUS "Cannot generate headers - perl not found") - endif (PERL_FOUND) -endmacro (H5_GEN_PERL_FILES) - -macro (H5_GEN_FLEX_FILES) - find_package (BISON) - if (BISON_FOUND) - find_package (FLEX) - if (FLEX_FOUND) - BISON_TARGET (H5LT_PARSER H5LTparse.y ${CMAKE_CURRENT_BINARY_DIR}/H5LTparse.c COMPILE_FLAGS -d) - if (WIN32) - FLEX_TARGET (H5LT_SCANNER H5LTanalyze.l ${CMAKE_CURRENT_BINARY_DIR}/H5LTanalyze.c COMPILE_FLAGS --wincompat) - else (WIN32) - FLEX_TARGET (H5LT_SCANNER H5LTanalyze.l ${CMAKE_CURRENT_BINARY_DIR}/H5LTanalyze.c) - endif (WIN32) - ADD_FLEX_BISON_DEPENDENCY(H5LT_SCANNER H5LT_PARSER) - - if (BISON_H5LT_PARSER_DEFINED AND FLEX_H5LT_SCANNER_DEFINED) - set_source_files_properties (${FLEX_H5LT_SCANNER_OUTPUTS} - PROPERTIES OBJECT_DEPENDS ${BISON_H5LT_PARSER_OUTPUTS}) - set (HL_SRCS - ${BISON_H5LT_PARSER_OUTPUTS} - ${FLEX_H5LT_SCANNER_OUTPUTS} - ) - include_directories(${CMAKE_CURRENT_BINARY_DIR}) - else (BISON_H5LT_PARSER_DEFINED AND FLEX_H5LT_SCANNER_DEFINED) - message (STATUS "Error during generate of files") - endif (BISON_H5LT_PARSER_DEFINED AND FLEX_H5LT_SCANNER_DEFINED) - else (FLEX_FOUND) - message (STATUS "Cannot generate files - flex not found") - endif (FLEX_FOUND) - else (BISON_FOUND) - message (STATUS "Cannot generate files - bison not found") - endif (BISON_FOUND) -endmacro (H5_GEN_FLEX_FILES) diff --git a/config/cmake/HDF5_Process_Flex_Files.cmake b/config/cmake/HDF5_Process_Flex_Files.cmake new file mode 100644 index 0000000..da1a842 --- /dev/null +++ b/config/cmake/HDF5_Process_Flex_Files.cmake @@ -0,0 +1,81 @@ +# post process flex/bison files + +message (STATUS "File: ${FILE_PARSE} ${FILE_ANALYZE}") + +if (FILE_PARSE) + # fix H5LTparse.c to declare H5LTyyparse return type as an hid_t + # instead of int. Currently the generated function H5LTyyparse is + # generated with a return value of type int, which is a mapping to the + # flex yyparse function. The return value in the HL library should be + # an hid_t. + # I propose to not use flex to generate this function, but for now I am + # adding a perl command to find and replace this function declaration in + # H5LTparse.c. + file (READ ${FILE_PARSE} TEST_STREAM) + string (REGEX REPLACE "int\nyyparse" "hid_t\nyyparse" TEST_STREAM "${TEST_STREAM}") + string (REGEX REPLACE "int H5LTyyparse" "hid_t H5LTyyparse" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${FILE_PARSE} "${TEST_STREAM}") + message (STATUS "replacing signature in H5LTparse.c") + + # Add code that disables warnings in the flex/bison-generated code. + # + # Note that the GCC pragmas did not exist until gcc 4.2. Earlier versions + # will simply ignore them, but we want to avoid those warnings. + file (READ ${FILE_PARSE} TEST_STREAM) + file (WRITE ${FILE_PARSE} " +#if __GNUC__ >= 4 && __GNUC_MINOR__ >=2\n +#pragma GCC diagnostic ignored \"-Wconversion\"\n +#pragma GCC diagnostic ignored \"-Wimplicit-function-declaration\"\n +#pragma GCC diagnostic ignored \"-Wlarger-than=\"\n +#pragma GCC diagnostic ignored \"-Wmissing-prototypes\"\n +#pragma GCC diagnostic ignored \"-Wnested-externs\"\n +#pragma GCC diagnostic ignored \"-Wold-style-definition\"\n +#pragma GCC diagnostic ignored \"-Wsign-compare\"\n +#pragma GCC diagnostic ignored \"-Wsign-conversion\"\n +#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"\n +#pragma GCC diagnostic ignored \"-Wswitch-default\"\n +#pragma GCC diagnostic ignored \"-Wunused-function\"\n +#pragma GCC diagnostic ignored \"-Wunused-macros\"\n +#pragma GCC diagnostic ignored \"-Wunused-parameter\"\n +#pragma GCC diagnostic ignored \"-Wredundant-decls\"\n +#elif defined __SUNPRO_CC\n +#pragma disable_warn\n +#elif defined _MSC_VER\n +#pragma warning(push, 1)\n +#endif\n + ") + file (APPEND ${FILE_PARSE} "${TEST_STREAM}") + message (STATUS "processing pragma in ${FILE_PARSE}") +endif (FILE_PARSE) + +if (FILE_ANALYZE) + # Add code that disables warnings in the flex/bison-generated code. + # + # Note that the GCC pragmas did not exist until gcc 4.2. Earlier versions + # will simply ignore them, but we want to avoid those warnings. + file (READ ${FILE_ANALYZE} TEST_STREAM) + file (WRITE ${FILE_ANALYZE} " +#if __GNUC__ >= 4 && __GNUC_MINOR__ >=2\n +#pragma GCC diagnostic ignored \"-Wconversion\"\n +#pragma GCC diagnostic ignored \"-Wimplicit-function-declaration\"\n +#pragma GCC diagnostic ignored \"-Wlarger-than=\"\n +#pragma GCC diagnostic ignored \"-Wmissing-prototypes\"\n +#pragma GCC diagnostic ignored \"-Wnested-externs\"\n +#pragma GCC diagnostic ignored \"-Wold-style-definition\"\n +#pragma GCC diagnostic ignored \"-Wsign-compare\"\n +#pragma GCC diagnostic ignored \"-Wsign-conversion\"\n +#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"\n +#pragma GCC diagnostic ignored \"-Wswitch-default\"\n +#pragma GCC diagnostic ignored \"-Wunused-function\"\n +#pragma GCC diagnostic ignored \"-Wunused-macros\"\n +#pragma GCC diagnostic ignored \"-Wunused-parameter\"\n +#pragma GCC diagnostic ignored \"-Wredundant-decls\"\n +#elif defined __SUNPRO_CC\n +#pragma disable_warn\n +#elif defined _MSC_VER\n +#pragma warning(push, 1)\n +#endif\n + ") + file (APPEND ${FILE_ANALYZE} "${TEST_STREAM}") + message (STATUS "processing pragma in ${FILE_ANALYZE}") +endif (FILE_ANALYZE) diff --git a/config/cmake/cacheinit.cmake b/config/cmake/cacheinit.cmake index e4ba880..4bef99f 100644 --- a/config/cmake/cacheinit.cmake +++ b/config/cmake/cacheinit.cmake @@ -8,8 +8,6 @@ set (CMAKE_INSTALL_FRAMEWORK_PREFIX "Library/Frameworks" CACHE STRING "Framework set (HDF_PACKAGE_EXT "" CACHE STRING "Name of HDF package extension" FORCE) -set (HDF5_GENERATE_HEADERS ON CACHE BOOL "Rebuild Generated Files" FORCE) - set (HDF5_BUILD_FORTRAN ON CACHE BOOL "Build FORTRAN support" FORCE) set (HDF5_BUILD_GENERATORS OFF CACHE BOOL "Build Test Generators" FORCE) diff --git a/config/cmake/mccacheinit.cmake b/config/cmake/mccacheinit.cmake index 7f981df..19ecc15 100644 --- a/config/cmake/mccacheinit.cmake +++ b/config/cmake/mccacheinit.cmake @@ -12,8 +12,6 @@ set (BUILD_TESTING ON CACHE BOOL "Build HDF5 Unit Testing" FORCE) set (HDF_PACKAGE_EXT "" CACHE STRING "Name of HDF package extension" FORCE) -set (HDF5_GENERATE_HEADERS ON CACHE BOOL "Rebuild Generated Files" FORCE) - set (HDF5_BUILD_CPP_LIB ON CACHE BOOL "Build HDF5 C++ Library" FORCE) set (HDF5_BUILD_EXAMPLES ON CACHE BOOL "Build HDF5 Library Examples" FORCE) diff --git a/config/cmake/userblockTest.cmake b/config/cmake/userblockTest.cmake index 2e0740b..fab470c 100644 --- a/config/cmake/userblockTest.cmake +++ b/config/cmake/userblockTest.cmake @@ -1,4 +1,4 @@ -# runTest.cmake executes a command and captures the output in a file. File is then compared +# userblockTest.cmake executes a command and captures the output in a file. File is then compared # against a reference file. Exit status of command can also be compared. # arguments checking @@ -56,9 +56,9 @@ if (TEST_CHECKUB STREQUAL "YES") endif (NOT ${TEST_RESULT} STREQUAL "0") file (READ ${TEST_HFILE}.len.txt TEST_O_STRING_LEN) endif (TEST_OFILE) - + MATH( EXPR TEST_STRING_SIZE "${TEST_U_STRING_LEN} + ${TEST_O_STRING_LEN}" ) - + if (NOT TEST_O_STRING_LEN STREQUAL "0") #$JAM_BIN/getub -c $s2 $origfile > $cmpfile EXECUTE_PROCESS ( @@ -72,7 +72,7 @@ if (TEST_CHECKUB STREQUAL "YES") ) #cat $ufile >> $cmpfile file (STRINGS ${TEST_UFILE} TEST_STREAM NEWLINE_CONSUME) - file (APPEND ${TEST_HFILE}-ub.cmp "${TEST_STREAM}") + file (APPEND ${TEST_HFILE}-ub.cmp "${TEST_STREAM}") else (NOT TEST_O_STRING_LEN STREQUAL "0") file (STRINGS ${TEST_UFILE} TEST_STREAM NEWLINE_CONSUME) file (WRITE ${TEST_HFILE}-ub.cmp ${TEST_STREAM}) |