Facing not referenced issue for the function prototyping using pc-lint. IDE : keil
external symbol 'test' was defined but not referenced [CERT C Recommendation MSC12-C]
714 Informational
The named external variable or external function was defined but not
referenced.
Error in function.h file
header declaration for symbol 'test()' could be moved from header to module
Project Folder structure
->Inc
--extern.h
--function.h
->Src
--main.c
--test.c
CODE
extern.h
//include other header files
include "function.h"
#ifndef EXTERN_H_
#define EXTERN_H_
//other declaration
#endif /* EXTERN_H_ */
function.h
#include <stdint.h>
#ifndef FUNCTION_H_
#define FUNCTION_H_
void test(void);
#endif /* FUNCTION_H_ */
main.c
#include "extern.h"
int main(void) {
test();
}
test.c
#include "extern.h"
void test(void) {
//do something
}
Tried moving function declaration to extern file same issue.
Above is an example of how the code part is implemented and issue is that there are multiple file like test.c which are throwing the same issue.
Output LOG for PC-Lint using Vector Cast. I have masked the personal details of licensing part only.
2023-07-25 16:59:04,280 - pclp:60 [INFO] Parsed Args: Namespace(debug_level='DEBUG', pclp_cmd='D:\\pc_lint\\pclp\\pclp64.exe', compiler_options_file='D:\\pc_lint\\pclp\\config\\co-keil.lnt', options_file=['D:\\pc_lint\\pclp\\lnt\\project_vcast.lnt'], xml_input='D:\\keil_project\\test-uc\\TEST_UC\\build\\4026334200\\CARD_TEST\\generic-analysis_code_analysis.xml')
2023-07-25 16:59:04,280 - pclp:91 [INFO] Using PCLP: D:\pc_lint\pclp\pclp64.exe
2023-07-25 16:59:04,280 - analysis_request:55 [INFO] Parsing File: D:\keil_project\test-working\TEST_FILE_CHECK\build\4026334200\CARD_TEST\generic-analysis_code_analysis.xml
2023-07-25 16:59:04,280 - analysis_request:65 [INFO] Analysis Name: code_analysis
2023-07-25 16:59:04,280 - analysis_request:71 [DEBUG] Checking './include-paths/search-include-path'
2023-07-25 16:59:04,280 - analysis_request:73 [DEBUG] Adding Search Include Path: D:\keil_project\test-working\board
2023-07-25 16:59:04,280 - analysis_request:73 [DEBUG] Adding Search Include Path: D:\keil_project\test-working\Inc
2023-07-25 16:59:04,280 - analysis_request:73 [DEBUG] Adding Search Include Path: D:\keil_project\test-working\Src
2023-07-25 16:59:04,280 - analysis_request:76 [DEBUG] Checking './include-paths/type-include-path'
2023-07-25 16:59:04,280 - analysis_request:81 [DEBUG] Checking './include-paths/lib-include-path'
2023-07-25 16:59:04,280 - analysis_request:83 [DEBUG] Adding Lib Include Path: C:\VCAST\DATA\keil\LPC54606\Core\Include
2023-07-25 16:59:04,280 - analysis_request:83 [DEBUG] Adding Lib Include Path: C:\VCAST\DATA\keil\LPC54606\LPC54606_DFP\16.0.0
2023-07-25 16:59:04,280 - analysis_request:83 [DEBUG] Adding Lib Include Path: C:\VCAST\DATA\keil\LPC54606\LPC54606_DFP\16.0.0\drivers
2023-07-25 16:59:04,280 - analysis_request:83 [DEBUG] Adding Lib Include Path: C:\VCAST\DATA\keil\LPC54606\RTE\_Target_1
2023-07-25 16:59:04,280 - analysis_request:83 [DEBUG] Adding Lib Include Path: C:\Keil_v5\ARM\ARMCLANG\include
2023-07-25 16:59:04,280 - analysis_request:86 [DEBUG] Checking './sources/source'
2023-07-25 16:59:04,280 - analysis_request:88 [DEBUG] Adding Source Path: D:\keil_project\test-working\Src\test.c
2023-07-25 16:59:04,280 - analysis_environment:23 [INFO] Initializing AnalysisEnvironment For: code_analysis
2023-07-25 16:59:04,280 - analysis_environment:25 [INFO] Working Dir: D:\keil_project\test-working\TEST_FILE_CHECK\build\4026334200\CODE_TEST
2023-07-25 16:59:04,280 - analysis_environment:63 [INFO] Analysis Dir: D:\keil_project\test-working\TEST_FILE_CHECK\build\4026334200\CODE_TEST\code_analysis
2023-07-25 16:59:04,280 - analysis_environment:75 [DEBUG] Creating analysis dir
2023-07-25 16:59:04,280 - pclp_analysis:228 [INFO] Lint file: C:\VCAST\StaticAnalysisTools\pclp\vectorcast.lnt
2023-07-25 16:59:04,280 - pclp_analysis:229 [INFO] List file: D:\keil_project\test-working\TEST_FILE_CHECK\build\4026334200\CODE_TEST\code_analysis\vcast_code_analysis_fileList.lnt
2023-07-25 16:59:04,280 - pclp_analysis:230 [INFO] Analysis file: D:\keil_project\test-working\TEST_FILE_CHECK\build\4026334200\CODE_TEST\code_analysis\vcast_code_analysis_analysis.xml
2023-07-25 16:59:04,280 - pclp_analysis:231 [INFO] Result file: D:\keil_project\test-working\TEST_FILE_CHECK\build\4026334200\CODE_TEST\vcast_code_analysis.xml
2023-07-25 16:59:04,280 - pclp_analysis:234 [INFO] Compiler options file: D:\pc_lint\pclp\config\co-keil.lnt
2023-07-25 16:59:04,280 - pclp_analysis:240 [INFO] Options file: D:\pc_lint\pclp\lnt\code_analysisssdac_project_vcast.lnt
2023-07-25 16:59:04,280 - pclp_analysis:247 [INFO] Running Analysis: D:\pc_lint\pclp\pclp64.exe -b +b -os["D:\keil_project\test-working\TEST_FILE_CHECK\build\4026334200\CODE_TEST\code_analysis\vcast_code_analysis_analysis.xml"] --i"D:\pc_lint\pclp\config" D:\pc_lint\pclp\config\co-keil.lnt C:\VCAST\StaticAnalysisTools\pclp\vectorcast.lnt D:\pc_lint\pclp\lnt\code_analysisssdac_project_vcast.lnt D:\keil_project\test-working\TEST_FILE_CHECK\build\4026334200\CODE_TEST\code_analysis\vcast_code_analysis_fileList.lnt
PC-lint Plus 2.0 for Windows, Copyright Vector Informatik GmbH 1985-2022
licensed to **************************** (***********************************)
25-jul-2023, license expires ************* (**************)
2023-07-25 16:59:06,201 - pclp_messages:33 [INFO] Requesting Messages
PC-lint Plus 2.0 for Windows, Copyright Vector Informatik GmbH 1985-2022
licensed to **************************** (***********************************)
25-jul-2023, license expires ************* (**************)
2023-07-25 16:59:06,436 - pclp_messages:58 [INFO] Parsing Message File: D:\keil_project\test-working\TEST_FILE_CHECK\build\4026334200\CODE_TEST\code_analysis\msg.xml
2023-07-25 16:59:06,436 - analysis_environment:119 [DEBUG] Creating TEXT docs dir: D:\keil_project\test-working\TEST_FILE_CHECK\build\4026334200\CODE_TEST\code_analysis\docs\text
2023-07-25 16:59:06,436 - analysis_environment:142 [DEBUG] Creating TITLE docs dir: D:\keil_project\test-working\TEST_FILE_CHECK\build\4026334200\CODE_TEST\code_analysis\docs\title