[PATCH] D115357: [test-suite] Fixed compiler error when compiling hexxagonboard.cpp using GCC11
Ahana Datta via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 8 08:44:38 PST 2021
adata111 created this revision.
adata111 added a reviewer: MatzeB.
adata111 created this object with edit policy "Custom Policy".
adata111 requested review of this revision.
The code for hexxagonboard.cpp used an ambiguous variable called "empty". This variable is already predefined by GCC 11.1.0 and hence the file doesn't get compiled using GCC11. The patch fixes this error by changing the variable name to "empty_var". The code now compiles successfully using both GCC 11.1.0 and the old version GCC 9.3.0
Co-author: @Shrill
Repository:
rT test-suite
https://reviews.llvm.org/D115357
Files:
MultiSource/Applications/hexxagon/hexxagonboard.cpp
MultiSource/Applications/hexxagon/hexxagonboard.h
Index: MultiSource/Applications/hexxagon/hexxagonboard.h
===================================================================
--- MultiSource/Applications/hexxagon/hexxagonboard.h
+++ MultiSource/Applications/hexxagon/hexxagonboard.h
@@ -39,7 +39,7 @@
{
pl1 = 1,
pl2,
- empty,
+ empty_var,
removed
};
Index: MultiSource/Applications/hexxagon/hexxagonboard.cpp
===================================================================
--- MultiSource/Applications/hexxagon/hexxagonboard.cpp
+++ MultiSource/Applications/hexxagon/hexxagonboard.cpp
@@ -251,7 +251,7 @@
else
return pl2;
} else
- return empty;
+ return empty_var;
}
int HexxagonBoard::applyMove(HexxagonMove &move)
@@ -424,12 +424,12 @@
cout << "\n";
}
- int empty = 61 - ((turn ? countBricks(1) : countBricks(2)) +
+ int empty_var = 61 - ((turn ? countBricks(1) : countBricks(2)) +
(turn ? countBricks(2) : countBricks(1)));
cout << "\nBricks: x " << (turn ? countBricks(1) : countBricks(2));
cout << ", o " << (turn ? countBricks(2) : countBricks(1));
- cout << ". Empty " << empty << ".\n";
+ cout << ". Empty " << empty_var << ".\n";
cout << "Next to move: " << (turn ? "x" : "o");
cout << (endOfGame() ? ", Game over." : "") << "\n";
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115357.392792.patch
Type: text/x-patch
Size: 1251 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211208/032a14ec/attachment.bin>
More information about the llvm-commits
mailing list