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

+202
-20
lines changed

configure.ac

+1-2
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

+7
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

+7
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

+3
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

+6
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

+6
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

+6
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

+17-13
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

+6
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

+14-1
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

extern/edge-addition-planarity-suite-Version_3.0.1.0/c/graphFunctionTable.h

+6
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ extern "C" {
2121
#pragma clang diagnostic ignored "-Wstrict-prototypes"
2222
#pragma clang diagnostic ignored "-Wmissing-prototypes"
2323
#pragma clang diagnostic ignored "-Wdeprecated-non-prototype"
24+
#elif defined(__GNUC__)
25+
#pragma GCC diagnostic push
26+
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
27+
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
2428
#endif
2529

2630
typedef struct
@@ -65,6 +69,8 @@ typedef graphFunctionTable * graphFunctionTableP;
6569

6670
#if defined(__clang__)
6771
#pragma clang diagnostic pop
72+
#elif defined(__GNUC__)
73+
#pragma GCC diagnostic pop
6874
#endif
6975

7076
#ifdef __cplusplus

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

+9
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ See the LICENSE.TXT file for licensing information.
1010
#pragma clang diagnostic ignored "-Wdeprecated-non-prototype"
1111
#pragma clang diagnostic ignored "-Wincompatible-pointer-types-discards-qualifiers"
1212
#pragma clang diagnostic ignored "-Wformat-nonliteral"
13+
#elif defined(__GNUC__)
14+
#pragma GCC diagnostic push
15+
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
16+
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
17+
#pragma GCC diagnostic ignored "-Wdiscarded-qualifiers"
18+
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
19+
#pragma GCC diagnostic ignored "-Wunused-result"
1320
#endif
1421

1522
#include <stdlib.h>
@@ -762,4 +769,6 @@ char *_MakeLogStr5(char *format, int one, int two, int three, int four, int five
762769
}
763770
#if defined(__clang__)
764771
#pragma clang diagnostic pop
772+
#elif defined(__GNUC__)
773+
#pragma GCC diagnostic pop
765774
#endif

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

+6
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
#define GRAPHISOLATOR_C
1418

@@ -831,4 +835,6 @@ int _DeleteUnmarkedVerticesAndEdges(graphP theGraph)
831835
}
832836
#if defined(__clang__)
833837
#pragma clang diagnostic pop
838+
#elif defined(__GNUC__)
839+
#pragma GCC diagnostic pop
834840
#endif

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

+6
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
#include "graph.h"
1418

@@ -271,4 +275,6 @@ int u, d, XorY;
271275
}
272276
#if defined(__clang__)
273277
#pragma clang diagnostic pop
278+
#elif defined(__GNUC__)
279+
#pragma GCC diagnostic pop
274280
#endif

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

+6
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 <stdlib.h>
@@ -255,4 +259,6 @@ int _K23Search_CheckObstructionIntegrity(graphP theGraph, graphP origGraph)
255259
}
256260
#if defined(__clang__)
257261
#pragma clang diagnostic pop
262+
#elif defined(__GNUC__)
263+
#pragma GCC diagnostic pop
258264
#endif

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

+6
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 "graphK33Search.h"
@@ -2055,4 +2059,6 @@ int u_min, u_max, d, u_d;
20552059
}
20562060
#if defined(__clang__)
20572061
#pragma clang diagnostic pop
2062+
#elif defined(__GNUC__)
2063+
#pragma GCC diagnostic pop
20582064
#endif

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

+4
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
#include <stdlib.h>
1418

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

+6
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
#include "graphK4Search.h"
1418
#include "graphK4Search.private.h"
@@ -1481,4 +1485,6 @@ int _K4_RestoreAndOrientReducedPaths(graphP theGraph, K4SearchContext *context)
14811485
}
14821486
#if defined(__clang__)
14831487
#pragma clang diagnostic pop
1488+
#elif defined(__GNUC__)
1489+
#pragma GCC diagnostic pop
14841490
#endif

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

+6
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
#include <stdlib.h>
1418

@@ -502,4 +506,6 @@ int _K4Search_CheckObstructionIntegrity(graphP theGraph, graphP origGraph)
502506

503507
#if defined(__clang__)
504508
#pragma clang diagnostic pop
509+
#elif defined(__GNUC__)
510+
#pragma GCC diagnostic pop
505511
#endif

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

+6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ See the LICENSE.TXT file for licensing information.
1111
#pragma clang diagnostic ignored "-Wstrict-prototypes"
1212
#pragma clang diagnostic ignored "-Wmissing-prototypes"
1313
#pragma clang diagnostic ignored "-Wdeprecated-non-prototype"
14+
#elif defined(__GNUC__)
15+
#pragma GCC diagnostic push
16+
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
17+
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
1418
#endif
1519

1620
/* Imported functions */
@@ -203,4 +207,6 @@ isolatorContextP IC = &theGraph->IC;
203207
}
204208
#if defined(__clang__)
205209
#pragma clang diagnostic pop
210+
#elif defined(__GNUC__)
211+
#pragma GCC diagnostic pop
206212
#endif

0 commit comments

Comments
 (0)