GCC Code Coverage Report


Directory: ./
File: src/Debug.cpp
Date: 2024-02-26 09:07:35
Exec Total Coverage
Lines: 8 8 100.0%
Branches: 8 16 50.0%

Line Branch Exec Source
1 /*****************************************************************************
2 *
3 * Copyright (C) 2015 Richard Hacker (lerichi at gmx dot net)
4 *
5 * This file is part of the PdCom library.
6 *
7 * The PdCom library is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * The PdCom library is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15 * License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with the PdCom library. If not, see <http://www.gnu.org/licenses/>.
19 *
20 *****************************************************************************/
21
22 #include "Debug.h"
23
24 #include <cstdio>
25 #include <stdarg.h>
26
27 #ifdef PDC_DEBUG
28
29 65 void PdCom::impl::Debug::Debug(
30 const char *file,
31 const char *func,
32 int line,
33 const char *fmt,
34 ...)
35 {
36 65 va_list ap;
37 65 va_start(ap, fmt);
38
39
3/6
✗ Branch 0 not taken.
✓ Branch 1 taken 65 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 65 times.
✓ Branch 5 taken 65 times.
✗ Branch 6 not taken.
65 fprintf(stderr, "%s:%s(%i): ", file, func, line);
40
3/6
✗ Branch 0 not taken.
✓ Branch 1 taken 65 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 65 times.
✓ Branch 5 taken 65 times.
✗ Branch 6 not taken.
65 vfprintf(stderr, fmt, ap);
41
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 65 times.
✓ Branch 3 taken 65 times.
✗ Branch 4 not taken.
65 fprintf(stderr, "\n");
42
43 65 va_end(ap);
44 65 }
45
46 #endif // PDC_DEBUG
47