Makefile.am | 6 + tests/cppcheck_append.cc | 190 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 196 insertions(+), 0 deletions(-)
Add a "cppcheck" build target at the top level of the OpenSAF source tree. Use the following commands to run it: make cppcheck cppcheck-gui tests/cppcheck_result.xml diff --git a/Makefile.am b/Makefile.am --- a/Makefile.am +++ b/Makefile.am @@ -253,6 +253,12 @@ uninstall-hook: docs: doxygen +cppcheck: + @for i in $$(find osaf -name '*.h' -exec dirname {} \; | sort | uniq); do echo "$$i"; dirname "$$i"; done | sort | uniq > tests/cppcheck_includes.txt + @cppcheck -DSA_EXTENDED_NAME_SOURCE -D__USE_GNU -D__cplusplus=201103L -DIMMA_OI -DIMMA_OM -DASAPi_DEBUG=1 -DHAVE_CONFIG_H -DNCS_CPA=1 -DNCS_CPD=1 -DNCS_CPND=1 -DNCS_EDA=1 -DNCS_EDS=1 -DNCS_GLA=1 -DNCS_GLD=1 -DNCS_GLND=1 -DNCSL_ENV_INIT_HM=1 -DNCSL_ENV_INIT_TMR=1 -DUSE_LITTLE_ENDIAN=1 -DNCS_MBCSV=1 -DNCS_MQA=1 -DNCS_MQD=1 -DNCS_MQND=1 -DRLIMIT_RTPRIO -DTIPC_SUB_CANCEL -DENABLE_AIS_PLM -DLIBXML_SAX1_ENABLED -DLIBXML_XPATH_ENABLED --enable=all --includes-file=tests/cppcheck_includes.txt --suppress=unusedFunction:osaf/libs/common/ais/aisa_api.c --xml-version=2 osaf tests/cppcheck_append.cc 2> tests/cppcheck_result.xml + @echo "The result can be found in the file tests/cppcheck_result.xml" + @echo "Use the follwing command to view it: cppcheck-gui tests/cppcheck_result.xml" + clean-local: -rm -f $(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz if ENABLE_RPM_TARGET diff --git a/tests/cppcheck_append.cc b/tests/cppcheck_append.cc new file mode 100644 --- /dev/null +++ b/tests/cppcheck_append.cc @@ -0,0 +1,190 @@ +/* -*- OpenSAF -*- + * + * (C) Copyright 2016 The OpenSAF Foundation + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. This file and program are licensed + * under the GNU Lesser General Public License Version 2.1, February 1999. + * The complete license can be accessed from the following location: + * http://opensource.org/licenses/lgpl-license.php + * See the Copying file included with the OpenSAF distribution for full + * licensing terms. + * + * Author(s): Ericsson AB + * + */ + +/** @file + * + * This file contains references to otherwise unused AIS functions. The purpose + * of this file is make sure the 'cppcheck' tool does not flag these AIS + * functions as unused. This file is not meant to ever be compiled - it should + * only be used when analyzing the OpenSAF source code with the 'cppcheck' tool. + */ + +#include "saAmf.h" +#include "saCkpt.h" +#include "saClm.h" +#include "saEvt.h" +#include "saImmOi_A_2_15.h" +#include "saImmOm_A_2_17.h" +#include "saLck.h" +#include "saLog.h" +#include "saMsg.h" +#include "saNtf.h" +#include "saPlm.h" +#include "saSmf.h" + +void* unused_functions[] = { + (void*) saAmfComponentErrorClear_4, + (void*) saAmfComponentErrorReport_4, + (void*) saAmfCorrelationIdsGet, + (void*) saAmfHAReadinessStateSet, + (void*) saAmfHAStateGet, + (void*) saAmfHealthcheckConfirm, + (void*) saAmfHealthcheckStop, + (void*) saAmfProtectionGroupNotificationFree_4, + (void*) saAmfProtectionGroupTrack, + (void*) saAmfProtectionGroupTrackStop, + (void*) saAmfProtectionGroupTrack_4, + (void*) saAmfResponse_4, + (void*) saCkptActiveReplicaSet, + (void*) saCkptCheckpointOpen, + (void*) saCkptCheckpointOpenAsync, + (void*) saCkptCheckpointRead, + (void*) saCkptCheckpointRetentionDurationSet, + (void*) saCkptCheckpointStatusGet, + (void*) saCkptCheckpointSynchronize, + (void*) saCkptCheckpointSynchronizeAsync, + (void*) saCkptCheckpointTrack, + (void*) saCkptCheckpointTrackStop, + (void*) saCkptCheckpointUnlink, + (void*) saCkptCheckpointWrite, + (void*) saCkptDispatch, + (void*) saCkptFinalize, + (void*) saCkptIOVectorElementDataFree, + (void*) saCkptInitialize, + (void*) saCkptInitialize_2, + (void*) saCkptSectionCreate, + (void*) saCkptSectionDelete, + (void*) saCkptSectionExpirationTimeSet, + (void*) saCkptSectionIdFree, + (void*) saCkptSectionIterationFinalize, + (void*) saCkptSectionIterationInitialize, + (void*) saCkptSectionIterationNext, + (void*) saCkptSectionOverwrite, + (void*) saCkptSelectionObjectGet, + (void*) saCkptTrack, + (void*) saCkptTrackStop, + (void*) saClmClusterNodeGetAsync, + (void*) saClmClusterNodeGet_4, + (void*) saClmClusterNotificationFree_4, + (void*) saEvtChannelClose, + (void*) saEvtChannelOpen, + (void*) saEvtChannelOpenAsync, + (void*) saEvtChannelUnlink, + (void*) saEvtDispatch, + (void*) saEvtEventAllocate, + (void*) saEvtEventAttributesGet, + (void*) saEvtEventAttributesSet, + (void*) saEvtEventDataGet, + (void*) saEvtEventFree, + (void*) saEvtEventPatternFree, + (void*) saEvtEventPublish, + (void*) saEvtEventRetentionTimeClear, + (void*) saEvtEventSubscribe, + (void*) saEvtEventUnsubscribe, + (void*) saEvtFinalize, + (void*) saEvtInitialize, + (void*) saEvtLimitGet, + (void*) saEvtSelectionObjectGet, + (void*) saImmOiAugmentCcbInitialize, + (void*) saImmOiInitialize_o3, + (void*) saImmOiObjectImplementerRelease, + (void*) saImmOiObjectImplementerRelease_o3, + (void*) saImmOiObjectImplementerSet, + (void*) saImmOiObjectImplementerSet_o3, + (void*) saImmOiRtObjectCreate_o3, + (void*) saImmOiRtObjectDelete_o3, + (void*) saImmOiRtObjectUpdate_o3, + (void*) saImmOmAccessorGet_o3, + (void*) saImmOmAdminOperationContinuationClear, + (void*) saImmOmAdminOperationContinuationClear_o3, + (void*) saImmOmAdminOperationContinue, + (void*) saImmOmAdminOperationContinueAsync, + (void*) saImmOmAdminOperationContinueAsync_o3, + (void*) saImmOmAdminOperationContinue_o2, + (void*) saImmOmAdminOperationContinue_o3, + (void*) saImmOmAdminOperationInvokeAsync_2, + (void*) saImmOmAdminOperationInvokeAsync_o3, + (void*) saImmOmAdminOwnerClear_o3, + (void*) saImmOmAdminOwnerRelease_o3, + (void*) saImmOmAdminOwnerSet_o3, + (void*) saImmOmCcbObjectCreate_o3, + (void*) saImmOmCcbObjectDelete_o3, + (void*) saImmOmCcbObjectModify_o3, + (void*) saImmOmSearchInitialize_o3, + (void*) saImmOmSearchNext_o3, + (void*) saLckDispatch, + (void*) saLckFinalize, + (void*) saLckInitialize, + (void*) saLckLockPurge, + (void*) saLckOptionCheck, + (void*) saLckResourceClose, + (void*) saLckResourceLock, + (void*) saLckResourceLockAsync, + (void*) saLckResourceOpen, + (void*) saLckResourceOpenAsync, + (void*) saLckResourceUnlock, + (void*) saLckResourceUnlockAsync, + (void*) saLckSelectionObjectGet, + (void*) saLogFilterSetCallback, + (void*) saLogLimitGet, + (void*) saLogStreamOpenAsync_2, + (void*) saLogStreamOpenCallback, + (void*) saLogWriteLog, + (void*) saMsgDispatch, + (void*) saMsgFinalize, + (void*) saMsgInitialize, + (void*) saMsgMessageCancel, + (void*) saMsgMessageDataFree, + (void*) saMsgMessageGet, + (void*) saMsgMessageReply, + (void*) saMsgMessageReplyAsync, + (void*) saMsgMessageSend, + (void*) saMsgMessageSendAsync, + (void*) saMsgMessageSendReceive, + (void*) saMsgQueueGroupCreate, + (void*) saMsgQueueGroupDelete, + (void*) saMsgQueueGroupInsert, + (void*) saMsgQueueGroupNotificationFree, + (void*) saMsgQueueGroupRemove, + (void*) saMsgQueueGroupTrack, + (void*) saMsgQueueGroupTrackStop, + (void*) saMsgQueueOpen, + (void*) saMsgQueueOpenAsync, + (void*) saMsgQueueRetentionTimeSet, + (void*) saMsgQueueStatusGet, + (void*) saMsgQueueUnlink, + (void*) saMsgSelectionObjectGet, + (void*) saNtfArrayValAllocate, + (void*) saNtfArrayValGet, + (void*) saNtfLocalizedMessageFree, + (void*) saNtfLocalizedMessageGet, + (void*) saPlmEntityGroupDelete, + (void*) saPlmEntityReadinessImpact, + (void*) saPlmFinalize, + (void*) saPlmReadinessNotificationFree, + (void*) saPlmReadinessTrackStop, + (void*) saSmfCallbackScopeUnregister +}; + +int main(int argc, char** argv) { + (void) argv; + if (argc < sizeof(unused_functions) / sizeof(unused_functions[0])) { + return (int) unused_functions[argc]; + } else { + return 0; + } +} ------------------------------------------------------------------------------ Mobile security can be enabling, not merely restricting. Employees who bring their own devices (BYOD) to work are irked by the imposition of MDM restrictions. Mobile Device Manager Plus allows you to control only the apps on BYO-devices by containerizing them, leaving personal data untouched! https://ad.doubleclick.net/ddm/clk/304595813;131938128;j _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel