• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

benvenutti / hasm / 10864857882

14 Sep 2024 07:09PM UTC coverage: 87.654% (+0.1%) from 87.538%
10864857882

push

github

web-flow
Merge pull request #77 from benvenutti/feature/fix-coverity-scan-issues

Feature/fix coverity scan issues

1 of 8 new or added lines in 2 files covered. (12.5%)

568 of 648 relevant lines covered (87.65%)

35.25 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/app-command-line/src/main.cpp
1
#include <hasm/AssemblerEngine.hpp>
2
#include <hasm/AssemblerEngineConfig.hpp>
3
#include <hasm/HasmInfo.hpp>
4
#include <utilities/CommandLineParser.hpp>
5

6
#include <cstdlib>
7
#include <format>
8
#include <iostream>
9
#include <variant>
10

11
struct RequestVisitor
12
{
13
    bool operator()( const Utilities::CommandLineParser::Config& config ) const
×
14
    {
15
        try
16
        {
NEW
17
            const Hasm::AssemblerEngine assembler{ []( const auto& log ) { std::cout << log << std::endl; } };
×
18

NEW
19
            return assembler.run( { config.inputFile, config.exportSymbols } );
×
20
        }
NEW
21
        catch ( const std::exception& exception )
×
22
        {
NEW
23
            std::cerr << exception.what() << std::endl;
×
24

25
            return false;
NEW
26
        }
×
27
    }
28

29
    bool operator()( const Utilities::CommandLineParser::RequestToPrintHelp& help ) const
30
    {
31
        std::cout << help.message << std::endl;
32

33
        return true;
34
    }
35

36
    bool operator()( const Utilities::CommandLineParser::RequestToPrintVersion& ) const
×
37
    {
38
        std::cout << std::format( "{} {}", Hasm::projectName, Hasm::Version::full ) << std::endl;
×
39

40
        return true;
×
41
    }
42

43
    bool operator()( const Utilities::CommandLineParser::Error& error ) const
44
    {
45
        std::cerr << error.message << std::endl;
46

47
        return true;
48
    }
49
};
50

51
int main( int argc, char** argv )
×
52
{
53
    const auto userRequest = Utilities::CommandLineParser::parse( argc, argv );
×
54

55
    return std::visit( RequestVisitor{}, userRequest ) ? EXIT_SUCCESS : EXIT_FAILURE;
×
56
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc