Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Qir/Runtime/lib/QIR/QubitManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ CQubitManager::QubitIdType CQubitManager::GetQubitId(Qubit qubit) const
Qubit CQubitManager::CreateQubitObject(QubitIdType id)
{
// Make sure the static_cast won't overflow:
FailIf(id < 0 || id > std::numeric_limits<intptr_t>::max(), "Qubit id is out of range.");
FailIf(id < 0 || id >= MaximumQubitCapacity, "Qubit id is out of range.");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was giving a warning:

pwsh bootstrap.ps1

. . .
[14/35] Building CXX object lib/QIR/CMakeFiles/qir-rt-support-obj.dir/QubitManager.cpp.obj
../../lib/QIR/QubitManager.cpp:395:25: warning: result of comparison of constant 9223372036854775807 with expression of type 'Microsoft::Quantum::CQubitManager::QubitIdType' (aka 'int') is always false [-Wtautological-constant-out-of-range-compare]
    FailIf(id < 0 || id > std::numeric_limits<intptr_t>::max(), "Qubit id is out of range.");
                     ~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.

intptr_t pointerSizedId = static_cast<intptr_t>(id);
return reinterpret_cast<Qubit>(pointerSizedId);
}
Expand Down
9 changes: 9 additions & 0 deletions src/Qir/qir-utils.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,15 @@ function Build-CMakeProject {
$oldCC = $env:CC
$oldCXX = $env:CXX
$oldRC = $env:RC
$oldCCFLAGS = $env:CCFLAGS
$oldCXXFLAGS = $env:CXXFLAGS

$clangTidy = ""

$warningFlags = "-Werror"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This variable is to be extended with a number of warning flags.

$env:CFLAGS += $warningFlags
$env:CXXFLAGS += $warningFlags

if (($IsMacOS) -or ((Test-Path Env:AGENT_OS) -and ($Env:AGENT_OS.StartsWith("Darwin"))))
{
Write-Host "On MacOS build $Name using the default C/C++ compiler (should be AppleClang)"
Expand Down Expand Up @@ -100,6 +106,9 @@ function Build-CMakeProject {

Pop-Location

$env:CXXFLAGS = $oldCXXFLAGS
$env:CCFLAGS = $oldCCFLAGS

$env:CC = $oldCC
$env:CXX = $oldCXX
$env:RC = $oldRC
Expand Down