Skip to content

Fixes to build #9

@mingodad

Description

@mingodad

I just cloned this project (actually https://github.com/stevenknown/xoc but it has not enabled issues there) and tried to build but got some warnings and an error related to try use of HeapSort::HeapValVector<T> hdata(data); with clang++ (6 and 11) and g++9.

Here is the output of git diff -u of my changes to be able to build it:

diff --git a/com/flty.cpp b/com/flty.cpp
index 0a44cbf..5f02c1b 100644
--- a/com/flty.cpp
+++ b/com/flty.cpp
@@ -129,7 +129,7 @@ void Float::dump() const
 {
     StrBuf buf(16);
     format(buf);
-    fprintf(stdout, buf.buf);
+    fprintf(stdout, "%s", buf.buf);
 }
 
 } //namespace xcom
diff --git a/com/rational.cpp b/com/rational.cpp
index 4464267..8b8911f 100644
--- a/com/rational.cpp
+++ b/com/rational.cpp
@@ -139,7 +139,7 @@ void Rational::dump() const
 {
     StrBuf buf(16);
     format(buf);
-    fprintf(stdout, buf.buf);
+    fprintf(stdout, "%s", buf.buf);
 }
 
 
diff --git a/com/sort.cpp b/com/sort.cpp
index 8c2acc7..b37a75c 100644
--- a/com/sort.cpp
+++ b/com/sort.cpp
@@ -54,7 +54,7 @@ public:
     DumpHeap(Vector<T> & data)
     {
         if (data.get_last_idx() < 0) { return; }
-        HeapSort::HeapValVector<T> hdata(data);
+        HeapSort<int>::HeapValVector<T> hdata(data);
         m_pool = smpoolCreate(64, MEM_COMM);
         UINT node_count = 1;
         for (UINT i = hdata.get_begin_idx(); i <= hdata.get_end_idx(); i++) {
diff --git a/com/sort.h b/com/sort.h
index a2ea8cd..3659dda 100644
--- a/com/sort.h
+++ b/com/sort.h
@@ -120,7 +120,7 @@ void Bucket<T>::dump()
     INT j = 0;
     printf("\nBUCKET");
     for (UINT i = 0; i < Hash<T>::m_bucket_size; i++) {
-        printf("\n\tB%d:", i);
+        printf("\n\tB%ud:", i);
         HC<T> * elemhc = (HC<T>*)HB_member(Hash<T>::m_bucket[i]);
         while (elemhc != nullptr) {
             printf("%f,", HC_val(elemhc));
diff --git a/dex/dex_const_info.h b/dex/dex_const_info.h
index d006707..91351f1 100644
--- a/dex/dex_const_info.h
+++ b/dex/dex_const_info.h
@@ -110,7 +110,13 @@ author: Su Zhenyu
 #define HAS_PREDICATE_REGISTER false
 
 //Define the max/min integer value range of target machine.
+#ifdef MIN_HOST_INT_VALUE
+#undef MIN_HOST_INT_VALUE
+#endif
 #define MIN_HOST_INT_VALUE 0x80000000
+#ifdef MAX_HOST_INT_VALUE
+#undef MAX_HOST_INT_VALUE
+#endif
 #define MAX_HOST_INT_VALUE 0x7fffFFFF
 #define EPSILON 0.000001

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions