archrelease: copy trunk to community-any
[ArchLinux/community.git] / freehdl / trunk / gentoo-qa.patch
blobd35af9f69a69c232258acd0bd9a52012bc5dcfb5
1 Fix various QA issues:
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
8 @@ -24,7 +24,7 @@
9 if (k->size < (size_t) N)
10 sizes[k->size]++;
11 if (k->size % 4 !=0)
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
19 @@ -485,7 +485,7 @@
20 if (size < (size_t) N)
21 sizes[size]++;
22 if (size % 4 !=0)
23 - printf ("odd size: %d\n", size);
24 + printf ("odd size: %zu\n", size);
27 void
28 --- a/freehdl/kernel-dump.hh
29 +++ b/freehdl/kernel-dump.hh
30 @@ -42,9 +42,9 @@
31 short wait_id;
32 // This function will return an appropriate table entry (if
33 // available)
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
40 bool execute();
41 // Continue dumping the signal.
42 @@ -77,7 +77,7 @@
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
53 @@ -29,7 +31,7 @@
54 str->flush();
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
64 @@ -607,7 +618,7 @@
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.
73 @@ -785,7 +796,7 @@
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) {
82 @@ -821,7 +832,7 @@
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);
91 @@ -849,7 +860,7 @@
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);
100 @@ -879,7 +890,7 @@
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) {
109 @@ -914,7 +925,7 @@
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) {
118 @@ -954,7 +965,7 @@
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
147 @@ -115,7 +114,7 @@
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
158 @@ -270,6 +270,7 @@
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 &);
163 inline int
164 do_array_transport_assignment(driver_info &driver, const array_base &value, int first, const vtime &tr_time)
166 @@ -311,7 +312,6 @@
167 assigned_scalars += do_array_transport_assignment(driver, (array_base&)value.data[j], i, tr_time);
168 break;
169 case RECORD:
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);
172 break;
174 @@ -339,6 +339,7 @@
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 &);
179 inline int
180 do_array_inertial_assignment(driver_info &driver,
181 const array_base &value, int first,
182 @@ -381,8 +382,6 @@
183 assigned_scalars += do_array_inertial_assignment(driver, (array_base&)value.data[j], i, tr_time, rm_time);
184 break;
185 case RECORD:
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);
189 break;
191 --- a/kernel/dump.cc
192 +++ b/kernel/dump.cc
193 @@ -90,7 +90,7 @@
196 // find_translation table
197 -char *
198 +const char *
199 signal_dump::find_table(type_info_interface* type)
201 switch(type->id)
202 --- a/kernel/fhdl_stream.cc
203 +++ b/kernel/fhdl_stream.cc
204 @@ -60,7 +63,7 @@
207 fhdl_ostream_t &
208 -fhdl_ostream_t::operator<<(char *p)
209 +fhdl_ostream_t::operator<<(const char *p)
211 if (!socket_connection)
212 *str << p;
213 --- a/std/vhdl_types.cc
214 +++ b/std/vhdl_types.cc
215 @@ -1013,7 +1016,7 @@
218 void
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 @@
227 void
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 @@
236 void
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 @@
245 void
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)
258 //str.clean();
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;
269 --- a/vaul/lexer.cc
270 +++ b/vaul/lexer.cc
271 @@ -2075,7 +2075,7 @@
274 void
275 -vaul_lexer::LexerError (char *m)
276 +vaul_lexer::LexerError (const char *m)
278 if (prt)
279 prt->fprintf (log, "%?%s %C\n", this, m, this);