From 9e5925c956b8e4a332a24e3dd7be6b45f409a91f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Radek=20Hu=C5=A1ek?= <PitelVonSacek@gmail.com>
Date: Fri, 11 Dec 2015 00:07:08 +0100
Subject: [PATCH] Silence compiler warnings

---
 group-connectivity.h | 2 +-
 setup.py             | 5 ++++-
 twoCuts.h            | 9 ++++-----
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/group-connectivity.h b/group-connectivity.h
index 0199836..3e00fb0 100644
--- a/group-connectivity.h
+++ b/group-connectivity.h
@@ -47,7 +47,7 @@ struct Tester : public AbstractTester {
 # if !USE_NEXT_FORB
   size_t numForb;
 # endif
-  int edges;
+  size_t edges;
 
   std::vector<EdgeId> classEdges;
   std::vector< std::pair<EdgeId, Mapping> > nonClassEdges;
diff --git a/setup.py b/setup.py
index 18360a7..28102c4 100644
--- a/setup.py
+++ b/setup.py
@@ -9,7 +9,10 @@ setup(
     Extension("groupConnectivity",
       sources = ["groupConnectivity.pyx"],
       language="c++",
-      extra_compile_args=["-std=gnu++11", "-O2", "-funroll-loops"]
+      extra_compile_args=[
+        "-std=gnu++11", "-O2", "-funroll-loops", "-fwrapv",
+        "-Wall", "-fno-strict-aliasing"
+      ]
     )
   ])
 )
diff --git a/twoCuts.h b/twoCuts.h
index c42a9ed..e644c33 100644
--- a/twoCuts.h
+++ b/twoCuts.h
@@ -9,9 +9,9 @@ struct TwoCutInt {
   static const int num_classes = (Ring::size * (Ring::size - 1)) / 2;
 
   struct Tables {
-    char decodeMatrix[Ring::size][Ring::size];
-    struct { char a, b; } encodeTable[max_value];
-    char classMatrix[Ring::size][Ring::size];
+    signed char decodeMatrix[Ring::size][Ring::size];
+    struct { signed char a, b; } encodeTable[max_value];
+    signed char classMatrix[Ring::size][Ring::size];
 
     Tables() {
       encodeTable[0] = {1, 2};
@@ -30,7 +30,7 @@ struct TwoCutInt {
 
       memset(classMatrix, -1, sizeof(classMatrix));
 
-      struct { char a, b; } classTable[num_classes];
+      struct { signed char a, b; } classTable[num_classes];
       classTable[0] = {0, 1};
 
       for (int i = 1; i < num_classes; i++) {
@@ -59,7 +59,6 @@ struct TwoCutInt {
   }
 
   inline int getClass(const Mapping &map) const {
-    int ret = S.classMatrix[map[a]][flip ? Ring::negate(map[b]) : map[b]];
     return S.classMatrix[map[a]][flip ? Ring::negate(map[b]) : map[b]];
   }
 };
-- 
GitLab