WIP MachO binutils port assisted by AI I may consider upstreaming this in the future.
0

Configure Feed

Select the types of activity you want to include in your feed.

sim: ppc: constify strings in igen tooling

Mike Frysinger (Oct 31, 2021, 10:34 PM EDT) fc3579da e7360783

+51 -50
+4 -4
sim/ppc/filter.c
··· 40 40 while (strlen(filt) > 0) { 41 41 filter *new_filter; 42 42 /* break up the filt list */ 43 - char *end = strchr(filt, ','); 44 - char *next; 43 + const char *end = strchr(filt, ','); 44 + const char *next; 45 45 int len; 46 46 if (end == NULL) { 47 47 end = strchr(filt, '\0'); ··· 71 71 int present; 72 72 filter *filt = filters; 73 73 /* break the string up */ 74 - char *end = strchr(flags, ','); 75 - char *next; 74 + const char *end = strchr(flags, ','); 75 + const char *next; 76 76 int len; 77 77 if (end == NULL) { 78 78 end = strchr(flags, '\0');
+2 -2
sim/ppc/gen-icache.c
··· 366 366 367 367 typedef struct _icache_tree icache_tree; 368 368 struct _icache_tree { 369 - char *name; 369 + const char *name; 370 370 icache_tree *next; 371 371 icache_tree *children; 372 372 }; 373 373 374 374 static icache_tree * 375 375 icache_tree_insert(icache_tree *tree, 376 - char *name) 376 + const char *name) 377 377 { 378 378 icache_tree *new_tree; 379 379 /* find it */
+6 -6
sim/ppc/gen-itable.c
··· 64 64 /* output the table that contains the actual instruction info */ 65 65 lf_printf(file, "typedef struct _itable_instruction_info {\n"); 66 66 lf_printf(file, " itable_index nr;\n"); 67 - lf_printf(file, " char *format;\n"); 68 - lf_printf(file, " char *form;\n"); 69 - lf_printf(file, " char *flags;\n"); 70 - lf_printf(file, " char *mnemonic;\n"); 71 - lf_printf(file, " char *name;\n"); 72 - lf_printf(file, " char *file;\n"); 67 + lf_printf(file, " const char *format;\n"); 68 + lf_printf(file, " const char *form;\n"); 69 + lf_printf(file, " const char *flags;\n"); 70 + lf_printf(file, " const char *mnemonic;\n"); 71 + lf_printf(file, " const char *name;\n"); 72 + lf_printf(file, " const char *file;\n"); 73 73 lf_printf(file, " int line_nr;\n"); 74 74 lf_printf(file, "} itable_info;\n"); 75 75 lf_printf(file, "\n");
+4 -4
sim/ppc/gen-model.c
··· 48 48 model_c_or_h_function(insn_table *entry, 49 49 lf *file, 50 50 table_entry *function, 51 - char *prefix) 51 + const char *prefix) 52 52 { 53 53 if (function->fields[function_type] == NULL 54 54 || function->fields[function_type][0] == '\0') { ··· 68 68 insn *insn_ptr; 69 69 model *model_ptr; 70 70 insn *macro; 71 - char *name; 71 + const char *name; 72 72 int model_create_p = 0; 73 73 int model_init_p = 0; 74 74 int model_halt_p = 0; ··· 174 174 { 175 175 model_c_passed_data *data_ptr = (model_c_passed_data *)data; 176 176 lf *file = data_ptr->file; 177 - char *current_name = data_ptr->model_ptr->printable_name; 177 + const char *current_name = data_ptr->model_ptr->printable_name; 178 178 table_model_entry *model_ptr = instruction->file_entry->model_first; 179 179 180 180 while (model_ptr) { ··· 229 229 { 230 230 insn *insn_ptr; 231 231 model *model_ptr; 232 - char *name; 232 + const char *name; 233 233 int model_create_p = 0; 234 234 int model_init_p = 0; 235 235 int model_halt_p = 0;
+5 -4
sim/ppc/ld-cache.c
··· 42 42 43 43 44 44 void 45 - append_cache_rule (cache_table **table, char *type, char *field_name, 46 - char *derived_name, char *type_def, 47 - char *expression, table_entry *file_entry) 45 + append_cache_rule (cache_table **table, const char *type, 46 + const char *field_name, const char *derived_name, 47 + const char *type_def, const char *expression, 48 + table_entry *file_entry) 48 49 { 49 50 while ((*table) != NULL) 50 51 table = &(*table)->next; ··· 60 61 61 62 62 63 cache_table * 63 - load_cache_table(char *file_name, 64 + load_cache_table(const char *file_name, 64 65 int hi_bit_nr) 65 66 { 66 67 table *file = table_open(file_name, nr_cache_rule_fields, 0);
+10 -10
sim/ppc/ld-cache.h
··· 66 66 typedef struct _cache_table cache_table; 67 67 struct _cache_table { 68 68 cache_rule_type type; 69 - char *field_name; 70 - char *derived_name; 71 - char *type_def; 72 - char *expression; 69 + const char *field_name; 70 + const char *derived_name; 71 + const char *type_def; 72 + const char *expression; 73 73 table_entry *file_entry; 74 74 cache_table *next; 75 75 }; 76 76 77 77 78 78 extern cache_table *load_cache_table 79 - (char *file_name, 79 + (const char *file_name, 80 80 int hi_bit_nr); 81 81 82 82 extern void append_cache_rule 83 83 (cache_table **table, 84 - char *type, 85 - char *field_name, 86 - char *derived_name, 87 - char *type_def, 88 - char *expression, 84 + const char *type, 85 + const char *field_name, 86 + const char *derived_name, 87 + const char *type_def, 88 + const char *expression, 89 89 table_entry *file_entry); 90 90
+1 -1
sim/ppc/ld-decode.c
··· 70 70 71 71 72 72 decode_table * 73 - load_decode_table(char *file_name, 73 + load_decode_table(const char *file_name, 74 74 int hi_bit_nr) 75 75 { 76 76 table *file = table_open(file_name, nr_decode_fields, 0);
+1 -1
sim/ppc/ld-decode.h
··· 134 134 (const char *type); 135 135 136 136 extern decode_table *load_decode_table 137 - (char *file_name, 137 + (const char *file_name, 138 138 int hi_bit_nr); 139 139 140 140 extern void dump_decode_rule
+8 -8
sim/ppc/ld-insn.c
··· 77 77 78 78 static insn_fields * 79 79 parse_insn_format(table_entry *entry, 80 - char *format) 80 + const char *format) 81 81 { 82 - char *chp; 82 + const char *chp; 83 83 insn_fields *fields = ZALLOC(insn_fields); 84 84 85 85 /* create a leading sentinal */ ··· 102 102 chp = format; 103 103 104 104 while (*chp != '\0') { 105 - char *start_pos; 106 - char *start_val; 105 + const char *start_pos; 106 + const char *start_val; 107 107 int strlen_val; 108 108 int strlen_pos; 109 109 insn_field *new_field; ··· 208 208 } 209 209 210 210 211 - void 211 + static void 212 212 parse_include_entry (table *file, 213 213 table_entry *file_entry, 214 214 filter *filters, ··· 304 304 /* Check out any model information returned to make sure the model 305 305 is correct. */ 306 306 for(insn_model_ptr = file_entry->model_first; insn_model_ptr; insn_model_ptr = insn_model_ptr->next) { 307 - char *name = insn_model_ptr->fields[insn_model_name]; 307 + const char *name = insn_model_ptr->fields[insn_model_name]; 308 308 int len = strlen (insn_model_ptr->fields[insn_model_fields]); 309 309 310 310 while (len > 0 && isspace(*insn_model_ptr->fields[insn_model_fields])) { ··· 544 544 return field_constant_slash; 545 545 /* field, though variable is on the list */ 546 546 if (field->is_string && rule->force_expansion != NULL) { 547 - char *forced_fields = rule->force_expansion; 547 + const char *forced_fields = rule->force_expansion; 548 548 while (*forced_fields != '\0') { 549 549 int field_len; 550 - char *end = strchr(forced_fields, ','); 550 + const char *end = strchr(forced_fields, ','); 551 551 if (end == NULL) 552 552 field_len = strlen(forced_fields); 553 553 else
+2 -2
sim/ppc/lf.c
··· 42 42 43 43 44 44 lf * 45 - lf_open(char *name, 46 - char *real_name, 45 + lf_open(const char *name, 46 + const char *real_name, 47 47 lf_file_references references, 48 48 lf_file_type type, 49 49 const char *program)
+2 -2
sim/ppc/lf.h
··· 42 42 suppressed with LINE_NUMBERS */ 43 43 44 44 extern lf *lf_open 45 - (char *name, 46 - char *real_name, 45 + (const char *name, 46 + const char *real_name, 47 47 lf_file_references file_references, 48 48 lf_file_type type, 49 49 const char *program);
+4 -4
sim/ppc/misc.c
··· 29 29 #include <string.h> 30 30 31 31 void 32 - error (char *msg, ...) 32 + error (const char *msg, ...) 33 33 { 34 34 va_list ap; 35 35 va_start(ap, msg); ··· 49 49 } 50 50 51 51 void 52 - dumpf (int indent, char *msg, ...) 52 + dumpf (int indent, const char *msg, ...) 53 53 { 54 54 va_list ap; 55 55 for (; indent > 0; indent--) ··· 159 159 const char *name = names; 160 160 while (*name != '\0') { 161 161 /* find our name */ 162 - char *end = strchr(name, ','); 163 - char *next; 162 + const char *end = strchr(name, ','); 163 + const char *next; 164 164 int len; 165 165 if (end == NULL) { 166 166 end = strchr(name, '\0');
+2 -2
sim/ppc/misc.h
··· 31 31 #include "filter_filename.h" 32 32 33 33 extern void error 34 - (char *msg, ...); 34 + (const char *msg, ...); 35 35 36 36 #define ASSERT(EXPRESSION) \ 37 37 do { \ ··· 48 48 (long size); 49 49 50 50 extern void dumpf 51 - (int indent, char *msg, ...); 51 + (int indent, const char *msg, ...); 52 52 53 53 extern unsigned target_a2i 54 54 (int ms_bit_nr,