Skip to content

Commit 4c78c72

Browse files
ardbiesheuvelkees
authored andcommitted
gcc-plugins: remove support for GCC 4.9 and older
The minimum GCC version has been bumped to 5.1, so we can get rid of all the compatibility code for anything older than that. Signed-off-by: Ard Biesheuvel <[email protected]> Signed-off-by: Kees Cook <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent f02003c commit 4c78c72

File tree

6 files changed

+1
-208
lines changed

6 files changed

+1
-208
lines changed

scripts/gcc-plugins/gcc-common.h

Lines changed: 1 addition & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@
2727
#include "except.h"
2828
#include "function.h"
2929
#include "toplev.h"
30-
#if BUILDING_GCC_VERSION >= 5000
3130
#include "expr.h"
32-
#endif
3331
#include "basic-block.h"
3432
#include "intl.h"
3533
#include "ggc.h"
@@ -39,11 +37,7 @@
3937
#include "params.h"
4038
#endif
4139

42-
#if BUILDING_GCC_VERSION <= 4009
43-
#include "pointer-set.h"
44-
#else
4540
#include "hash-map.h"
46-
#endif
4741

4842
#if BUILDING_GCC_VERSION >= 7000
4943
#include "memmodel.h"
@@ -99,9 +93,7 @@
9993
#include "gimple-ssa.h"
10094
#include "ssa-iterators.h"
10195

102-
#if BUILDING_GCC_VERSION >= 5000
10396
#include "builtins.h"
104-
#endif
10597

10698
/* missing from basic_block.h... */
10799
void debug_dominance_info(enum cdi_direction dir);
@@ -152,125 +144,6 @@ struct register_pass_info NAME##_pass_info = { \
152144
#define TODO_dump_func 0
153145
#define TODO_dump_cgraph 0
154146

155-
#if BUILDING_GCC_VERSION <= 4009
156-
#define TODO_verify_il 0
157-
#define AVAIL_INTERPOSABLE AVAIL_OVERWRITABLE
158-
159-
#define section_name_prefix LTO_SECTION_NAME_PREFIX
160-
#define fatal_error(loc, gmsgid, ...) fatal_error((gmsgid), __VA_ARGS__)
161-
162-
rtx emit_move_insn(rtx x, rtx y);
163-
164-
typedef struct rtx_def rtx_insn;
165-
166-
static inline const char *get_decl_section_name(const_tree decl)
167-
{
168-
if (DECL_SECTION_NAME(decl) == NULL_TREE)
169-
return NULL;
170-
171-
return TREE_STRING_POINTER(DECL_SECTION_NAME(decl));
172-
}
173-
174-
static inline void set_decl_section_name(tree node, const char *value)
175-
{
176-
if (value)
177-
DECL_SECTION_NAME(node) = build_string(strlen(value) + 1, value);
178-
else
179-
DECL_SECTION_NAME(node) = NULL;
180-
}
181-
#endif
182-
183-
#if BUILDING_GCC_VERSION == 4009
184-
typedef struct gimple_statement_asm gasm;
185-
typedef struct gimple_statement_base gassign;
186-
typedef struct gimple_statement_call gcall;
187-
typedef struct gimple_statement_base gcond;
188-
typedef struct gimple_statement_base gdebug;
189-
typedef struct gimple_statement_base ggoto;
190-
typedef struct gimple_statement_phi gphi;
191-
typedef struct gimple_statement_base greturn;
192-
193-
static inline gasm *as_a_gasm(gimple stmt)
194-
{
195-
return as_a<gasm>(stmt);
196-
}
197-
198-
static inline const gasm *as_a_const_gasm(const_gimple stmt)
199-
{
200-
return as_a<const gasm>(stmt);
201-
}
202-
203-
static inline gassign *as_a_gassign(gimple stmt)
204-
{
205-
return stmt;
206-
}
207-
208-
static inline const gassign *as_a_const_gassign(const_gimple stmt)
209-
{
210-
return stmt;
211-
}
212-
213-
static inline gcall *as_a_gcall(gimple stmt)
214-
{
215-
return as_a<gcall>(stmt);
216-
}
217-
218-
static inline const gcall *as_a_const_gcall(const_gimple stmt)
219-
{
220-
return as_a<const gcall>(stmt);
221-
}
222-
223-
static inline gcond *as_a_gcond(gimple stmt)
224-
{
225-
return stmt;
226-
}
227-
228-
static inline const gcond *as_a_const_gcond(const_gimple stmt)
229-
{
230-
return stmt;
231-
}
232-
233-
static inline gdebug *as_a_gdebug(gimple stmt)
234-
{
235-
return stmt;
236-
}
237-
238-
static inline const gdebug *as_a_const_gdebug(const_gimple stmt)
239-
{
240-
return stmt;
241-
}
242-
243-
static inline ggoto *as_a_ggoto(gimple stmt)
244-
{
245-
return stmt;
246-
}
247-
248-
static inline const ggoto *as_a_const_ggoto(const_gimple stmt)
249-
{
250-
return stmt;
251-
}
252-
253-
static inline gphi *as_a_gphi(gimple stmt)
254-
{
255-
return as_a<gphi>(stmt);
256-
}
257-
258-
static inline const gphi *as_a_const_gphi(const_gimple stmt)
259-
{
260-
return as_a<const gphi>(stmt);
261-
}
262-
263-
static inline greturn *as_a_greturn(gimple stmt)
264-
{
265-
return stmt;
266-
}
267-
268-
static inline const greturn *as_a_const_greturn(const_gimple stmt)
269-
{
270-
return stmt;
271-
}
272-
#endif
273-
274147
#define TODO_ggc_collect 0
275148
#define NODE_SYMBOL(node) (node)
276149
#define NODE_DECL(node) (node)->decl
@@ -282,7 +155,7 @@ static inline opt_pass *get_pass_for_id(int id)
282155
return g->get_passes()->get_pass_for_id(id);
283156
}
284157

285-
#if BUILDING_GCC_VERSION >= 5000 && BUILDING_GCC_VERSION < 6000
158+
#if BUILDING_GCC_VERSION < 6000
286159
/* gimple related */
287160
template <>
288161
template <>
@@ -292,7 +165,6 @@ inline bool is_a_helper<const gassign *>::test(const_gimple gs)
292165
}
293166
#endif
294167

295-
#if BUILDING_GCC_VERSION >= 5000
296168
#define TODO_verify_ssa TODO_verify_il
297169
#define TODO_verify_flow TODO_verify_il
298170
#define TODO_verify_stmts TODO_verify_il
@@ -533,7 +405,6 @@ static inline void ipa_remove_stmt_references(symtab_node *referring_node, gimpl
533405
{
534406
referring_node->remove_stmt_references(stmt);
535407
}
536-
#endif
537408

538409
#if BUILDING_GCC_VERSION < 6000
539410
#define get_inner_reference(exp, pbitsize, pbitpos, poffset, pmode, punsignedp, preversep, pvolatilep, keep_aligning) \

scripts/gcc-plugins/gcc-generate-gimple-pass.h

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -78,17 +78,6 @@ static const pass_data _PASS_NAME_PASS_DATA = {
7878
.type = GIMPLE_PASS,
7979
.name = _PASS_NAME_NAME,
8080
.optinfo_flags = OPTGROUP_NONE,
81-
#if BUILDING_GCC_VERSION >= 5000
82-
#elif BUILDING_GCC_VERSION == 4009
83-
.has_gate = _HAS_GATE,
84-
.has_execute = _HAS_EXECUTE,
85-
#else
86-
.gate = _GATE,
87-
.execute = _EXECUTE,
88-
.sub = NULL,
89-
.next = NULL,
90-
.static_pass_number = 0,
91-
#endif
9281
.tv_id = TV_NONE,
9382
.properties_required = PROPERTIES_REQUIRED,
9483
.properties_provided = PROPERTIES_PROVIDED,
@@ -102,21 +91,13 @@ class _PASS_NAME_PASS : public gimple_opt_pass {
10291
_PASS_NAME_PASS() : gimple_opt_pass(_PASS_NAME_PASS_DATA, g) {}
10392

10493
#ifndef NO_GATE
105-
#if BUILDING_GCC_VERSION >= 5000
10694
virtual bool gate(function *) { return _GATE(); }
107-
#else
108-
virtual bool gate(void) { return _GATE(); }
109-
#endif
11095
#endif
11196

11297
virtual opt_pass * clone () { return new _PASS_NAME_PASS(); }
11398

11499
#ifndef NO_EXECUTE
115-
#if BUILDING_GCC_VERSION >= 5000
116100
virtual unsigned int execute(function *) { return _EXECUTE(); }
117-
#else
118-
virtual unsigned int execute(void) { return _EXECUTE(); }
119-
#endif
120101
};
121102
}
122103

scripts/gcc-plugins/gcc-generate-ipa-pass.h

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -146,17 +146,6 @@ static const pass_data _PASS_NAME_PASS_DATA = {
146146
.type = IPA_PASS,
147147
.name = _PASS_NAME_NAME,
148148
.optinfo_flags = OPTGROUP_NONE,
149-
#if BUILDING_GCC_VERSION >= 5000
150-
#elif BUILDING_GCC_VERSION == 4009
151-
.has_gate = _HAS_GATE,
152-
.has_execute = _HAS_EXECUTE,
153-
#else
154-
.gate = _GATE,
155-
.execute = _EXECUTE,
156-
.sub = NULL,
157-
.next = NULL,
158-
.static_pass_number = 0,
159-
#endif
160149
.tv_id = TV_NONE,
161150
.properties_required = PROPERTIES_REQUIRED,
162151
.properties_provided = PROPERTIES_PROVIDED,
@@ -180,20 +169,12 @@ class _PASS_NAME_PASS : public ipa_opt_pass_d {
180169
_VARIABLE_TRANSFORM) {}
181170

182171
#ifndef NO_GATE
183-
#if BUILDING_GCC_VERSION >= 5000
184172
virtual bool gate(function *) { return _GATE(); }
185-
#else
186-
virtual bool gate(void) { return _GATE(); }
187-
#endif
188173

189174
virtual opt_pass *clone() { return new _PASS_NAME_PASS(); }
190175

191176
#ifndef NO_EXECUTE
192-
#if BUILDING_GCC_VERSION >= 5000
193177
virtual unsigned int execute(function *) { return _EXECUTE(); }
194-
#else
195-
virtual unsigned int execute(void) { return _EXECUTE(); }
196-
#endif
197178
#endif
198179
};
199180
}

scripts/gcc-plugins/gcc-generate-rtl-pass.h

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -78,17 +78,6 @@ static const pass_data _PASS_NAME_PASS_DATA = {
7878
.type = RTL_PASS,
7979
.name = _PASS_NAME_NAME,
8080
.optinfo_flags = OPTGROUP_NONE,
81-
#if BUILDING_GCC_VERSION >= 5000
82-
#elif BUILDING_GCC_VERSION == 4009
83-
.has_gate = _HAS_GATE,
84-
.has_execute = _HAS_EXECUTE,
85-
#else
86-
.gate = _GATE,
87-
.execute = _EXECUTE,
88-
.sub = NULL,
89-
.next = NULL,
90-
.static_pass_number = 0,
91-
#endif
9281
.tv_id = TV_NONE,
9382
.properties_required = PROPERTIES_REQUIRED,
9483
.properties_provided = PROPERTIES_PROVIDED,
@@ -102,21 +91,13 @@ class _PASS_NAME_PASS : public rtl_opt_pass {
10291
_PASS_NAME_PASS() : rtl_opt_pass(_PASS_NAME_PASS_DATA, g) {}
10392

10493
#ifndef NO_GATE
105-
#if BUILDING_GCC_VERSION >= 5000
10694
virtual bool gate(function *) { return _GATE(); }
107-
#else
108-
virtual bool gate(void) { return _GATE(); }
109-
#endif
11095
#endif
11196

11297
virtual opt_pass *clone() { return new _PASS_NAME_PASS(); }
11398

11499
#ifndef NO_EXECUTE
115-
#if BUILDING_GCC_VERSION >= 5000
116100
virtual unsigned int execute(function *) { return _EXECUTE(); }
117-
#else
118-
virtual unsigned int execute(void) { return _EXECUTE(); }
119-
#endif
120101
#endif
121102
};
122103
}

scripts/gcc-plugins/gcc-generate-simple_ipa-pass.h

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -78,17 +78,6 @@ static const pass_data _PASS_NAME_PASS_DATA = {
7878
.type = SIMPLE_IPA_PASS,
7979
.name = _PASS_NAME_NAME,
8080
.optinfo_flags = OPTGROUP_NONE,
81-
#if BUILDING_GCC_VERSION >= 5000
82-
#elif BUILDING_GCC_VERSION == 4009
83-
.has_gate = _HAS_GATE,
84-
.has_execute = _HAS_EXECUTE,
85-
#else
86-
.gate = _GATE,
87-
.execute = _EXECUTE,
88-
.sub = NULL,
89-
.next = NULL,
90-
.static_pass_number = 0,
91-
#endif
9281
.tv_id = TV_NONE,
9382
.properties_required = PROPERTIES_REQUIRED,
9483
.properties_provided = PROPERTIES_PROVIDED,
@@ -102,21 +91,13 @@ class _PASS_NAME_PASS : public simple_ipa_opt_pass {
10291
_PASS_NAME_PASS() : simple_ipa_opt_pass(_PASS_NAME_PASS_DATA, g) {}
10392

10493
#ifndef NO_GATE
105-
#if BUILDING_GCC_VERSION >= 5000
10694
virtual bool gate(function *) { return _GATE(); }
107-
#else
108-
virtual bool gate(void) { return _GATE(); }
109-
#endif
11095
#endif
11196

11297
virtual opt_pass *clone() { return new _PASS_NAME_PASS(); }
11398

11499
#ifndef NO_EXECUTE
115-
#if BUILDING_GCC_VERSION >= 5000
116100
virtual unsigned int execute(function *) { return _EXECUTE(); }
117-
#else
118-
virtual unsigned int execute(void) { return _EXECUTE(); }
119-
#endif
120101
#endif
121102
};
122103
}

scripts/gcc-plugins/structleak_plugin.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,8 @@ static void finish_type(void *event_data, void *data)
103103
if (type == NULL_TREE || type == error_mark_node)
104104
return;
105105

106-
#if BUILDING_GCC_VERSION >= 5000
107106
if (TREE_CODE(type) == ENUMERAL_TYPE)
108107
return;
109-
#endif
110108

111109
if (TYPE_USERSPACE(type))
112110
return;

0 commit comments

Comments
 (0)