Skip to content

Commit

Permalink
Fix compile warnings (#648)
Browse files Browse the repository at this point in the history
* Fix compile warnings for GCC

* Add empty default case

* Initialise adj and free unconditionaly

* Remove blank lines
  • Loading branch information
Joseph-Edwards authored May 13, 2024
1 parent 9ea9163 commit 3b42ed7
Show file tree
Hide file tree
Showing 30 changed files with 202 additions and 20 deletions.
3 changes: 1 addition & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ AS_IF([test "x$enable_compile_warnings" != "xno"],
AS_IF([test "x$enable_compile_warnings" != "xno"],
[ax_enable_compile_warnings=yes
AX_COMPILER_FLAGS_CFLAGS([WARNING_CFLAGS], [], [ dnl
-pedantic dnl
-Wold-style-cast])
-pedantic dnl])
AC_SUBST([WARNING_CFLAGS])])

# Check for system planarity suite
Expand Down
7 changes: 7 additions & 0 deletions extern/bliss-0.73/bliss_C.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ extern "C" {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wold-style-cast"
#pragma clang diagnostic ignored "-Wsign-compare"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wold-style-cast"
#pragma GCC diagnostic ignored "-Wsign-compare"
#pragma GCC diagnostic ignored "-Wmissing-declarations"
#endif

struct bliss_digraphs_graph_struct {
Expand Down Expand Up @@ -238,4 +243,6 @@ void bliss_digraphs_free_blissstats(BlissStats *stats)

#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
7 changes: 7 additions & 0 deletions extern/bliss-0.73/defs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wformat-nonliteral"
#pragma clang diagnostic ignored "-Wmissing-noreturn"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
#pragma GCC diagnostic ignored "-Wmissing-noreturn"
#pragma GCC diagnostic ignored "-Wsuggest-attribute=format"
#endif
namespace bliss_digraphs {

Expand All @@ -42,4 +47,6 @@ namespace bliss_digraphs {

#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
3 changes: 3 additions & 0 deletions extern/bliss-0.73/graph.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wold-style-cast"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wold-style-cast"
#endif

namespace bliss_digraphs {
Expand Down
6 changes: 6 additions & 0 deletions extern/bliss-0.73/timer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wold-style-cast"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wold-style-cast"
#pragma GCC diagnostic ignored "-Wuninitialized"
#endif

namespace bliss_digraphs {
Expand Down Expand Up @@ -60,4 +64,6 @@ double Timer::get_duration()
} // namespace bliss_digraphs
#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ extern void _ClearVertexVisitedFlags(graphP theGraph, int);
#pragma clang diagnostic ignored "-Wstrict-prototypes"
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wdeprecated-non-prototype"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
#endif

int gp_CreateDFSTree(graphP theGraph)
Expand Down Expand Up @@ -459,4 +463,6 @@ printf("LeastAncestor in %.3lf seconds.\n", platform_GetDuration(start,end));
}
#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ See the LICENSE.TXT file for licensing information.
#pragma clang diagnostic ignored "-Wstrict-prototypes"
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wdeprecated-non-prototype"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
#endif

#include "graphDrawPlanar.h"
Expand Down Expand Up @@ -1047,4 +1051,6 @@ int v, e, eTwin, EsizeOccupied, epos, eposIndex;
}
#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,22 @@ Copyright (c) 1997-2020, John M. Boyer
All rights reserved.
See the LICENSE.TXT file for licensing information.
*/

#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wstrict-prototypes"
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wdeprecated-non-prototype"
#endif

#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wstrict-prototypes"
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wdeprecated-non-prototype"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
#endif

#include <stdlib.h>

#include "graphDrawPlanar.private.h"
#include "graphDrawPlanar.h"



extern void _ClearVertexVisitedFlags(graphP theGraph, int);

Expand Down Expand Up @@ -59,7 +61,7 @@ void _DrawPlanar_FreeContext(void *);
/****************************************************************************
* DRAWPLANAR_ID - the variable used to hold the integer identifier for this
* extension, enabling this feature's extension context to be distinguished
* from other features' extension contexts that may be attached to a graph.
* from other features' extension contexts that may be attached to a graph.
****************************************************************************/

int DRAWPLANAR_ID = 0;
Expand Down Expand Up @@ -687,6 +689,8 @@ int _DrawPlanar_WritePostprocess(graphP theGraph, void **pExtraData, long *pExt

return NOTOK;
}
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ See the LICENSE.TXT file for licensing information.
#pragma clang diagnostic ignored "-Wstrict-prototypes"
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wdeprecated-non-prototype"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
#endif

/* Imported functions */
Expand Down Expand Up @@ -1369,4 +1373,6 @@ int e_u, e_v, e_ulink, e_vlink;

#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ See the LICENSE.TXT file for licensing information.
#include "graphExtensions.h"
#include "graphFunctionTable.h"

#ifdef __GNUC__
#ifndef __clang__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
#endif
#endif

/* Imported functions */

extern void _InitFunctionTable(graphP theGraph);
Expand All @@ -30,7 +37,7 @@ graphExtensionP _FindNearestOverload(graphP theGraph, graphExtensionP target, in
* An ID identifies an extension, which may be added to multiple
* graphs. It is used in lieu of identifying extensions by a string
* name, which is noticeably expensive when a frequently called
* overload function seeks the extension context for a graph.
* overload function seeks the extension context for a graph.
********************************************************************/

static int moduleIDGenerator = 0;
Expand Down Expand Up @@ -544,3 +551,9 @@ void _FreeExtension(graphExtensionP extension)
}
free(extension);
}

#ifdef __GNUC__
#ifndef __clang__
#pragma GCC diagnostic pop
#endif
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ extern "C" {
#pragma clang diagnostic ignored "-Wstrict-prototypes"
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wdeprecated-non-prototype"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
#endif

typedef struct
Expand Down Expand Up @@ -65,6 +69,8 @@ typedef graphFunctionTable * graphFunctionTableP;

#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif

#ifdef __cplusplus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ See the LICENSE.TXT file for licensing information.
#pragma clang diagnostic ignored "-Wdeprecated-non-prototype"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types-discards-qualifiers"
#pragma clang diagnostic ignored "-Wformat-nonliteral"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
#pragma GCC diagnostic ignored "-Wdiscarded-qualifiers"
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
#pragma GCC diagnostic ignored "-Wunused-result"
#endif

#include <stdlib.h>
Expand Down Expand Up @@ -762,4 +769,6 @@ char *_MakeLogStr5(char *format, int one, int two, int three, int four, int five
}
#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ See the LICENSE.TXT file for licensing information.
#pragma clang diagnostic ignored "-Wstrict-prototypes"
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wdeprecated-non-prototype"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
#endif
#define GRAPHISOLATOR_C

Expand Down Expand Up @@ -831,4 +835,6 @@ int _DeleteUnmarkedVerticesAndEdges(graphP theGraph)
}
#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ See the LICENSE.TXT file for licensing information.
#pragma clang diagnostic ignored "-Wstrict-prototypes"
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wdeprecated-non-prototype"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
#endif
#include "graph.h"

Expand Down Expand Up @@ -271,4 +275,6 @@ int u, d, XorY;
}
#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ See the LICENSE.TXT file for licensing information.
#pragma clang diagnostic ignored "-Wstrict-prototypes"
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wdeprecated-non-prototype"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
#endif

#include <stdlib.h>
Expand Down Expand Up @@ -255,4 +259,6 @@ int _K23Search_CheckObstructionIntegrity(graphP theGraph, graphP origGraph)
}
#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ See the LICENSE.TXT file for licensing information.
#pragma clang diagnostic ignored "-Wstrict-prototypes"
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wdeprecated-non-prototype"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
#endif

#include "graphK33Search.h"
Expand Down Expand Up @@ -2055,4 +2059,6 @@ int u_min, u_max, d, u_d;
}
#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ See the LICENSE.TXT file for licensing information.
#pragma clang diagnostic ignored "-Wstrict-prototypes"
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wdeprecated-non-prototype"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
#endif
#include <stdlib.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ See the LICENSE.TXT file for licensing information.
#pragma clang diagnostic ignored "-Wstrict-prototypes"
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wdeprecated-non-prototype"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
#endif
#include "graphK4Search.h"
#include "graphK4Search.private.h"
Expand Down Expand Up @@ -1481,4 +1485,6 @@ int _K4_RestoreAndOrientReducedPaths(graphP theGraph, K4SearchContext *context)
}
#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ See the LICENSE.TXT file for licensing information.
#pragma clang diagnostic ignored "-Wstrict-prototypes"
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wdeprecated-non-prototype"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
#endif
#include <stdlib.h>

Expand Down Expand Up @@ -502,4 +506,6 @@ int _K4Search_CheckObstructionIntegrity(graphP theGraph, graphP origGraph)

#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ See the LICENSE.TXT file for licensing information.
#pragma clang diagnostic ignored "-Wstrict-prototypes"
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wdeprecated-non-prototype"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
#endif

/* Imported functions */
Expand Down Expand Up @@ -203,4 +207,6 @@ isolatorContextP IC = &theGraph->IC;
}
#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
Loading

0 comments on commit 3b42ed7

Please sign in to comment.