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

Commit 02a664f

Browse files
authored
Merge pull request #238 from facebookresearch/pr/strcmp
src/lang/lexer.cc: compare const char* strings using strcmp
2 parents 938a480 + 727eb41 commit 02a664f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/lang/lexer.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
* limitations under the License.
1515
*/
1616
#include "tc/lang/lexer.h"
17+
18+
#include <cstring>
19+
1720
#include "tc/lang/error_report.h"
1821

1922
namespace lang {
@@ -38,7 +41,7 @@ std::string kindToToken(int kind) {
3841
switch (kind) {
3942
#define DEFINE_CASE(tok, _, str) \
4043
case tok: \
41-
if (str == "") \
44+
if (!strcmp(str, "")) \
4245
throw std::runtime_error("No token for: " + kindToString(kind)); \
4346
return str;
4447
TC_FORALL_TOKEN_KINDS(DEFINE_CASE)

0 commit comments

Comments
 (0)