Add checkAPI calls to CMake.
authorGraham Bloice <graham.bloice@trihedral.com>
Fri, 11 Mar 2016 19:51:39 +0000 (19:51 +0000)
committerGraham Bloice <graham.bloice@trihedral.com>
Mon, 2 May 2016 12:01:24 +0000 (12:01 +0000)
This generates a top level target, checkAPI, that is
excluded from the ALL build target, so must be run separately.

On Windows using a Visual Studio generator, call
msbuild /p:Configuration=RelWithDebInfo checkAPI.vcxproj

Change-Id: I44a57c564dcfc75499463b942436f4b920a82478
Reviewed-on: https://code.wireshark.org/review/14873
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
33 files changed:
CMakeLists.txt
capchild/CMakeLists.txt
caputils/CMakeLists.txt
cmake/modules/FindLEX.cmake
cmake/modules/FindYACC.cmake
cmake/modules/UseCheckAPI.cmake
cmake/modules/UseLemon.cmake
codecs/CMakeLists.txt
epan/CMakeLists.txt
epan/crypt/CMakeLists.txt
epan/dfilter/CMakeLists.txt
epan/dissectors/CMakeLists.txt
epan/ftypes/CMakeLists.txt
epan/wslua/CMakeLists.txt
plugins/docsis/CMakeLists.txt
plugins/ethercat/CMakeLists.txt
plugins/gryphon/CMakeLists.txt
plugins/irda/CMakeLists.txt
plugins/m2m/CMakeLists.txt
plugins/mate/CMakeLists.txt
plugins/opcua/CMakeLists.txt
plugins/profinet/CMakeLists.txt
plugins/stats_tree/CMakeLists.txt
plugins/unistim/CMakeLists.txt
plugins/wimax/CMakeLists.txt
plugins/wimaxasncp/CMakeLists.txt
plugins/wimaxmacphy/CMakeLists.txt
randpkt_core/CMakeLists.txt
tools/checkAPIs.pl
ui/CMakeLists.txt
ui/gtk/CMakeLists.txt
wiretap/CMakeLists.txt
wsutil/CMakeLists.txt

index 7706376e4ef7cbed440a14a1a0961497ad8f9104..07c7c1cd518ad2bf2c389fed8faa3b76142a84d2 100644 (file)
@@ -1017,6 +1017,15 @@ test_big_endian(WORDS_BIGENDIAN)
 
 set_property(GLOBAL PROPERTY USE_FOLDERS ON)
 
+# The top level checkAPIs target, add before subdirectory calls so it's avaiable to all
+add_custom_target(checkAPI)
+set_target_properties(checkAPI
+       PROPERTIES
+               FOLDER "Auxiliary"
+               EXCLUDE_FROM_ALL True
+               EXCLUDE_FROM_DEFAULT_BUILD True
+)
+
 add_subdirectory( capchild )
 add_subdirectory( caputils )
 add_subdirectory( codecs )
@@ -2166,10 +2175,10 @@ if(BUILD_text2pcap)
                ${text2pcap_CLEAN_FILES}
                ${CMAKE_BINARY_DIR}/image/text2pcap.rc
        )
-       add_lex_files(text2pcap_FILES
+       add_lex_files(text2pcap_LEX_FILES text2pcap_GENERATED_FILES
                text2pcap-scanner.l
        )
-       add_executable(text2pcap ${text2pcap_FILES})
+       add_executable(text2pcap ${text2pcap_FILES} ${text2pcap_GENERATED_FILES})
        add_dependencies(text2pcap version)
        set_extra_executable_properties(text2pcap "Executables")
        target_link_libraries(text2pcap ${text2pcap_LIBS})
@@ -2380,7 +2389,7 @@ if(ENABLE_EXTCAP AND BUILD_sshdump AND LIBSSH_FOUND)
                ${LIBSSH_LIBRARIES}
        )
        if (WIN32)
-               set(sshdump_LIBS wsutil ${sshdump_LIBS})
+               set(sshdump_LIBS wsutil ${sshdump_LIBS})
        endif()
        set(sshdump_FILES
                extcap/sshdump.c
@@ -2406,7 +2415,7 @@ if(ENABLE_EXTCAP AND BUILD_ciscodump AND LIBSSH_FOUND)
                ${LIBSSH_LIBRARIES}
        )
        if (WIN32)
-               set(ciscodump_LIBS wsutil ${ciscodump_LIBS})
+               set(ciscodump_LIBS wsutil ${ciscodump_LIBS})
        endif()
        set(ciscodump_FILES
                extcap/ciscodump.c
@@ -2553,12 +2562,6 @@ install(
        PATTERN "faq.py" EXCLUDE
 )
 
-include( UseCheckAPI )
-CHECKAPI(
-       ${TSHARK_TAP_SRC}
-       ${WIRESHARK_SRC}
-)
-
 set(CMAKE_INSTALL_MODULES_DIR ${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME})
 configure_file("${CMAKE_MODULE_PATH}/WiresharkConfig.cmake.in" "${CMAKE_BINARY_DIR}/WiresharkConfig.cmake" @ONLY)
 configure_file("${CMAKE_MODULE_PATH}/WiresharkConfigVersion.cmake.in" "${CMAKE_BINARY_DIR}/WiresharkConfigVersion.cmake" @ONLY)
@@ -2660,6 +2663,17 @@ else ()
        endif()
 endif()
 
+include( UseCheckAPI )
+CHECKAPI(
+       NAME
+         main
+       SWITCHES
+         -build
+       SOURCES
+         ${WIRESHARK_SRC}
+         ${TSHARK_TAP_SRC}
+)
+
 #
 # Editor modelines  -  http://www.wireshark.org/tools/modelines.html
 #
index 64b6edeb700d75eba1c21511d3a6031c2cfd8100..1689d0e61e9f7ff8eb54b81bed4ee16723722767 100644 (file)
@@ -1,4 +1,5 @@
 # CMakeLists.txt
+
 #
 # Wireshark - Network traffic analyzer
 # By Gerald Combs <gerald@wireshark.org>
@@ -46,3 +47,21 @@ add_library(capchild STATIC
 set_target_properties(capchild PROPERTIES
        LINK_FLAGS "${WS_LINK_FLAGS}"
        FOLDER "Libs")
+
+include( UseCheckAPI )
+CHECKAPI(
+       NAME
+         capchild-base
+       SWITCHES
+         -g deprecated-gtk
+       SOURCES
+         ${CAPCHILD_SRC}
+)
+CHECKAPI(
+       NAME
+         capchild-todo
+       SWITCHES
+         -M -g deprecated-gtk-todo
+       SOURCES
+         ${CAPCHILD_SRC}
+)
index 4f6a9ef1305b909dd840042705b90bf184e4009d..21722c434e9ca8596e1bb0a9bfdf668709390bf5 100644 (file)
@@ -68,3 +68,20 @@ add_library(caputils STATIC
 set_target_properties(caputils PROPERTIES
        LINK_FLAGS "${WS_LINK_FLAGS}"
        FOLDER "Libs")
+
+CHECKAPI(
+       NAME
+         caputils-base
+       SWITCHES
+         -g deprecated-gtk
+       SOURCES
+         ${CAPUTILS_SRC}
+)
+CHECKAPI(
+       NAME
+         caputils-todo
+       SWITCHES
+         -M -g deprecated-gtk-todo
+       SOURCES
+         ${CAPUTILS_SRC}
+)
index ec53b04acd212d7ec460efda115ca637aad55ec2..adeb75c07af4c089d3acea3fbc1bf57f03866a05 100644 (file)
@@ -26,7 +26,7 @@ MARK_AS_ADVANCED(LEX_EXECUTABLE)
 
 # flex a .l file
 
-MACRO(ADD_LEX_FILES _source)
+MACRO(ADD_LEX_FILES _source _generated)
     FOREACH (_current_FILE ${ARGN})
       GET_FILENAME_COMPONENT(_in ${_current_FILE} ABSOLUTE)
       GET_FILENAME_COMPONENT(_basename ${_current_FILE} NAME_WE)
@@ -41,7 +41,8 @@ MACRO(ADD_LEX_FILES _sources )
           ${_in}
         DEPENDS ${_in}
       )
-      SET(${_sources} ${${_sources}} ${_outc} )
+      LIST(APPEND ${_source} ${_in})
+      LIST(APPEND ${_generated} ${_outc})
       INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
       INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
     ENDFOREACH (_current_FILE)
index 672a780e7db8d1ea3536a18dc46a31efbfe435c2..dca1c09fa81a816cd6991d465f556b5c82649c3a 100644 (file)
@@ -24,7 +24,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(YACC DEFAULT_MSG YACC_EXECUTABLE)
 
 MARK_AS_ADVANCED(YACC_EXECUTABLE)
 
-MACRO(ADD_YACC_FILES _source)
+MACRO(ADD_YACC_FILES _source _generated)
     FOREACH (_current_FILE ${ARGN})
       GET_FILENAME_COMPONENT(_in ${_current_FILE} ABSOLUTE)
       GET_FILENAME_COMPONENT(_basename ${_current_FILE} NAME_WE)
@@ -40,7 +40,8 @@ MACRO(ADD_YACC_FILES _sources )
            ${_in}
          DEPENDS ${_in}
       )
-      SET(${_sources} ${${_sources}} ${_out} )
+      LIST(APPEND ${_source} ${_in})
+      LIST(APPEND ${_generated} ${_out})
    ENDFOREACH (_current_FILE)
 ENDMACRO(ADD_YACC_FILES)
 
index 334f5054a5ba3c22b3f3145827bcc3eda6ab06b4..1518fb4fe872a058ac6c08fa7730adf910b0a303 100644 (file)
@@ -1,17 +1,41 @@
+# Add a target to call checkAPIs.pl on the specified source files
+# The target is excluded from the ALL targte so must be manually
+# specified in a build command.
+# The target is added to the top-level checkAPIs target
 #
+# Parameters:
+#   NAME:      The name of the target, must be unique
+#   SWITCHES:  Switches to be supplied to the script
+#   SOURCES:   The sources to be checked
+
+include(CMakeParseArguments)
+
 macro( CHECKAPI )
-       set( _sources ${ARGN} )
+       cmake_parse_arguments(CHECKAPI "DEBUG" "" "NAME;SWITCHES;SOURCES" ${ARGN} )
+
+       if (CHECKAPI_UNPARSED_ARGUMENTS)
+               message(FATAL_ERROR "CHECKAPIS Unknown argument: ${CHECKAPI_UNPARSED_ARGUMENTS}")
+       endif()
 
-       ADD_CUSTOM_TARGET(checkapi
+       if( CHECKAPI_DEBUG )
+               set (CHECKAPI_SWITCHES ${CHECKAPI_SWITCHES --debug)
+       endif()
+
+       set(TARGET_NAME checkAPI_${CHECKAPI_NAME})
+       add_custom_target(${TARGET_NAME}
                COMMAND ${PERL_EXECUTABLE}
                  ${CMAKE_SOURCE_DIR}/tools/checkAPIs.pl
-                 -build
-                 ${_sources}
+                 ${CHECKAPI_SWITCHES}
+                 ${CHECKAPI_SOURCES}
                WORKING_DIRECTORY
-                 ${CMAKE_SOURCE_DIR}
-               DEPENDS
-                 ${CMAKE_SOURCE_DIR}/tools/checkAPIs.pl
-                 ${_sources}
+                 ${CMAKE_CURRENT_SOURCE_DIR}
+               COMMENT
+                 "Running ${TARGET_NAME}"
+       )
+       add_dependencies(checkAPI ${TARGET_NAME})
+       set_target_properties(${TARGET_NAME}
+               PROPERTIES FOLDER "Auxiliary/CheckAPIs"
+               EXCLUDE_FROM_ALL True
+               EXCLUDE_FROM_DEFAULT_BUILD True
        )
-       set_target_properties(checkapi PROPERTIES FOLDER "Auxiliary")
 ENDMACRO()
index 6e97144d126b35c4a420b611a81afa1597715561..9332b151f6b84d3e446477c4aeb9371517f74ddc 100644 (file)
@@ -1,5 +1,5 @@
 #
-MACRO(ADD_LEMON_FILES _source)
+MACRO(ADD_LEMON_FILES _source _generated)
     set(_lemonpardir ${CMAKE_SOURCE_DIR}/tools/lemon)
     FOREACH (_current_FILE ${ARGN})
       GET_FILENAME_COMPONENT(_in ${_current_FILE} ABSOLUTE)
@@ -22,6 +22,7 @@ MACRO(ADD_LEMON_FILES _sources )
            ${_lemonpardir}/lempar.c
       )
 
-      SET(${_sources} ${${_sources}} ${_out}.c )
+      LIST(APPEND ${_source} ${_in})
+      LIST(APPEND ${_generated} ${_out}.c)
    ENDFOREACH (_current_FILE)
 ENDMACRO(ADD_LEMON_FILES)
index 4cdc2598ed51cf92f129425ca20ac0956dc6f388..3981a863cc01ccbc4eceba5683b9ad4e40cdf0a0 100644 (file)
@@ -81,3 +81,12 @@ if(NOT ${ENABLE_STATIC})
     ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
   )
 endif()
+
+CHECKAPI(
+       NAME
+         codecs
+       SWITCHES
+         -g abort -g termoutput -build
+       SOURCES
+         ${WSCODECS_FILES}
+)
index 4c7d375e12befb5b45617f7c3321aae0334cd995..fec80d289a71cdefbeb2b639c562cb1959c72ad3 100644 (file)
@@ -175,7 +175,7 @@ set(LIBWIRESHARK_CLEAN_FILES
        ${LIBWIRESHARK_FILES}
 )
 
-add_lex_files(LIBWIRESHARK_FILES
+add_lex_files(LEX_FILES GENERATED_FILES
        diam_dict.l
        dtd_parse.l
        dtd_preparse.l
@@ -183,7 +183,7 @@ add_lex_files(LIBWIRESHARK_FILES
        uat_load.l
 )
 
-add_lemon_files(LIBWIRESHARK_FILES
+add_lemon_files(LEMON_FILES GENERATED_FILES
        dtd_grammar.lemon
 )
 
@@ -219,6 +219,7 @@ endif()
 
 add_library(epan ${LINK_MODE_LIB}
        ${LIBWIRESHARK_FILES}
+       ${GENERATED_FILES}
        ${COMPRESS_FILES}
        ${LIBWIRESHARK_ASM_FILES}
        $<TARGET_OBJECTS:crypt>
@@ -341,6 +342,18 @@ set_target_properties(tvbtest PROPERTIES
        COMPILE_DEFINITIONS "WS_BUILD_DLL"
 )
 
+# Commented out as per nmake
+#CHECKAPI(
+#      NAME
+#        epan
+#      SWITCHES
+#        -g termoutput -build
+#      SOURCES
+#        ${LIBWIRESHARK_FILES}
+#        ${LEX_FILES}
+#        ${LEMON_FILES}
+#)
+
 #
 # Editor modelines  -  http://www.wireshark.org/tools/modelines.html
 #
index de05ad62c4a6b06e67b827d1c06d472c87182467..b32d7f6bccd40054a314fead7b7c5605e07fec94 100644 (file)
@@ -53,6 +53,15 @@ set_target_properties(crypt PROPERTIES
        COMPILE_DEFINITIONS "WS_BUILD_DLL"
 )
 
+CHECKAPI(
+       NAME
+         crypt
+       SWITCHES
+         -g termoutput -build
+       SOURCES
+         ${CRYPT_FILES}
+)
+
 #
 # Editor modelines  -  http://www.wireshark.org/tools/modelines.html
 #
index 0b59c34f7bc2b660b2a1d30d449c8fb4a8cc70b6..102724921b04ccab521047e71e32a9d0a6127e39 100644 (file)
@@ -51,16 +51,17 @@ if(WERROR_COMMON_FLAGS)
        )
 endif()
 
-add_lex_files(DFILTER_FILES
+add_lex_files(LEX_FILES GENERATED_FILES
        scanner.l
 )
 
-add_lemon_files(DFILTER_FILES
+add_lemon_files(LEMON_FILES GENERATED_FILES
        grammar.lemon
 )
 
 add_library(dfilter OBJECT
        ${DFILTER_FILES}
+       ${GENERATED_FILES}
 )
 
 set_target_properties(dfilter PROPERTIES
@@ -68,6 +69,18 @@ set_target_properties(dfilter PROPERTIES
        COMPILE_DEFINITIONS "WS_BUILD_DLL"
 )
 
+CHECKAPI(
+       NAME
+         dfilter
+       SWITCHES
+         -g termoutput -build
+       SOURCES
+         ${DFILTER_FILES}
+# LEX files commented out due to use of malloc, free etc.
+#        ${LEX_FILES}
+         ${LEMON_FILES}
+)
+
 #
 # Editor modelines  -  http://www.wireshark.org/tools/modelines.html
 #
index 64f2b6a7402123b8083b26a0296ae6d7e2c9ebad..02b56c2a44b995068afc270ecff72cf6d57e347c 100644 (file)
@@ -984,7 +984,6 @@ set(DISSECTOR_SRC
        packet-ncp-nmas.c
        packet-ncp-sss.c
        packet-ncp.c
-       packet-ncp2222.c
        packet-ncs.c
        packet-ndmp.c
        packet-ndp.c
@@ -1428,10 +1427,15 @@ set(DISSECTOR_SRC
 set(DISSECTOR_SUPPORT_SRC
        packet-dcerpc-nt.c
        usb.c
-       register.c
 )
 source_group(dissector-support FILES ${DISSECTOR_SUPPORT_SRC})
 
+set(DISSECTOR_GENERATED_FILES
+       packet-ncp2222.c
+       register.c
+)
+source_group(dissector-generated FILES ${DISSECTOR_GENERATED_FILES})
+
 set(DISSECTOR_FILES
        ${DISSECTOR_SRC}
        ${PIDL_DISSECTOR_SRC}
@@ -1454,6 +1458,7 @@ set(CLEAN_FILES
        ${PIDL_DISSECTOR_SRC}
        ${ASN1_DISSECTOR_SRC}
        ${DISSECTOR_SUPPORT_SRC}
+       ${DISSECTOR_GENERATED_FILES}
 )
 
 if(WERROR_COMMON_FLAGS)
@@ -1467,6 +1472,7 @@ endif()
 add_library(dissectors OBJECT
        ${DISSECTOR_FILES}
        ${DISSECTOR_SUPPORT_SRC}
+       ${DISSECTOR_GENERATED_FILES}
 )
 
 set_target_properties(dissectors PROPERTIES
@@ -1474,6 +1480,19 @@ set_target_properties(dissectors PROPERTIES
        COMPILE_DEFINITIONS "WS_BUILD_DLL"
 )
 
+set(CHECKAPI_FILE_LIST "${CMAKE_CURRENT_BINARY_DIR}/files.txt")
+file(GLOB DISSECTOR_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h")
+file(WRITE "${CHECKAPI_FILE_LIST}" "${DISSECTOR_FILES}")
+CHECKAPI(
+       NAME
+         dissectors
+       SWITCHES
+         -g abort -g termoutput -build --file ${CHECKAPI_FILE_LIST}
+       SOURCES
+         ${DISSECTOR_SUPPORT_SRC}
+         ${DISSECTOR_HEADERS}
+)
+
 #
 # Editor modelines  -  http://www.wireshark.org/tools/modelines.html
 #
index 306c57817e0f57c280fb4154c53d24a8e157bd2e..245ceb9052d48d3b03af54a6953cbb427b3124c9 100644 (file)
@@ -58,6 +58,16 @@ set_target_properties(ftypes PROPERTIES
        COMPILE_DEFINITIONS "WS_BUILD_DLL"
 )
 
+# Commented out as per nmake
+#CHECKAPI(
+#      NAME
+#        ftypes
+#      SWITCHES
+#        -g termoutput -build
+#      SOURCES
+#        ${FTYPE_FILES}
+#)
+
 #
 # Editor modelines  -  http://www.wireshark.org/tools/modelines.html
 #
index 7b3ec346db30eecfad0cffc3270f1670b60ae3e1..57ba001661a66d1f6ac599bfd3ad4478c15030ad 100644 (file)
@@ -166,6 +166,15 @@ set_target_properties(wslua PROPERTIES
        COMPILE_DEFINITIONS "WS_BUILD_DLL"
 )
 
+CHECKAPI(
+       NAME
+         wslua
+       SWITCHES
+         -g termoutput -build
+       SOURCES
+         ${WSLUA_FILES}
+)
+
 #
 # Editor modelines  -  http://www.wireshark.org/tools/modelines.html
 #
index 331fb15e87ccca9bc11c17d473835134e54b6355..74f8beb37d0295b35b0fc09b12e0fba0f8913cd9 100644 (file)
@@ -104,3 +104,14 @@ install(TARGETS docsis
        RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/plugins/${CPACK_PACKAGE_VERSION}
        ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/plugins/${CPACK_PACKAGE_VERSION}
 )
+
+file(GLOB DISSECTOR_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h")
+CHECKAPI(
+       NAME
+         docsis
+       SWITCHES
+         -g abort -g termoutput -build
+       SOURCES
+         ${DISSECTOR_SRC}
+         ${DISSECTOR_HEADERS}
+)
index 082198775356d0df1826033712263958a389e6a7..c50d900f47cfbc4fdddf05670899bed2e7da6af9 100644 (file)
@@ -65,3 +65,14 @@ install(TARGETS ethercat
        RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/plugins/${CPACK_PACKAGE_VERSION}
        ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/plugins/${CPACK_PACKAGE_VERSION}
 )
+
+file(GLOB DISSECTOR_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h")
+CHECKAPI(
+       NAME
+         ethercat
+       SWITCHES
+         -g abort -g termoutput -build
+       SOURCES
+         ${DISSECTOR_SRC}
+         ${DISSECTOR_HEADERS}
+)
index b3342ccdd5964dcd31e818badf4fc7b1b7e8091f..352cddde3fd931ebe1b5768b285327b5dccfdf0f 100644 (file)
@@ -59,3 +59,14 @@ install(TARGETS gryphon
        RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/plugins/${CPACK_PACKAGE_VERSION}
        ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/plugins/${CPACK_PACKAGE_VERSION}
 )
+
+file(GLOB DISSECTOR_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h")
+CHECKAPI(
+       NAME
+         gryphon
+       SWITCHES
+         -g abort -g termoutput -build
+       SOURCES
+         ${DISSECTOR_SRC}
+         ${DISSECTOR_HEADERS}
+)
index 89fbe87588113b047eb8084f489b83ea11233978..d035ab05d4699b7d1580e552674da0bc2e6769d3 100644 (file)
@@ -61,3 +61,14 @@ install(TARGETS irda
        RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/plugins/${CPACK_PACKAGE_VERSION}
        ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/plugins/${CPACK_PACKAGE_VERSION}
 )
+
+file(GLOB DISSECTOR_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h")
+CHECKAPI(
+       NAME
+         irda
+       SWITCHES
+         -g abort -g termoutput -build
+       SOURCES
+         ${DISSECTOR_SRC}
+         ${DISSECTOR_HEADERS}
+)
index 4ae3d746eaf58e7094f6fad9120f162a6e68e22e..02a69da0c6aa83ca0dfdab8aaa945e7083e21319 100644 (file)
@@ -65,3 +65,15 @@ install(TARGETS m2m
        RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/plugins/${CPACK_PACKAGE_VERSION}
        ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/plugins/${CPACK_PACKAGE_VERSION}
 )
+
+file(GLOB DISSECTOR_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h")
+CHECKAPI(
+       NAME
+         m2m
+       SWITCHES
+         -g abort -g termoutput -build
+       SOURCES
+         ${DISSECTOR_SRC}
+         ${DISSECTOR_SUPPORT_SRC}
+         ${DISSECTOR_HEADERS}
+)
index 6f3c35aa613124e2fe95abef33fc2d31a5fcc430..16459c4c7a80a3019c6594f0775b1a37fe5e453c 100644 (file)
@@ -40,11 +40,10 @@ set(DISSECTOR_SUPPORT_CLEAN_SRC
        ${DISSECTOR_SUPPORT_SRC}
 )
 
-add_lemon_files(DISSECTOR_SUPPORT_SRC
+add_lemon_files(LEMON_FILES GENERATED_FILES
        mate_grammar.lemon
 )
-
-add_lex_files(DISSECTOR_SUPPORT_SRC
+add_lex_files(LEX_FILES GENERATED_FILES
        mate_parser.l
 )
 
@@ -52,6 +51,7 @@ set(PLUGIN_FILES
        plugin.c
        ${DISSECTOR_SRC}
        ${DISSECTOR_SUPPORT_SRC}
+       ${GENERATED_FILES}
 )
 
 set(CLEAN_FILES
@@ -81,3 +81,18 @@ install(TARGETS mate
        RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/plugins/${CPACK_PACKAGE_VERSION}
        ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/plugins/${CPACK_PACKAGE_VERSION}
 )
+
+file(GLOB DISSECTOR_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h")
+CHECKAPI(
+       NAME
+         mate
+       SWITCHES
+         -g abort -g termoutput -build
+       SOURCES
+         ${DISSECTOR_SRC}
+         ${DISSECTOR_SUPPORT_SRC}
+         ${DISSECTOR_HEADERS}
+# LEX files commented out due to use of malloc, free etc.
+#        ${LEX_FILES}
+         ${LEMON_FILES}
+)
index f78b16d5362fc53906dda0b1fca8cdf2b8cbc7ec..cedeaeedb31df82a33805011cac7c33bca6084ee 100644 (file)
@@ -75,3 +75,15 @@ install(TARGETS opcua
        RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/plugins/${CPACK_PACKAGE_VERSION}
        ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/plugins/${CPACK_PACKAGE_VERSION}
 )
+
+file(GLOB DISSECTOR_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h")
+CHECKAPI(
+       NAME
+         opcua
+       SWITCHES
+         -g abort -g termoutput -build
+       SOURCES
+         ${DISSECTOR_SRC}
+         ${DISSECTOR_SUPPORT_SRC}
+         ${DISSECTOR_HEADERS}
+)
index 73bdbc4b7615ce201a7cddddb967678acb10c0b8..89d7ab7f35ce58bd23d727c9542e27a723925521 100644 (file)
@@ -72,3 +72,15 @@ install(TARGETS profinet
        RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/plugins/${CPACK_PACKAGE_VERSION}
        ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/plugins/${CPACK_PACKAGE_VERSION}
 )
+
+file(GLOB DISSECTOR_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h")
+CHECKAPI(
+       NAME
+         profinet
+       SWITCHES
+         -g abort -g termoutput -build
+       SOURCES
+         ${DISSECTOR_SRC}
+         ${DISSECTOR_SUPPORT_SRC}
+         ${DISSECTOR_HEADERS}
+)
index e0d1dbcc28fa0dc32243f81a27ed5280f52f283e..60283123fdfeffd19aae7650d257c09ecffbd18c 100644 (file)
@@ -48,3 +48,14 @@ install(TARGETS stats_tree
        RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/plugins/${CPACK_PACKAGE_VERSION}
        ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/plugins/${CPACK_PACKAGE_VERSION}
 )
+
+file(GLOB PLUGIN_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h")
+CHECKAPI(
+       NAME
+         stats_tree
+       SWITCHES
+         -g abort -g termoutput -build
+       SOURCES
+         ${CLEAN_FILES}
+         ${PLUGIN_HEADERS}
+)
index e0f742452b5e6aa99ba22216a3a1f1ae5285881c..b937e0987235f2b704d38152790d5c054d222e39 100644 (file)
@@ -59,3 +59,14 @@ install(TARGETS unistim
        RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/plugins/${CPACK_PACKAGE_VERSION}
        ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/plugins/${CPACK_PACKAGE_VERSION}
 )
+
+file(GLOB DISSECTOR_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h")
+CHECKAPI(
+       NAME
+         unistim
+       SWITCHES
+         -g abort -g termoutput -build
+       SOURCES
+         ${DISSECTOR_SRC}
+         ${DISSECTOR_HEADERS}
+)
index 13bf8dc02f38519b66d4bc1032c7d943d8e2ad45..f7cffbca189a7693f3cc43da99d6fff4917e4caa 100644 (file)
@@ -105,3 +105,15 @@ install(TARGETS wimax
        RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/plugins/${CPACK_PACKAGE_VERSION}
        ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/plugins/${CPACK_PACKAGE_VERSION}
 )
+
+file(GLOB DISSECTOR_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h")
+CHECKAPI(
+       NAME
+         wimax
+       SWITCHES
+         -g abort -g termoutput -build
+       SOURCES
+         ${DISSECTOR_SRC}
+         ${DISSECTOR_SUPPORT_SRC}
+         ${DISSECTOR_HEADERS}
+)
index b31ac156ba6d860bd3fdfb2f593e9f3437f3d5b1..277c2e379645e3268b42fac759f9df2ac24234ff 100644 (file)
@@ -45,9 +45,10 @@ if (WERROR_COMMON_FLAGS)
        )
 endif()
 
-add_lex_files(PLUGIN_FILES
+add_lex_files(LEX_FILES GENERATED_FILES
        wimaxasncp_dict.l
 )
+list(APPEND PLUGIN_FILES ${GENERATED_FILES})
 
 include_directories(${CMAKE_CURRENT_SOURCE_DIR})
 
@@ -63,3 +64,16 @@ install(TARGETS wimaxasncp
        RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/plugins/${CPACK_PACKAGE_VERSION}
        ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/plugins/${CPACK_PACKAGE_VERSION}
 )
+
+file(GLOB DISSECTOR_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h")
+CHECKAPI(
+       NAME
+         wimaxasncp
+       SWITCHES
+         -g abort -g termoutput -build
+       SOURCES
+         ${DISSECTOR_SRC}
+         ${DISSECTOR_HEADERS}
+# LEX files commented out due to use of malloc, free etc.
+#        ${LEX_FILES}
+)
index bbcd44723715178e515881390a42d7d72a6fea6d..344ebb0ed1e05ca5c93fd8da02f2699bbb7b4d22 100644 (file)
@@ -59,3 +59,14 @@ install(TARGETS wimaxmacphy
        RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/plugins/${CPACK_PACKAGE_VERSION}
        ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/plugins/${CPACK_PACKAGE_VERSION}
 )
+
+file(GLOB DISSECTOR_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h")
+CHECKAPI(
+       NAME
+         wimaxmacphy
+       SWITCHES
+         -g abort -g termoutput -build
+       SOURCES
+         ${DISSECTOR_SRC}
+         ${DISSECTOR_HEADERS}
+)
index f40f7454080a80ac3ff466688d47959280a6a5a0..15e1822f5760120c327cff78e003bfa1b26df925 100644 (file)
@@ -36,7 +36,7 @@ if (WERROR_COMMON_FLAGS)
        )
 endif()
 
-file(GLOB RANDPKT_CORE_HEADERS randpkt_core.h)
+file(GLOB RANDPKT_CORE_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" randpkt_core.h)
 
 add_library(randpkt_core STATIC
        ${RANDPKT_CORE_SRC}
@@ -45,3 +45,22 @@ add_library(randpkt_core STATIC
 set_target_properties(randpkt_core PROPERTIES
        LINK_FLAGS "${WS_LINK_FLAGS}"
        FOLDER "Libs")
+
+CHECKAPI(
+       NAME
+         randpkt_core-base
+       SWITCHES
+         -g deprecated-gtk
+       SOURCES
+         ${RANDPKT_CORE_SRC}
+         ${RANDPKT_CORE_HEADERS}
+)
+CHECKAPI(
+       NAME
+         randpkt_core-todo
+       SWITCHES
+         -M -g deprecated-gtk-todo
+       SOURCES
+         ${RANDPKT_CORE_SRC}
+         ${RANDPKT_CORE_HEADERS}
+)
index 0de0644ff27e0d2e29b92a99b442059f2330187d..36a2110f2db53b3160f9e416c9572ee277c60a22 100755 (executable)
@@ -1832,7 +1832,9 @@ sub print_usage
         print "                    [--build] [-s group1] [-s group2] ... \n";
         print "                    [--sourcedir=srcdir] \n";
         print "                    [--nocheck-value-string-array] \n";
-        print "                    [--nocheck-addtext] [--nocheck-hf] [--debug] file1 file2 ...\n";
+        print "                    [--nocheck-addtext] [--nocheck-hf] [--debug]\n";
+        print "                    [--file=/path/to/file_list]\n";
+        print "                    file1 file2 ...\n";
         print "\n";
         print "       -M: Generate output for -g in 'machine-readable' format\n";
         print "       -p: used by the git pre-commit hook\n";
@@ -1976,6 +1978,7 @@ my $check_addtext = 1;                                  # default: enabled
 my $debug_flag = 0;                                     # default: disabled
 my $buildbot_flag = 0;
 my $source_dir = "";
+my $filenamelist = "";
 my $help_flag = 0;
 my $pre_commit = 0;
 
@@ -1990,6 +1993,7 @@ my $result = GetOptions(
                         'sourcedir=s' => \$source_dir,
                         'debug' => \$debug_flag,
                         'pre-commit' => \$pre_commit,
+                        'file=s' => \$filenamelist,
                         'help' => \$help_flag
                         );
 if (!$result || $help_flag) {
@@ -2016,11 +2020,23 @@ for my $apiGroup (keys %APIs) {
         @{$APIs{$apiGroup}->{function_counts}}{@functions} = ();  # Add fcn names as keys to the anonymous hash
 }
 
+my @filelist;
+push @filelist, @ARGV;
+if ("$filenamelist" ne "") {
+        # We have a file containing a list of files to check (possibly in
+        # addition to those on the command line).
+        open(FC, $filenamelist) || die("Couldn't open $filenamelist");
+
+        while (<FC>) {
+                # file names can be separated by ;
+                push @filelist, split(';');
+        }
+        close(FC);
+}
 
 # Read through the files; do various checks
-while ($_ = $ARGV[0])
+while ($_ = pop @filelist)
 {
-        shift;
         my $filename = $_;
         my $fileContents = '';
         my @foundAPIs = ();
index cb6d27df798e3cbb92c0aaedd81dca54c45e071f..f7842b8ce79b3328d92ac76598e72a92500760cc 100644 (file)
@@ -69,9 +69,7 @@ file(GLOB EXTRA_UI_HEADERS
        tap-rtp-analysis.h
 )
 
-set(DIRTY_UI_SRC)
-
-add_lex_files(DIRTY_UI_SRC
+add_lex_files(LEX_FILES GENERATED_FILES
        text_import_scanner.l
 )
 
@@ -90,12 +88,33 @@ endif()
 
 add_library(ui STATIC
        ${COMMON_UI_SRC}
-       ${DIRTY_UI_SRC}
+       ${GENERATED_FILES}
 )
 
 set_target_properties(ui PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
 set_target_properties(ui PROPERTIES FOLDER "UI")
 
+CHECKAPI(
+       NAME
+         ui-base
+       SWITCHES
+         -g deprecated-gtk
+       SOURCES
+         ${COMMON_UI_SRC}
+# LEX files commented out due to use of malloc, free etc.
+#        ${LEX_FILES}
+)
+CHECKAPI(
+       NAME
+         ui-todo
+       SWITCHES
+         -M -g deprecated-gtk-todo
+       SOURCES
+         ${COMMON_UI_SRC}
+# LEX files commented out due to use of malloc, free etc.
+#        ${LEX_FILES}
+)
+
 #
 # Editor modelines  -  http://www.wireshark.org/tools/modelines.html
 #
index 3621119b8815cad8b6fee29e14969e8cec040d80..75e51bf61718c15e05cf990eb3e90bc8f97d0c51 100644 (file)
@@ -322,6 +322,27 @@ set_target_properties(gtkui PROPERTIES
        LINK_FLAGS "${WS_LINK_FLAGS}"
        FOLDER "UI")
 
+CHECKAPI(
+       NAME
+         gtk-base
+       SWITCHES
+         -g deprecated-gtk
+       SOURCES
+         ${WIRESHARK_GTK_SRC}
+         ${WIRESHARK_TAP_SRC}
+         ${PLATFORM_UI_SRC}
+)
+CHECKAPI(
+       NAME
+         gtk-todo
+       SWITCHES
+         -M -g deprecated-gtk-todo
+       SOURCES
+         ${WIRESHARK_GTK_SRC}
+         ${WIRESHARK_TAP_SRC}
+         ${PLATFORM_UI_SRC}
+)
+
 #
 # Editor modelines  -  http://www.wireshark.org/tools/modelines.html
 #
index 59233d7911df8bd79059f36eb4563635a68acf56..60c8a1e349ff584a0ec10a5149887547dfdf6f9f 100644 (file)
@@ -92,12 +92,12 @@ if (WERROR_COMMON_FLAGS)
        )
 endif()
 
-add_lex_files(WIRETAP_FILES
+add_lex_files(LEX_FILES GENERATED_FILES
        ascend_scanner.l
        k12text.l
 )
 
-add_yacc_files(WIRETAP_FILES
+add_yacc_files(YACC_FILES GENERATED_FILES
        ascend.y
 )
 
@@ -110,6 +110,7 @@ set(wiretap_LIBS
 
 add_library(wiretap ${LINK_MODE_LIB}
        ${WIRETAP_FILES}
+       ${GENERATED_FILES}
        ${CMAKE_BINARY_DIR}/image/wiretap.rc
 )
 
@@ -154,3 +155,17 @@ if(NOT ${ENABLE_STATIC})
                ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
        )
 endif()
+
+CHECKAPI(
+       NAME
+         wiretap
+       SWITCHES
+## 'abort' checking disabled for now pending resolution of existing use of g_assert & g_error
+##       -g abort -g termoutput
+         -g termoutput -build
+       SOURCES
+         ${WIRETAP_FILES}
+# LEX files commented out due to use of malloc, free etc.
+#        ${LEX_FILES}
+         ${YACC_FILES}
+)
index 209787a6587c0e51560e3f59ca1377b3da5f5f58..384bda65eb9bef97b25351fc44227f7a2130a4c4 100644 (file)
 
 include(UseABICheck)
 
-if(WIN32)
-       set(WSUTIL_PLATFORM_FILES
-               file_util.c
-               inet_ntop.c
-               inet_pton.c
-       )
-ENDIF(WIN32)
-
-set(WSUTIL_FILES
+set(WSUTIL_COMMON_FILES
        adler32.c
        aes.c
        airpdcap_wep.c
@@ -75,11 +67,20 @@ set(WSUTIL_FILES
        type_util.c
        unicode-utils.c
        ws_mempbrk.c
-       ${WSUTIL_PLATFORM_FILES}
 )
 
+set(WSUTIL_FILES ${WSUTIL_COMMON_FILES})
+if(WIN32)
+       list(APPEND WSUTIL_FILES
+               file_util.c
+               inet_ntop.c
+               inet_pton.c
+       )
+ENDIF(WIN32)
+
+
 if(HAVE_OS_X_FRAMEWORKS)
-       set(WSUTIL_FILES ${WSUTIL_FILES} cfutils.c)
+       list(APPEND WSUTIL_FILES cfutils.c)
 endif()
 
 #
@@ -141,23 +142,23 @@ if(COMPILER_CAN_HANDLE_SSE4_2)
        endif()
 endif()
 if(HAVE_SSE4_2)
-       set(WSUTIL_FILES ${WSUTIL_FILES} ws_mempbrk_sse42.c)
+       list(APPEND WSUTIL_FILES ws_mempbrk_sse42.c)
 endif()
 
 if(NOT HAVE_GETOPT_LONG)
-       set(WSUTIL_FILES ${WSUTIL_FILES} getopt_long.c)
+       list(APPEND WSUTIL_FILES getopt_long.c)
 endif()
 
 if(NOT HAVE_INET_ATON)
-       set(WSUTIL_FILES ${WSUTIL_FILES} inet_aton.c)
+       list(APPEND WSUTIL_FILES inet_aton.c)
 endif()
 
 if(NOT HAVE_POPCOUNT)
-       set(WSUTIL_FILES ${WSUTIL_FILES} popcount.c)
+       list(APPEND WSUTIL_FILES popcount.c)
 endif()
 
 if(NOT HAVE_STRPTIME)
-       set(WSUTIL_FILES ${WSUTIL_FILES} strptime.c)
+       list(APPEND WSUTIL_FILES strptime.c)
 endif()
 
 if(APPLE)
@@ -259,6 +260,15 @@ endif()
 
 add_definitions( -DTOP_SRCDIR=\"${CMAKE_SOURCE_DIR}\" )
 
+CHECKAPI(
+       NAME
+         wsutil
+       SWITCHES
+         -g termoutput -build
+       SOURCES
+         ${WSUTIL_COMMON_FILES}
+)
+
 #
 # Editor modelines  -  http://www.wireshark.org/tools/modelines.html
 #