Skip to content
This repository was archived by the owner on Apr 28, 2023. It is now read-only.

Commit 86cf401

Browse files
committed
Enable Werror compiler flag
1 parent 40d6b7d commit 86cf401

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ project (TensorComprehensions C CXX)
1616

1717
# Display compiler flags for build modes: Release/Debug
1818
message(STATUS "BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
19+
message(STATUS "CMAKE_CXX_COMPILER_VERSION is ${CMAKE_CXX_COMPILER_VERSION}")
20+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
21+
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "5.4")
22+
# we officially support these compiler flags for compiler version 5.4 or less
23+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-variable -Werror")
24+
endif()
25+
message(STATUS "CMAKE_CXX_FLAGS is ${CMAKE_CXX_FLAGS}")
1926
if (${CMAKE_BUILD_TYPE} MATCHES "Debug")
2027
set(CMAKE_CXX_FLAGS_DEBUG "-g")
2128
message(STATUS "CMAKE_CXX_FLAGS_DEBUG is ${CMAKE_CXX_FLAGS_DEBUG}")

tc/lang/lexer.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -418,9 +418,9 @@ struct Lexer {
418418

419419
private:
420420
Token lex() {
421-
int kind;
422-
size_t start;
423-
size_t length;
421+
int kind = -1;
422+
size_t start = 0;
423+
size_t length = 0;
424424
assert(file);
425425
if (!shared.match(*file, pos, &kind, &start, &length)) {
426426
reportError(

0 commit comments

Comments
 (0)