summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2014-05-28 22:27:34 -0700
committerIan Rogers <irogers@google.com>2014-05-28 23:03:42 -0700
commit31124d583cfcd1ea9407856747c178d0125c1070 (patch)
tree7687d4b570cf991cb8536adb4dbc1501f5cd4394
parent079e6e4cfbd1a0b1ab2e94e6d52a7304321ae597 (diff)
downloadsrec-31124d583cfcd1ea9407856747c178d0125c1070.tar.gz
Revert "Revert "Fix the mac build.""
This reverts commit a8a167d6883e4acee42619e0bbfd811984f6e94d. Also, workaround a clang 3.5 issue bug: 15319952 Change-Id: If2ec321d63d9484c21208339f66eb6a16b65bf74
-rw-r--r--srec/include/portable.h5
-rw-r--r--tools/grxmlcompile/Android.mk7
-rw-r--r--tools/make_cfst/Android.mk4
-rw-r--r--tools/thirdparty/OpenFst/fst/lib/Android.mk6
-rw-r--r--tools/thirdparty/OpenFst/fst/lib/const-fst.h6
-rw-r--r--tools/thirdparty/OpenFst/fst/lib/encode.h12
-rw-r--r--tools/thirdparty/OpenFst/fst/lib/fst-decl.h4
-rw-r--r--tools/thirdparty/OpenFst/fst/lib/fst.cpp12
-rw-r--r--tools/thirdparty/OpenFst/fst/lib/symbol-table.cpp12
-rw-r--r--tools/thirdparty/OpenFst/fst/lib/vector-fst.h6
10 files changed, 50 insertions, 24 deletions
diff --git a/srec/include/portable.h b/srec/include/portable.h
index 3d39931..c9cc0ea 100644
--- a/srec/include/portable.h
+++ b/srec/include/portable.h
@@ -38,11 +38,6 @@ static const char portable_h[] = "$Id: portable.h,v 1.4.10.4 2007/10/15 18:06:25
#define ASSERT passert
-/* QNX defines log in math.h */
-#ifndef log
-#define log(X) ((X) <= 1e-32 ? -MAX_LOG : log(X))
-/* #define exp(X) ((X) < FLT_MIN_EXP ? 0.0 : exp(X)) */
-#endif
/* Allocation macros
*/
diff --git a/tools/grxmlcompile/Android.mk b/tools/grxmlcompile/Android.mk
index 4c9fe44..82d931a 100644
--- a/tools/grxmlcompile/Android.mk
+++ b/tools/grxmlcompile/Android.mk
@@ -63,8 +63,13 @@ LOCAL_CFLAGS += -DOPENFSTSDK
LOCAL_SHARED_LIBRARIES += libfst
endif
+LOCAL_CLANG := true
+
LOCAL_CPPFLAGS += -std=c++11
+# Workaround clang 3.5 bug: b/15319952
+LOCAL_CFLAGS += -O1
+
LOCAL_STATIC_LIBRARIES := \
libtinyxml \
@@ -75,4 +80,6 @@ LOCAL_LDLIBS := \
LOCAL_MODULE:= grxmlcompile
+include external/libcxx/libcxx.mk
+
include $(BUILD_HOST_EXECUTABLE)
diff --git a/tools/make_cfst/Android.mk b/tools/make_cfst/Android.mk
index 16470cd..9c7cc5a 100644
--- a/tools/make_cfst/Android.mk
+++ b/tools/make_cfst/Android.mk
@@ -24,6 +24,8 @@ LOCAL_CFLAGS += \
$(ASR_GLOBAL_DEFINES) \
$(ASR_GLOBAL_CPPFLAGS) \
+LOCAL_CLANG := true
+
LOCAL_CPPFLAGS += -std=c++11
LOCAL_SHARED_LIBRARIES := \
@@ -51,4 +53,6 @@ endif
LOCAL_MODULE:= make_cfst
+include external/libcxx/libcxx.mk
+
include $(BUILD_HOST_EXECUTABLE)
diff --git a/tools/thirdparty/OpenFst/fst/lib/Android.mk b/tools/thirdparty/OpenFst/fst/lib/Android.mk
index 6e89e3c..dfd3686 100644
--- a/tools/thirdparty/OpenFst/fst/lib/Android.mk
+++ b/tools/thirdparty/OpenFst/fst/lib/Android.mk
@@ -16,7 +16,9 @@ LOCAL_C_INCLUDES := \
LOCAL_CFLAGS += \
-DFST_DL \
-LOCAL_CPPFLAGS += -std=c++11
+LOCAL_CLANG := true
+
+LOCAL_CPPFLAGS += -std=c++11
LOCAL_SHARED_LIBRARIES := \
@@ -24,4 +26,6 @@ LOCAL_LDLIBS += -lpthread
LOCAL_MODULE := libfst
+include external/libcxx/libcxx.mk
+
include $(BUILD_HOST_SHARED_LIBRARY)
diff --git a/tools/thirdparty/OpenFst/fst/lib/const-fst.h b/tools/thirdparty/OpenFst/fst/lib/const-fst.h
index ebeeb34..01196c9 100644
--- a/tools/thirdparty/OpenFst/fst/lib/const-fst.h
+++ b/tools/thirdparty/OpenFst/fst/lib/const-fst.h
@@ -211,9 +211,11 @@ bool ConstFstImpl<A>::Write(ostream &strm,
strm.write("", 1);
strm.write(reinterpret_cast<char *>(arcs_), narcs_ * sizeof(A));
strm.flush();
- if (!strm)
+ if (!strm) {
LOG(ERROR) << "ConstFst::Write: Write failed: " << opts.source;
- return strm;
+ return false;
+ }
+ return true;
}
// Simple concrete immutable FST. This class attaches interface to
diff --git a/tools/thirdparty/OpenFst/fst/lib/encode.h b/tools/thirdparty/OpenFst/fst/lib/encode.h
index b577d4a..e21ff20 100644
--- a/tools/thirdparty/OpenFst/fst/lib/encode.h
+++ b/tools/thirdparty/OpenFst/fst/lib/encode.h
@@ -137,9 +137,11 @@ template <class A> class EncodeTable {
tuple->weight.Write(strm);
}
strm.flush();
- if (!strm)
+ if (!strm) {
LOG(ERROR) << "EncodeTable::Write: write failed: " << source;
- return strm;
+ return false;
+ }
+ return true;
}
bool Read(istream &strm, const string &source) {
@@ -166,9 +168,11 @@ template <class A> class EncodeTable {
encode_tuples_.push_back(tuple);
encode_hash_[encode_tuples_.back()] = encode_tuples_.size();
}
- if (!strm)
+ if (!strm) {
LOG(ERROR) << "EncodeTable::Read: read failed: " << source;
- return strm;
+ return false;
+ }
+ return true;
}
uint32 flags() const { return flags_; }
diff --git a/tools/thirdparty/OpenFst/fst/lib/fst-decl.h b/tools/thirdparty/OpenFst/fst/lib/fst-decl.h
index a5cdc75..0a18b38 100644
--- a/tools/thirdparty/OpenFst/fst/lib/fst-decl.h
+++ b/tools/thirdparty/OpenFst/fst/lib/fst-decl.h
@@ -27,8 +27,8 @@ class SymbolTableIterator;
class LogWeight;
class TropicalWeight;
-class LogArc;
-class StdArc;
+struct LogArc;
+struct StdArc;
template <class A> class ConstFst;
template <class A> class ExpandedFst;
diff --git a/tools/thirdparty/OpenFst/fst/lib/fst.cpp b/tools/thirdparty/OpenFst/fst/lib/fst.cpp
index 3b8c9ef..6ec0884 100644
--- a/tools/thirdparty/OpenFst/fst/lib/fst.cpp
+++ b/tools/thirdparty/OpenFst/fst/lib/fst.cpp
@@ -65,9 +65,11 @@ bool FstHeader::Read(istream &strm, const string &source) {
ReadType(strm, &start_);
ReadType(strm, &numstates_);
ReadType(strm, &numarcs_);
- if (!strm)
+ if (!strm) {
LOG(ERROR) << "FstHeader::Read: read failed: " << source;
- return strm;
+ return false;
+ }
+ return true;
}
// Write Fst magic number and Fst header.
@@ -81,9 +83,11 @@ bool FstHeader::Write(ostream &strm, const string &source) const {
WriteType(strm, start_);
WriteType(strm, numstates_);
WriteType(strm, numarcs_);
- if (!strm)
+ if (!strm) {
LOG(ERROR) << "FstHeader::Write: write failed: " << source;
- return strm;
+ return false;
+ }
+ return true;
}
}
diff --git a/tools/thirdparty/OpenFst/fst/lib/symbol-table.cpp b/tools/thirdparty/OpenFst/fst/lib/symbol-table.cpp
index d4715da..a27d3cf 100644
--- a/tools/thirdparty/OpenFst/fst/lib/symbol-table.cpp
+++ b/tools/thirdparty/OpenFst/fst/lib/symbol-table.cpp
@@ -138,9 +138,11 @@ bool SymbolTableImpl::Write(ostream &strm) const {
WriteType(strm, it->second);
}
strm.flush();
- if (!strm)
+ if (!strm) {
LOG(ERROR) << "SymbolTable::Write: write failed";
- return strm;
+ return false;
+ }
+ return true;
}
bool SymbolTableImpl::WriteText(ostream &strm) const {
@@ -150,9 +152,11 @@ bool SymbolTableImpl::WriteText(ostream &strm) const {
strm.write(line, strlen(line));
}
strm.flush();
- if (!strm)
+ if (!strm) {
LOG(ERROR) << "SymbolTable::WriteText: write failed";
- return strm;
+ return false;
+ }
+ return true;
}
} // namespace fst
diff --git a/tools/thirdparty/OpenFst/fst/lib/vector-fst.h b/tools/thirdparty/OpenFst/fst/lib/vector-fst.h
index fde934a..b5603d6 100644
--- a/tools/thirdparty/OpenFst/fst/lib/vector-fst.h
+++ b/tools/thirdparty/OpenFst/fst/lib/vector-fst.h
@@ -440,9 +440,11 @@ bool VectorFstImpl<A>::Write(ostream &strm,
}
}
strm.flush();
- if (!strm)
+ if (!strm) {
LOG(ERROR) << "VectorFst::Write: write failed: " << opts.source;
- return strm;
+ return false;
+ }
+ return true;
}
// Simple concrete, mutable FST. Supports additional operations: