Skip to content

Commit 3b42ed7

Browse files
Fix compile warnings (#648)
* Fix compile warnings for GCC * Add empty default case * Initialise adj and free unconditionaly * Remove blank lines
1 parent 9ea9163 commit 3b42ed7

30 files changed

Lines changed: 202 additions & 20 deletions

configure.ac

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,7 @@ AS_IF([test "x$enable_compile_warnings" != "xno"],
8787
AS_IF([test "x$enable_compile_warnings" != "xno"],
8888
[ax_enable_compile_warnings=yes
8989
AX_COMPILER_FLAGS_CFLAGS([WARNING_CFLAGS], [], [ dnl
90-
-pedantic dnl
91-
-Wold-style-cast])
90+
-pedantic dnl])
9291
AC_SUBST([WARNING_CFLAGS])])
9392

9493
# Check for system planarity suite

extern/bliss-0.73/bliss_C.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ extern "C" {
2929
#pragma clang diagnostic push
3030
#pragma clang diagnostic ignored "-Wold-style-cast"
3131
#pragma clang diagnostic ignored "-Wsign-compare"
32+
#elif defined(__GNUC__)
33+
#pragma GCC diagnostic push
34+
#pragma GCC diagnostic ignored "-Wold-style-cast"
35+
#pragma GCC diagnostic ignored "-Wsign-compare"
36+
#pragma GCC diagnostic ignored "-Wmissing-declarations"
3237
#endif
3338

3439
struct bliss_digraphs_graph_struct {
@@ -238,4 +243,6 @@ void bliss_digraphs_free_blissstats(BlissStats *stats)
238243

239244
#if defined(__clang__)
240245
#pragma clang diagnostic pop
246+
#elif defined(__GNUC__)
247+
#pragma GCC diagnostic pop
241248
#endif

extern/bliss-0.73/defs.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525
#pragma clang diagnostic push
2626
#pragma clang diagnostic ignored "-Wformat-nonliteral"
2727
#pragma clang diagnostic ignored "-Wmissing-noreturn"
28+
#elif defined(__GNUC__)
29+
#pragma GCC diagnostic push
30+
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
31+
#pragma GCC diagnostic ignored "-Wmissing-noreturn"
32+
#pragma GCC diagnostic ignored "-Wsuggest-attribute=format"
2833
#endif
2934
namespace bliss_digraphs {
3035

@@ -42,4 +47,6 @@ namespace bliss_digraphs {
4247

4348
#if defined(__clang__)
4449
#pragma clang diagnostic pop
50+
#elif defined(__GNUC__)
51+
#pragma GCC diagnostic pop
4552
#endif

extern/bliss-0.73/graph.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333
#if defined(__clang__)
3434
#pragma clang diagnostic push
3535
#pragma clang diagnostic ignored "-Wold-style-cast"
36+
#elif defined(__GNUC__)
37+
#pragma GCC diagnostic push
38+
#pragma GCC diagnostic ignored "-Wold-style-cast"
3639
#endif
3740

3841
namespace bliss_digraphs {

extern/bliss-0.73/timer.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
#if defined(__clang__)
2525
#pragma clang diagnostic push
2626
#pragma clang diagnostic ignored "-Wold-style-cast"
27+
#elif defined(__GNUC__)
28+
#pragma GCC diagnostic push
29+
#pragma GCC diagnostic ignored "-Wold-style-cast"
30+
#pragma GCC diagnostic ignored "-Wuninitialized"
2731
#endif
2832

2933
namespace bliss_digraphs {
@@ -60,4 +64,6 @@ double Timer::get_duration()
6064
} // namespace bliss_digraphs
6165
#if defined(__clang__)
6266
#pragma clang diagnostic pop
67+
#elif defined(__GNUC__)
68+
#pragma GCC diagnostic pop
6369
#endif

extern/edge-addition-planarity-suite-Version_3.0.1.0/c/graphDFSUtils.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ extern void _ClearVertexVisitedFlags(graphP theGraph, int);
3131
#pragma clang diagnostic ignored "-Wstrict-prototypes"
3232
#pragma clang diagnostic ignored "-Wmissing-prototypes"
3333
#pragma clang diagnostic ignored "-Wdeprecated-non-prototype"
34+
#elif defined(__GNUC__)
35+
#pragma GCC diagnostic push
36+
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
37+
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
3438
#endif
3539

3640
int gp_CreateDFSTree(graphP theGraph)
@@ -459,4 +463,6 @@ printf("LeastAncestor in %.3lf seconds.\n", platform_GetDuration(start,end));
459463
}
460464
#if defined(__clang__)
461465
#pragma clang diagnostic pop
466+
#elif defined(__GNUC__)
467+
#pragma GCC diagnostic pop
462468
#endif

extern/edge-addition-planarity-suite-Version_3.0.1.0/c/graphDrawPlanar.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ See the LICENSE.TXT file for licensing information.
99
#pragma clang diagnostic ignored "-Wstrict-prototypes"
1010
#pragma clang diagnostic ignored "-Wmissing-prototypes"
1111
#pragma clang diagnostic ignored "-Wdeprecated-non-prototype"
12+
#elif defined(__GNUC__)
13+
#pragma GCC diagnostic push
14+
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
15+
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
1216
#endif
1317

1418
#include "graphDrawPlanar.h"
@@ -1047,4 +1051,6 @@ int v, e, eTwin, EsizeOccupied, epos, eposIndex;
10471051
}
10481052
#if defined(__clang__)
10491053
#pragma clang diagnostic pop
1054+
#elif defined(__GNUC__)
1055+
#pragma GCC diagnostic pop
10501056
#endif

extern/edge-addition-planarity-suite-Version_3.0.1.0/c/graphDrawPlanar_Extensions.c

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,22 @@ Copyright (c) 1997-2020, John M. Boyer
33
All rights reserved.
44
See the LICENSE.TXT file for licensing information.
55
*/
6-
7-
#if defined(__clang__)
8-
#pragma clang diagnostic push
9-
#pragma clang diagnostic ignored "-Wstrict-prototypes"
10-
#pragma clang diagnostic ignored "-Wmissing-prototypes"
11-
#pragma clang diagnostic ignored "-Wdeprecated-non-prototype"
12-
#endif
6+
7+
#if defined(__clang__)
8+
#pragma clang diagnostic push
9+
#pragma clang diagnostic ignored "-Wstrict-prototypes"
10+
#pragma clang diagnostic ignored "-Wmissing-prototypes"
11+
#pragma clang diagnostic ignored "-Wdeprecated-non-prototype"
12+
#elif defined(__GNUC__)
13+
#pragma GCC diagnostic push
14+
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
15+
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
16+
#endif
1317

1418
#include <stdlib.h>
1519

1620
#include "graphDrawPlanar.private.h"
1721
#include "graphDrawPlanar.h"
18-
19-
2022

2123
extern void _ClearVertexVisitedFlags(graphP theGraph, int);
2224

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

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

688690
return NOTOK;
689691
}
690-
#if defined(__clang__)
691-
#pragma clang diagnostic pop
692-
#endif
692+
#if defined(__clang__)
693+
#pragma clang diagnostic pop
694+
#elif defined(__GNUC__)
695+
#pragma GCC diagnostic pop
696+
#endif

extern/edge-addition-planarity-suite-Version_3.0.1.0/c/graphEmbed.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ See the LICENSE.TXT file for licensing information.
1313
#pragma clang diagnostic ignored "-Wstrict-prototypes"
1414
#pragma clang diagnostic ignored "-Wmissing-prototypes"
1515
#pragma clang diagnostic ignored "-Wdeprecated-non-prototype"
16+
#elif defined(__GNUC__)
17+
#pragma GCC diagnostic push
18+
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
19+
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
1620
#endif
1721

1822
/* Imported functions */
@@ -1369,4 +1373,6 @@ int e_u, e_v, e_ulink, e_vlink;
13691373

13701374
#if defined(__clang__)
13711375
#pragma clang diagnostic pop
1376+
#elif defined(__GNUC__)
1377+
#pragma GCC diagnostic pop
13721378
#endif

extern/edge-addition-planarity-suite-Version_3.0.1.0/c/graphExtensions.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ See the LICENSE.TXT file for licensing information.
1313
#include "graphExtensions.h"
1414
#include "graphFunctionTable.h"
1515

16+
#ifdef __GNUC__
17+
#ifndef __clang__
18+
#pragma GCC diagnostic push
19+
#pragma GCC diagnostic ignored "-Wshadow"
20+
#endif
21+
#endif
22+
1623
/* Imported functions */
1724

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

3643
static int moduleIDGenerator = 0;
@@ -544,3 +551,9 @@ void _FreeExtension(graphExtensionP extension)
544551
}
545552
free(extension);
546553
}
554+
555+
#ifdef __GNUC__
556+
#ifndef __clang__
557+
#pragma GCC diagnostic pop
558+
#endif
559+
#endif

0 commit comments

Comments
 (0)