Skip to content

Commit 3440a72

Browse files
authored
Fix warnings as errors (building with Clang) (#155)
While building the project with more warnings-as-errors, I came across these two ones. See comments inline.
1 parent 6515d20 commit 3440a72

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ message(STATUS "QSS Compiler Version: ${QSSC_VERSION}")
9191

9292
set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to")
9393
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
94+
set(CMAKE_COMPILE_WARNING_AS_ERROR ON)
9495

9596
# Compiler options
9697
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")

include/Utils/DebugIndent.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,14 @@ class DebugIndent {
5656

5757
private:
5858
unsigned int debugIndentCount{0};
59-
unsigned int debugIndentStep{2};
59+
#ifdef __GNUC__
60+
#pragma GCC diagnostic push
61+
#pragma GCC diagnostic ignored "-Wattributes"
62+
#endif
63+
[[maybe_unused]] unsigned int debugIndentStep{2};
64+
#ifdef __GNUC__
65+
#pragma GCC diagnostic pop
66+
#endif
6067
};
6168

6269
} // namespace qssc::utils

lib/Frontend/OpenQASM3/QUIRVariableBuilder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ QUIRVariableBuilder::generateParameterLoad(mlir::Location location,
130130
return loadOp;
131131
}
132132

133-
assert(false &&
134-
"Unsupported defining value operation for parameter variable");
133+
llvm_unreachable(
134+
"Unsupported defining value operation for parameter variable");
135135
}
136136

137137
void QUIRVariableBuilder::generateArrayVariableDeclaration(

0 commit comments

Comments
 (0)