Make test.cpp compilable with GCC.

Add clean rule to Makefile.
This commit is contained in:
Andrew Twyman 2015-06-17 18:02:34 -07:00
parent 50ed8c90e5
commit 61ba0a1dd2
2 changed files with 8 additions and 2 deletions

View File

@ -1,2 +1,7 @@
test: json11.cpp json11.hpp test.cpp test: json11.cpp json11.hpp test.cpp
clang++ -O -std=c++11 -stdlib=libc++ json11.cpp test.cpp -o test -fno-rtti -fno-exceptions $(CXX) -O -std=c++11 json11.cpp test.cpp -o test -fno-rtti -fno-exceptions
clean:
if [ -e test ]; then rm test; fi
.PHONY: clean

View File

@ -1,5 +1,6 @@
#include <string> #include <string>
#include <cstdio> #include <cstdio>
#include <cstring>
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#include "json11.hpp" #include "json11.hpp"
@ -89,7 +90,7 @@ int main(int argc, char **argv) {
Json uni = Json::parse(unicode_escape_test, err); Json uni = Json::parse(unicode_escape_test, err);
assert(uni[0].string_value().size() == (sizeof utf8) - 1); assert(uni[0].string_value().size() == (sizeof utf8) - 1);
assert(memcmp(uni[0].string_value().data(), utf8, sizeof utf8) == 0); assert(std::memcmp(uni[0].string_value().data(), utf8, sizeof utf8) == 0);
// Demonstrates the behavior change in Xcode 7 / Clang 3.7 described // Demonstrates the behavior change in Xcode 7 / Clang 3.7 described
// here: https://llvm.org/bugs/show_bug.cgi?id=23812 // here: https://llvm.org/bugs/show_bug.cgi?id=23812