GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: src/main.cpp Lines: 23 25 92.0 %
Date: 2024-09-10 03:06:26 Branches: 30 35 85.7 %

Line Branch Exec Source
1
/***************************************
2
	Auteur : Pierre Aubert
3
	Mail : pierre.aubert@lapp.in2p3.fr
4
	Licence : CeCILL-C
5
****************************************/
6
7
#include "OptionParser.h"
8
9
#include "PFunc/parseFunc.h"
10
#include "PFunc/pfunc_removeConflic.h"
11
#include "PFunc/pfunc_utils.h"
12
13
///Create the OptionParser of this program
14
/**	@return OptionParser of this program
15
*/
16
2
OptionParser createOptionParser(){
17
4
	OptionParser parser(true, __PROGRAM_VERSION__);
18
2
	parser.setExampleLongOption("pintrinsicgenerator --input=file.h");
19
2
	parser.setExampleShortOption("pintrinsicgenerator -i file.h");
20
21

2
	parser.addOption("input", "i", OptionType::FILENAME, true, "Required option");
22

2
	parser.addOption("noia32", "n", OptionType::NONE, false, "remove IA32 intrinsics (seems to be the buildin ones used by the compiler for ARM)");
23
2
	return parser;
24
}
25
26
///Process the list of input files
27
/**	@param vecInputFile : list of input files
28
 * 	@param removeIA32intrinsic : true to remove IA32 intrinsics (seems to be the buildin ones used by the compiler for ARM)
29
 * 	@return 0 on success, -1 otherwise
30
*/
31
2
int processAllFiles(const std::vector<std::string> & vecInputFile, bool removeIA32intrinsic){
32
	//The vecInputFile cannot be empty due to the OptionParser
33
4
	PVecHeader vecHeader;
34
2
	if(!parserFuncListFile(vecHeader, vecInputFile, removeIA32intrinsic)){
35
1
		std::cerr << "processAllFiles : can't parse list of input files" << std::endl;
36
1
		return -1;
37
	}
38
2
	PVecHeader vecNoConflict;
39
1
	pfunc_removeConflict(vecNoConflict, vecHeader);
40
41
1
	if(!saveHeaderVec(vecNoConflict)){
42
		std::cerr << "processAllFiles : can't save list of headers" << std::endl;
43
		return -1;
44
	}
45
1
	return 0;
46
}
47
48
2
int main(int argc, char** argv){
49
4
	OptionParser parser = createOptionParser();
50
2
	parser.parseArgument(argc, argv);
51
52
2
	const OptionMode & defaultMode = parser.getDefaultMode();
53
2
	std::vector<std::string> vecInputFile;
54
2
	defaultMode.getValue(vecInputFile, "input");
55
56
2
	return processAllFiles(vecInputFile, defaultMode.isOptionExist("noia32"));
57
}
58