From 3019e0a51b208a58ad7d7b99a46060dea3db6201 Mon Sep 17 00:00:00 2001 From: Henrik Stolzmann <henrik.stolzmann@mailbox.tu-dresden.de> Date: Thu, 11 Apr 2019 15:55:51 +0200 Subject: [PATCH 1/8] Fixed warning: variable "count" set but unused for compiler test "gcc-8-noassert-17" ```` I added the attribute "DUNE_UNUSED" to the variable "count" to avoid the warning: "variable set but unused". This warning was only occuring in the compiler-test "gcc-8-noassert-17" ```` --- dev/ugdevices.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dev/ugdevices.cc b/dev/ugdevices.cc index f0f278c42..22789f53c 100644 --- a/dev/ugdevices.cc +++ b/dev/ugdevices.cc @@ -47,6 +47,8 @@ /* dev module */ #include <dev/ugdevices.h> +#include <dune/common/unused.hh> + #include "namespace.h" /* dddif module */ @@ -270,7 +272,7 @@ int NS_PREFIX UserWriteF (const char *format, ...) { char buffer[VAR_ARG_BUFLEN]; va_list args; - int count; + DUNE_UNUSED int count; /* initialize args */ va_start(args,format); -- GitLab From 72b5268b057775eb47cf46be9676d8b6b64434d4 Mon Sep 17 00:00:00 2001 From: Henrik Stolzmann <henrik.stolzmann@mailbox.tu-dresden.de> Date: Thu, 11 Apr 2019 16:06:22 +0200 Subject: [PATCH 2/8] Fixed warning: variable "sideNode" set but not used ```` I added the attribute "DUNE_UNUSED" to the variable "sideNode" to avoid the warning: "variable set but not used". ```` --- gm/ugm.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gm/ugm.cc b/gm/ugm.cc index 49fc088dd..61a88510d 100644 --- a/gm/ugm.cc +++ b/gm/ugm.cc @@ -55,6 +55,7 @@ #include "fifo.h" #include <dev/ugdevices.h> +#include <dune/common/unused.hh> #include "evm.h" #include "gm.h" @@ -4866,7 +4867,7 @@ ELEMENT * NS_DIM_PREFIX InsertElement (GRID *theGrid, INT n, NODE **Node, ELEMEN MULTIGRID *theMG; INT i,j,k,m,rv,tag,ElementType; INT NeighborSide[MAX_SIDES_OF_ELEM]; - NODE *sideNode[MAX_CORNERS_OF_SIDE]; + DUNE_UNUSED NODE *sideNode[MAX_CORNERS_OF_SIDE]; VERTEX *Vertex[MAX_CORNERS_OF_ELEM],*sideVertex[MAX_CORNERS_OF_SIDE]; ELEMENT *theElement,*Neighbor[MAX_SIDES_OF_ELEM]; BNDS *bnds[MAX_SIDES_OF_ELEM]; -- GitLab From 3190cf1c4d47ae358f6d38f4dbf34a6a3ad67bca Mon Sep 17 00:00:00 2001 From: Henrik Stolzmann <henrik.stolzmann@mailbox.tu-dresden.de> Date: Thu, 11 Apr 2019 16:12:07 +0200 Subject: [PATCH 3/8] Fixed warning: variable "D" set but not used ```` I added the attribute "DUNE_UNUSED" to the variable "D" to avoid the warning: "variable set but unused". ```` --- gm/evm.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gm/evm.cc b/gm/evm.cc index 730c4ad6c..91f3966c7 100644 --- a/gm/evm.cc +++ b/gm/evm.cc @@ -40,6 +40,7 @@ #include "evm.h" #include "general.h" #include <dev/ugdevices.h> +#include <dune/common/unused.hh> #include "elements.h" @@ -145,7 +146,7 @@ REP_ERR_FILE bool NS_DIM_PREFIX PointInPolygon (const COORD_POINT *Points, INT n, COORD_POINT Point) { - DOUBLE D[POLYMAX] ,tau[POLYMAX],xa,ya,xe,ye; + DUNE_UNUSED DOUBLE D[POLYMAX] ,tau[POLYMAX],xa,ya,xe,ye; int i, left, right; assert (n<=POLYMAX); -- GitLab From 6fc7f7dfd4976688366b22a23d4323d9c9c1e16d Mon Sep 17 00:00:00 2001 From: Henrik Stolzmann <henrik.stolzmann@mailbox.tu-dresden.de> Date: Thu, 11 Apr 2019 16:16:29 +0200 Subject: [PATCH 4/8] Fixed warning: variable "FatherEdge" set but not used ```` I added the attribute "DUNE_UNUSED" to the variable "FatherEdge" to avoid the warning: "variable set but unused". ```` --- parallel/dddif/identify.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parallel/dddif/identify.cc b/parallel/dddif/identify.cc index e6688ed59..aacb33c31 100644 --- a/parallel/dddif/identify.cc +++ b/parallel/dddif/identify.cc @@ -846,7 +846,7 @@ static INT IdentifyEdge (GRID *theGrid, if (0) if (CORNERTYPE(Nodes[0]) && CORNERTYPE(Nodes[1])) { - EDGE *FatherEdge; + DUNE_UNUSED EDGE *FatherEdge; FatherEdge = GetEdge((NODE *)NFATHER(Nodes[0]),(NODE *)NFATHER(Nodes[1])); ASSERT(FatherEdge != NULL); return(0); -- GitLab From 218279441506e812858726f326e93ce1924b55be Mon Sep 17 00:00:00 2001 From: Henrik Stolzmann <henrik.stolzmann@mailbox.tu-dresden.de> Date: Thu, 11 Apr 2019 16:21:20 +0200 Subject: [PATCH 5/8] Fixed warning: variable "theEdge" set but not used ```` I added the attribute "DUNE_UNUSED" to the variable "theEdge" to avoid the warning: "variable set but not used". ```` --- gm/ugm.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gm/ugm.cc b/gm/ugm.cc index 61a88510d..74d2ea9d1 100644 --- a/gm/ugm.cc +++ b/gm/ugm.cc @@ -2603,7 +2603,7 @@ INT NS_DIM_PREFIX CreateSonElementSide (GRID *theGrid, ELEMENT *theElement, INT BNDS *bnds; BNDP *bndp[MAX_CORNERS_OF_ELEM]; VECTOR *vec; - EDGE *theEdge; + DUNE_UNUSED EDGE *theEdge; ASSERT (OBJT(theElement) == BEOBJ); -- GitLab From d521758b8b859702ecdcfdcfafc27bc4aa99ff40 Mon Sep 17 00:00:00 2001 From: Henrik Stolzmann <henrik.stolzmann@mailbox.tu-dresden.de> Date: Thu, 11 Apr 2019 16:28:48 +0200 Subject: [PATCH 6/8] Fixed warning: variable "STAT_MOD" set but unused ```` I added the attribute "DUNE_UNUSED" to the variable "STAT_MOD" to avoid the warning: "unused variable". ```` --- parallel/ddd/if/ifcreate.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/parallel/ddd/if/ifcreate.cc b/parallel/ddd/if/ifcreate.cc index a57233fd5..29c67b0fe 100644 --- a/parallel/ddd/if/ifcreate.cc +++ b/parallel/ddd/if/ifcreate.cc @@ -49,6 +49,7 @@ #include <dune/common/exceptions.hh> #include <dune/common/stdstreams.hh> +#include <dune/common/unused.hh> #include "dddi.h" #include "if.h" @@ -241,7 +242,7 @@ static RETCODE IFCreateFromScratch(DDD::DDDContext& context, COUPLING **tmpcpl, IF_ATTR *ifAttr = nullptr, *lastIfAttr = nullptr; int n, i; DDD_PROC lastproc; - int STAT_MOD; + DUNE_UNUSED int STAT_MOD; const auto& objTable = context.objTable(); -- GitLab From 9f22df14af261fd58093f73ae2ab40f27ec4630c Mon Sep 17 00:00:00 2001 From: Henrik Stolzmann <henrik.stolzmann@mailbox.tu-dresden.de> Date: Thu, 11 Apr 2019 18:24:50 +0200 Subject: [PATCH 7/8] Fixed the warning regarding "count" I added a preprocessor if-condition to check whether "NDEBUG" is defined or not. All uses of "count" are contained in this if statement. --- dev/ugdevices.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/dev/ugdevices.cc b/dev/ugdevices.cc index 22789f53c..2788b70fa 100644 --- a/dev/ugdevices.cc +++ b/dev/ugdevices.cc @@ -47,8 +47,6 @@ /* dev module */ #include <dev/ugdevices.h> -#include <dune/common/unused.hh> - #include "namespace.h" /* dddif module */ @@ -272,14 +270,14 @@ int NS_PREFIX UserWriteF (const char *format, ...) { char buffer[VAR_ARG_BUFLEN]; va_list args; - DUNE_UNUSED int count; /* initialize args */ va_start(args,format); - + #ifndef NDEBUG + int count; count = vsprintf(buffer,format,args); assert(count<VAR_ARG_BUFLEN-1); - + #endif if (mutelevel>-1000) printf("%s", buffer); -- GitLab From e6069eda8273821e41b0b464cdaafdef9269123f Mon Sep 17 00:00:00 2001 From: Henrik Stolzmann <henrik.stolzmann@mailbox.tu-dresden.de> Date: Tue, 16 Apr 2019 20:07:08 +0200 Subject: [PATCH 8/8] Defined and initialized "count" in one line Changed ```` int count; count = vsprintf(buffer,format,args) ```` to ```` int count = vsprintf(buffer,format,args) ```` --- dev/ugdevices.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dev/ugdevices.cc b/dev/ugdevices.cc index 2788b70fa..d6e8fc0a8 100644 --- a/dev/ugdevices.cc +++ b/dev/ugdevices.cc @@ -274,8 +274,7 @@ int NS_PREFIX UserWriteF (const char *format, ...) /* initialize args */ va_start(args,format); #ifndef NDEBUG - int count; - count = vsprintf(buffer,format,args); + int count = vsprintf(buffer,format,args); assert(count<VAR_ARG_BUFLEN-1); #endif if (mutelevel>-1000) -- GitLab