Skip to content

Commit 2c9912e

Browse files
committed
Compile flags and option for debug. Removed dead line of code.
1 parent 6e497a6 commit 2c9912e

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

CMakeLists.txt

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,23 @@ cmake_minimum_required(VERSION 3.10)
22

33
project(dbc)
44

5+
option(DEBUG "use debug flag" NO)
6+
57
# specify the C++ standard
68
set(CMAKE_CXX_STANDARD 11)
79
set(CMAKE_CXX_STANDARD_REQUIRED True)
810

9-
# Add in the debug flag0.
10-
set(GCC_COVERAGE_COMPILE_FLAGS "-g")
11+
set(GCC_COMPILE_FLAGS "-Wextra -Wall -Wfloat-equal -Wundef -Wshadow \
12+
-Wpointer-arith -Wcast-align -Wstrict-prototypes -Wwrite-strings \
13+
-Waggregate-return -Wcast-qual -Wswitch-default -Wswitch-enum -Wconversion \
14+
-Wunreachable-code -Wformat=2 -Werror -Wuninitialized -Winit-self")
15+
16+
if(DEBUG)
17+
set(GCC_COMPILE_FLAGS ${GCC_COMPILE_FLAGS}" -g")
18+
else()
19+
set(GCC_COMPILE_FLAGS ${GCC_COMPILE_FLAGS}" -O2")
20+
endif()
21+
1122
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS}")
1223

1324
# add where to find the source files

src/dbc.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#include "util/utils.hpp"
33

44
#include <regex>
5-
#include <iostream>
65

76
namespace libdbc {
87

@@ -51,8 +50,6 @@ namespace libdbc {
5150
const std::regex name_space_re;
5251

5352
void parse_dbc_header(std::istream& file_stream) {
54-
std::vector<std::string> lines;
55-
5653
std::string line;
5754
std::smatch match;
5855
bool is_blank = true;

0 commit comments

Comments
 (0)