Commit f0fdd2bf authored by Michael Beck's avatar Michael Beck
Browse files

- constify

[r25801]
parent 99993cb3
......@@ -816,8 +816,8 @@ ident *get_tpop_ident(const tp_op *op);
* This struct is dynamically allocated but constant for the lifetime
* of the library.
*/
extern tp_op *type_class;
tp_op *get_tpop_class(void);
extern const tp_op *type_class;
const tp_op *get_tpop_class(void);
/**
* This type opcode marks that the corresponding type is a compound type
......@@ -828,8 +828,8 @@ tp_op *get_tpop_class(void);
* This struct is dynamically allocated but constant for the lifetime
* of the library.
*/
extern tp_op *type_struct;
tp_op *get_tpop_struct(void);
extern const tp_op *type_struct;
const tp_op *get_tpop_struct(void);
/**
* This type opcode marks that the corresponding type is a method type.
......@@ -838,8 +838,8 @@ tp_op *get_tpop_struct(void);
* This struct is dynamically allocated but constant for the lifetime
* of the library.
*/
extern tp_op *type_method;
tp_op *get_tpop_method(void);
extern const tp_op *type_method;
const tp_op *get_tpop_method(void);
/**
* This type opcode marks that the corresponding type is a union type.
......@@ -848,8 +848,8 @@ tp_op *get_tpop_method(void);
* This struct is dynamically allocated but constant for the lifetime
* of the library.
*/
extern tp_op *type_union;
tp_op *get_tpop_union(void);
extern const tp_op *type_union;
const tp_op *get_tpop_union(void);
/**
* This type opcode marks that the corresponding type is an array type.
......@@ -859,8 +859,8 @@ tp_op *get_tpop_union(void);
* This struct is dynamically allocated but constant for the lifetime
* of the library.
*/
extern tp_op *type_array;
tp_op *get_tpop_array(void);
extern const tp_op *type_array;
const tp_op *get_tpop_array(void);
/**
* This type opcode marks that the corresponding type is an enumeration type.
......@@ -871,8 +871,8 @@ tp_op *get_tpop_array(void);
* This struct is dynamically allocated but constant for the lifetime
* of the library.
*/
extern tp_op *type_enumeration;
tp_op *get_tpop_enumeration(void);
extern const tp_op *type_enumeration;
const tp_op *get_tpop_enumeration(void);
/**
* This type opcode marks that the corresponding type is a pointer type.
......@@ -881,8 +881,8 @@ tp_op *get_tpop_enumeration(void);
* This struct is dynamically allocated but constant for the lifetime
* of the library.
*/
extern tp_op *type_pointer;
tp_op *get_tpop_pointer(void);
extern const tp_op *type_pointer;
const tp_op *get_tpop_pointer(void);
/**
* This type opcode marks that the corresponding type is a primitive type.
......@@ -892,8 +892,8 @@ tp_op *get_tpop_pointer(void);
* This struct is dynamically allocated but constant for the lifetime
* of the library.
*/
extern tp_op *type_primitive;
tp_op *get_tpop_primitive(void);
extern const tp_op *type_primitive;
const tp_op *get_tpop_primitive(void);
/**
* This type opcode is an auxiliary opcode dedicated to support transformations
......@@ -912,8 +912,8 @@ tp_op *get_tpop_primitive(void);
* This struct is dynamically allocated but constant for the lifetime
* of the library.
*/
extern tp_op *type_id;
tp_op *get_tpop_id(void);
extern const tp_op *type_id;
const tp_op *get_tpop_id(void);
/**
* This type opcode is an auxiliary opcode dedicated to support type analyses.
......@@ -923,8 +923,8 @@ tp_op *get_tpop_id(void);
* contain a type or that are initialized for an analysis. There exists exactly
* one type with this opcode.
*/
extern tp_op *tpop_none;
tp_op *get_tpop_none(void);
extern const tp_op *tpop_none;
const tp_op *get_tpop_none(void);
/**
* This type opcode is an auxiliary opcode dedicated to support type analyses.
......@@ -934,8 +934,8 @@ tp_op *get_tpop_none(void);
* yet) or to represent the top of a lattice (could not be determined). There exists
* exactly one type with this opcode.
*/
extern tp_op *tpop_unknown;
tp_op *get_tpop_unknown(void);
extern const tp_op *tpop_unknown;
const tp_op *get_tpop_unknown(void);
/* ----------------------------------------------------------------------- */
/* Classify pairs of types/entities in the inheritance relations. */
......
......@@ -30,21 +30,20 @@
#include "type_t.h"
#include "ident.h"
tp_op *type_class; tp_op *get_tpop_class (void) { return type_class; }
tp_op *type_struct; tp_op *get_tpop_struct (void) { return type_struct; }
tp_op *type_method; tp_op *get_tpop_method (void) { return type_method; }
tp_op *type_union; tp_op *get_tpop_union (void) { return type_union; }
tp_op *type_array; tp_op *get_tpop_array (void) { return type_array; }
tp_op *type_enumeration; tp_op *get_tpop_enumeration(void) { return type_enumeration; }
tp_op *type_pointer; tp_op *get_tpop_pointer (void) { return type_pointer; }
tp_op *type_primitive; tp_op *get_tpop_primitive (void) { return type_primitive; }
tp_op *type_id; tp_op *get_tpop_id (void) { return type_id; }
tp_op *tpop_none; tp_op *get_tpop_none (void) { return tpop_none; }
tp_op *tpop_unknown; tp_op *get_tpop_unknown (void) { return tpop_unknown; }
const tp_op *type_class; const tp_op *get_tpop_class (void) { return type_class; }
const tp_op *type_struct; const tp_op *get_tpop_struct (void) { return type_struct; }
const tp_op *type_method; const tp_op *get_tpop_method (void) { return type_method; }
const tp_op *type_union; const tp_op *get_tpop_union (void) { return type_union; }
const tp_op *type_array; const tp_op *get_tpop_array (void) { return type_array; }
const tp_op *type_enumeration; const tp_op *get_tpop_enumeration(void) { return type_enumeration; }
const tp_op *type_pointer; const tp_op *get_tpop_pointer (void) { return type_pointer; }
const tp_op *type_primitive; const tp_op *get_tpop_primitive (void) { return type_primitive; }
const tp_op *type_id; const tp_op *get_tpop_id (void) { return type_id; }
const tp_op *tpop_none; const tp_op *get_tpop_none (void) { return tpop_none; }
const tp_op *tpop_unknown; const tp_op *get_tpop_unknown (void) { return tpop_unknown; }
tp_op *
new_tpop(tp_opcode code, ident *name, unsigned flags, size_t attr_size,
const tp_op_ops *ops)
const tp_op *
new_tpop(tp_opcode code, ident *name, unsigned flags, size_t attr_size, const tp_op_ops *ops)
{
tp_op *res = XMALLOC(tp_op);
res->code = code;
......@@ -61,8 +60,8 @@ new_tpop(tp_opcode code, ident *name, unsigned flags, size_t attr_size,
}
void
free_tpop(tp_op *tpop) {
free(tpop);
free_tpop(const tp_op *tpop) {
xfree((void *)tpop);
}
static const tp_op_ops
......@@ -199,7 +198,7 @@ void finish_tpop(void) {
free_tpop(type_id ); type_id = NULL;
free_tpop(tpop_none ); tpop_none = NULL;
free_tpop(tpop_unknown ); tpop_unknown = NULL;
}
}
/* Returns the string for the tp_opcode. */
const char *get_tpop_name(const tp_op *op) {
......
......@@ -101,13 +101,12 @@ struct tp_op {
* @param ops the tp_op operations for this type
* @return A new type opcode.
*/
tp_op *new_tpop (tp_opcode code, ident *name, unsigned flags, size_t attr_size,
const tp_op_ops *ops);
const tp_op *new_tpop (tp_opcode code, ident *name, unsigned flags, size_t attr_size, const tp_op_ops *ops);
/**
* Free a tpop datastructure.
* Free a tpop data structure.
*/
void free_tpop(tp_op *tpop);
void free_tpop(const tp_op *tpop);
/**
* Initialize the tpop module.
......@@ -118,7 +117,7 @@ void free_tpop(tp_op *tpop);
* Allocates opcodes for classes, struct, method, union, array,
* enumeration, pointer and primitive and sets the according values.
*/
void init_tpop (void);
void init_tpop(void);
/**
* Finalize the tpop module.
......
......@@ -113,7 +113,7 @@ void (inc_master_type_visited)(void) { _inc_master_type_visited(); }
* Creates a new type representation.
*/
ir_type *
new_type(tp_op *type_op, ir_mode *mode, ident *name, dbg_info *db) {
new_type(const tp_op *type_op, ir_mode *mode, ident *name, dbg_info *db) {
ir_type *res;
int node_size;
......
......@@ -254,7 +254,7 @@ struct ir_type {
* initialized. The type is in state layout_undefined.
*/
ir_type *
new_type(tp_op *type_op, ir_mode *mode, ident *name, dbg_info *db);
new_type(const tp_op *type_op, ir_mode *mode, ident *name, dbg_info *db);
void free_type_attrs (ir_type *tp);
void free_class_entities (ir_type *clss);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment