2 * Use correct printf format specifiers for 'size_t'
3 * Fix const correctness ('char*' -> 'const char*') for C-string literals
4 * Correctly forward declare inline functions
6 --- a/fire/test-fire.cc
7 +++ b/fire/test-fire.cc
9 if (k->size < (size_t) N)
12 - printf ("odd size: %d\n", k->size);
13 + printf ("odd size: %zu\n", k->size);
15 printf ("min = %d, max = %d\n", min, max);
16 for (int i = min; i <= max && i < N; i+=4)
17 --- a/fire/tree-supp.cc
18 +++ b/fire/tree-supp.cc
20 if (size < (size_t) N)
23 - printf ("odd size: %d\n", size);
24 + printf ("odd size: %zu\n", size);
28 --- a/freehdl/kernel-dump.hh
29 +++ b/freehdl/kernel-dump.hh
32 // This function will return an appropriate table entry (if
34 - char *find_table(type_info_interface* type);
35 + const char *find_table(type_info_interface* type);
36 //this variable is used by the read_type function
37 - char* translation_table;
38 + const char* translation_table;
39 // This method is executed each time the signal value changes
41 // Continue dumping the signal.
43 extern list<signal_dump*> signal_dump_process_list;
45 // Used to store the user_defined translation table types
46 -extern map<string, char*, less<string> > mapping_translation_table;
47 +extern map<string, const char*, less<string> > mapping_translation_table;
50 /******************************************************
51 --- a/freehdl/kernel-fhdl-stream.hh
52 +++ b/freehdl/kernel-fhdl-stream.hh
57 - fhdl_ostream_t &operator<<(char *p);
58 + fhdl_ostream_t &operator<<(const char *p);
59 fhdl_ostream_t &operator<<(const string &a);
60 fhdl_ostream_t &operator<<(const int i);
61 fhdl_ostream_t &operator<<(const unsigned int i);
62 --- a/freehdl/std-vhdl-types.hh
63 +++ b/freehdl/std-vhdl-types.hh
65 // which caused the failure or NULL otherwise.
66 virtual const char *read(void *dest, const char *str) = 0;
67 // Prints the content of src into an string stream in VCD format
68 - virtual void vcd_print(buffer_stream &str, const void *src,char* translation_table, bool pure) = 0;
69 + virtual void vcd_print(buffer_stream &str, const void *src, const char* translation_table, bool pure) = 0;
70 // Prints value into binary stream. Note that only the raw data but
71 // no type info objects are written! The method returns the number
72 // of bytes written to the stream.
74 bool assign(void *dest, const void *src);
75 void remove(void *src);
76 void print(buffer_stream &str, const void *src, int mode);
77 - void vcd_print(buffer_stream &str, const void *src,char* translation_table, bool pure);
78 + void vcd_print(buffer_stream &str, const void *src, const char* translation_table, bool pure);
79 const char *read(void *dest, const char *str);
81 integer check(integer value) {
83 bool assign(void *dest, const void *src);
84 void remove(void *src);
85 void print(buffer_stream &str, const void *src, int mode);
86 - void vcd_print(buffer_stream &str, const void *src,char* translation_table, bool pure) {};
87 + void vcd_print(buffer_stream &str, const void *src, const char* translation_table, bool pure) {};
88 const char *read(void *dest, const char *str);
92 bool assign(void *dest, const void *src);
93 void remove(void *src);
94 void print(buffer_stream &str, const void *src, int mode) {};
95 - void vcd_print(buffer_stream &str, const void *src,char* translation_table, bool pure) {};
96 + void vcd_print(buffer_stream &str, const void *src, const char* translation_table, bool pure) {};
97 const char *read(void *dest, const char *str);
101 bool assign(void *dest, const void *src);
102 void remove(void *src);
103 void print(buffer_stream &str, const void *src, int mode);
104 - void vcd_print(buffer_stream &str, const void *src,char* translation_table, bool pure);
105 + void vcd_print(buffer_stream &str, const void *src, const char* translation_table, bool pure);
106 const char *read(void *dest, const char *str);
108 floatingpoint check(floatingpoint value) {
110 bool assign(void *dest, const void *src);
111 void remove(void *src);
112 void print(buffer_stream &str, const void *src, int mode);
113 - void vcd_print(buffer_stream &str, const void *src,char* translation_table, bool pure);
114 + void vcd_print(buffer_stream &str, const void *src, const char* translation_table, bool pure);
115 const char *read(void *dest, const char *str);
117 enumeration check(integer value) {
119 bool assign(void *dest, const void *src);
120 void remove(void *src);
121 void print(buffer_stream &str, const void *src, int mode);
122 - void vcd_print(buffer_stream &str, const void *src,char* translation_table, bool pure) ;
123 + void vcd_print(buffer_stream &str, const void *src, const char* translation_table, bool pure) ;
124 const char *read(void *dest, const char *str);
126 physical check(physical value) {
127 @@ -1087,7 +1098,7 @@
128 bool assign(void *dest, const void *src) { return false; };
129 void remove(void *src);
130 void print(buffer_stream &str, const void *src, int mode);
131 - void vcd_print(buffer_stream &str, const void *src,char* translation_table, bool pure) ;
132 + void vcd_print(buffer_stream &str, const void *src, const char* translation_table, bool pure) ;
133 const char *read(void *dest, const char *str);
136 @@ -1230,7 +1241,7 @@
137 bool assign(void *dest, const void *src) { return false; };
138 void remove(void *src);
139 void print(buffer_stream &str, const void *src, int mode);
140 - void vcd_print(buffer_stream &str, const void *src,char* translation_table, bool pure);
141 + void vcd_print(buffer_stream &str, const void *src, const char* translation_table, bool pure);
142 const char *read(void *dest, const char *str);
145 --- a/freehdl/vaul-lexer.h
146 +++ b/freehdl/vaul-lexer.h
148 IR_String expand_bitstring(const char *, int len);
150 int LexerInput(char *buf, int max_size);
151 - void LexerError(char *msg);
152 + void LexerError(const char *msg);
153 void message(char *fmt, va_list ap);
154 void message(vaul_yyltype &loc, char *fmt, va_list ap);
156 --- a/kernel/driver_info.cc
157 +++ b/kernel/driver_info.cc
161 // Creates transaction composite signals. Returns number of assigned scalars.
162 +inline int do_record_transport_assignment(driver_info &, const record_base &, int, const vtime &);
164 do_array_transport_assignment(driver_info &driver, const array_base &value, int first, const vtime &tr_time)
167 assigned_scalars += do_array_transport_assignment(driver, (array_base&)value.data[j], i, tr_time);
170 - inline int do_record_transport_assignment(driver_info &, const record_base &, int, const vtime &);
171 assigned_scalars += do_record_transport_assignment(driver, (record_base&)value.data[j], i, tr_time);
177 // Creates transaction for composite signals. Returns number of assigned scalars.
178 +inline int do_record_inertial_assignment(driver_info &, const record_base &, int, const vtime &, const vtime &);
180 do_array_inertial_assignment(driver_info &driver,
181 const array_base &value, int first,
183 assigned_scalars += do_array_inertial_assignment(driver, (array_base&)value.data[j], i, tr_time, rm_time);
186 - inline int do_record_inertial_assignment(driver_info &, const record_base &, int,
187 - const vtime &, const vtime &);
188 assigned_scalars += do_record_inertial_assignment(driver, (record_base&)value.data[j], i, tr_time, rm_time);
196 // find_translation table
199 signal_dump::find_table(type_info_interface* type)
202 --- a/kernel/fhdl_stream.cc
203 +++ b/kernel/fhdl_stream.cc
208 -fhdl_ostream_t::operator<<(char *p)
209 +fhdl_ostream_t::operator<<(const char *p)
211 if (!socket_connection)
213 --- a/std/vhdl_types.cc
214 +++ b/std/vhdl_types.cc
215 @@ -1013,7 +1016,7 @@
219 -integer_info_base::vcd_print(buffer_stream &str, const void *src,char* translation_table, bool pure)
220 +integer_info_base::vcd_print(buffer_stream &str, const void *src, const char* translation_table, bool pure)
222 integer op =*((integer*)src);
223 static char result[INTEGER_SIZE_LD + 1];
224 @@ -1306,7 +1309,7 @@
228 -float_info_base::vcd_print(buffer_stream &str, const void *src,char* translation_table, bool pure) {
229 +float_info_base::vcd_print(buffer_stream &str, const void *src, const char* translation_table, bool pure) {
230 // should be definitly enough characters to hold a string
231 // representation of a double
232 static char rbuffer[8*sizeof(double)];
233 @@ -1432,7 +1435,7 @@
237 -enum_info_base::vcd_print(buffer_stream &str, const void *src,char* translation_table, bool pure)
238 +enum_info_base::vcd_print(buffer_stream &str, const void *src, const char* translation_table, bool pure)
240 if (translation_table != NULL) {
241 const char output = translation_table[*((enumeration*)src)];
242 @@ -1583,7 +1586,7 @@
246 -physical_info_base::vcd_print(buffer_stream &str, const void *src,char* translation_table, bool pure) {
247 +physical_info_base::vcd_print(buffer_stream &str, const void *src, const char* translation_table, bool pure) {
248 str << *((physical*)src) << " " << units[0];
251 @@ -1778,7 +1781,7 @@
254 // Temporary VCD_Print function
255 -void array_info::vcd_print(buffer_stream &str, const void *src,char* translation_table, bool pure)
256 +void array_info::vcd_print(buffer_stream &str, const void *src, const char* translation_table, bool pure)
259 int length = ((array_base*)src)->info->length;
260 @@ -2090,7 +2093,7 @@
263 // Temporary VCD_Print function
264 -void record_info::vcd_print(buffer_stream &str, const void *src, char* translation_table, bool pure)
265 +void record_info::vcd_print(buffer_stream &str, const void *src, const char* translation_table, bool pure)
267 record_base &record = *(record_base*)src;
268 record_info &rinfo = *record.info;
271 @@ -2075,7 +2075,7 @@
275 -vaul_lexer::LexerError (char *m)
276 +vaul_lexer::LexerError (const char *m)
279 prt->fprintf (log, "%?%s %C\n", this, m, this);