diff --git a/boundaries/boundaryhandling.py b/boundaries/boundaryhandling.py
index 722984da14bbd20e1647567e4ffdcc7086f41a2e..7d52c8a1b2f52ba032661f85b60c253ae2b7f30e 100644
--- a/boundaries/boundaryhandling.py
+++ b/boundaries/boundaryhandling.py
@@ -90,7 +90,8 @@ class LbmWeightInfo(CustomCppCode):
 
     def __init__(self, lb_method):
         weights = [str(w.evalf()) for w in lb_method.weights]
-        code = "const double %s [] = { %s };\n" % (LbmWeightInfo.WEIGHTS_SYMBOL.name, ",".join(weights))
+        code = "const double __attribute__((unused)) %s [] = { %s };\n" % (
+                   LbmWeightInfo.WEIGHTS_SYMBOL.name, ",".join(weights))
         super(LbmWeightInfo, self).__init__(code, symbols_read=set(),
                                             symbols_defined={LbmWeightInfo.WEIGHTS_SYMBOL})