adlint 2.6.0 → 2.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -43,7 +43,7 @@ module C #:nodoc:
43
43
 
44
44
  private
45
45
  def eval_as_integer_constant(value)
46
- # NOTE: The ISO C99 standard saids;
46
+ # NOTE: The ISO C99 standard says;
47
47
  #
48
48
  # 6.4.4.1 Integer constants
49
49
  #
@@ -150,15 +150,15 @@ module C #:nodoc:
150
150
  when /\A([0-9]*\.[0-9]*E[+-]?[0-9]+)\z/i,
151
151
  /\A([0-9]+\.?E[+-]?[0-9]+)\z/i,
152
152
  /\A([0-9]*\.[0-9]+|[0-9]+\.)\z/
153
- return temporary_variable(double_type, ScalarValue.of($1.to_f))
153
+ return create_tempvar(double_type, ScalarValue.of($1.to_f))
154
154
  when /\A([0-9]*\.[0-9]*E[+-]?[0-9]+)F\z/i,
155
155
  /\A([0-9]+\.?E[+-]?[0-9]+)F\z/i,
156
156
  /\A([0-9]*\.[0-9]+|[0-9]+\.)F\z/i
157
- return temporary_variable(float_type, ScalarValue.of($1.to_f))
157
+ return create_tempvar(float_type, ScalarValue.of($1.to_f))
158
158
  when /\A([0-9]*\.[0-9]*E[+-]?[0-9]+)L\z/i,
159
159
  /\A([0-9]+\.?E[+-]?[0-9]+)L\z/i,
160
160
  /\A([0-9]*\.[0-9]+|[0-9]+\.)L\z/i
161
- return temporary_variable(long_double_type, ScalarValue.of($1.to_f))
161
+ return create_tempvar(long_double_type, ScalarValue.of($1.to_f))
162
162
  end
163
163
  nil
164
164
  end
@@ -175,9 +175,9 @@ module C #:nodoc:
175
175
  end
176
176
 
177
177
  if $1 == "L"
178
- temporary_variable(wchar_type, ScalarValue.of(char_code))
178
+ create_tempvar(wchar_type, ScalarValue.of(char_code))
179
179
  else
180
- temporary_variable(int_type, ScalarValue.of(char_code))
180
+ create_tempvar(int_type, ScalarValue.of(char_code))
181
181
  end
182
182
  else
183
183
  nil
@@ -187,13 +187,13 @@ module C #:nodoc:
187
187
  def eval_as_decimal_integer_constant_unsuffixed(value)
188
188
  case
189
189
  when int_value_range.include?(value)
190
- temporary_variable(int_type, ScalarValue.of(value))
190
+ create_tempvar(int_type, ScalarValue.of(value))
191
191
  when long_int_value_range.include?(value)
192
- temporary_variable(long_int_type, ScalarValue.of(value))
192
+ create_tempvar(long_int_type, ScalarValue.of(value))
193
193
  when long_long_int_value_range.include?(value)
194
- temporary_variable(long_long_int_type, ScalarValue.of(value))
194
+ create_tempvar(long_long_int_type, ScalarValue.of(value))
195
195
  else
196
- # NOTE: The ISO C99 standard saids;
196
+ # NOTE: The ISO C99 standard says;
197
197
  #
198
198
  # 6.4.4.1 Integer constants
199
199
  #
@@ -202,20 +202,20 @@ module C #:nodoc:
202
202
  # has no type.
203
203
  #
204
204
  # NOTE: Use ExtendedBigIntType for unrepresentable integer constants.
205
- temporary_variable(extended_big_int_type, ScalarValue.of(value))
205
+ create_tempvar(extended_big_int_type, ScalarValue.of(value))
206
206
  end
207
207
  end
208
208
 
209
209
  def eval_as_decimal_integer_constant_with_u(value)
210
210
  case
211
211
  when unsigned_int_value_range.include?(value)
212
- temporary_variable(unsigned_int_type, ScalarValue.of(value))
212
+ create_tempvar(unsigned_int_type, ScalarValue.of(value))
213
213
  when unsigned_long_int_value_range.include?(value)
214
- temporary_variable(unsigned_long_int_type, ScalarValue.of(value))
214
+ create_tempvar(unsigned_long_int_type, ScalarValue.of(value))
215
215
  when unsigned_long_long_int_value_range.include?(value)
216
- temporary_variable(unsigned_long_long_int_type, ScalarValue.of(value))
216
+ create_tempvar(unsigned_long_long_int_type, ScalarValue.of(value))
217
217
  else
218
- # NOTE: The ISO C99 standard saids;
218
+ # NOTE: The ISO C99 standard says;
219
219
  #
220
220
  # 6.4.4.1 Integer constants
221
221
  #
@@ -224,18 +224,18 @@ module C #:nodoc:
224
224
  # has no type.
225
225
  #
226
226
  # NOTE: Use ExtendedBigIntType for unrepresentable integer constants.
227
- temporary_variable(extended_big_int_type, ScalarValue.of(value))
227
+ create_tempvar(extended_big_int_type, ScalarValue.of(value))
228
228
  end
229
229
  end
230
230
 
231
231
  def eval_as_decimal_integer_constant_with_l(value)
232
232
  case
233
233
  when long_int_value_range.include?(value)
234
- temporary_variable(long_int_type, ScalarValue.of(value))
234
+ create_tempvar(long_int_type, ScalarValue.of(value))
235
235
  when long_long_int_value_range.include?(value)
236
- temporary_variable(long_long_int_type, ScalarValue.of(value))
236
+ create_tempvar(long_long_int_type, ScalarValue.of(value))
237
237
  else
238
- # NOTE: The ISO C99 standard saids;
238
+ # NOTE: The ISO C99 standard says;
239
239
  #
240
240
  # 6.4.4.1 Integer constants
241
241
  #
@@ -244,18 +244,18 @@ module C #:nodoc:
244
244
  # has no type.
245
245
  #
246
246
  # NOTE: Use ExtendedBigIntType for unrepresentable integer constants.
247
- temporary_variable(extended_big_int_type, ScalarValue.of(value))
247
+ create_tempvar(extended_big_int_type, ScalarValue.of(value))
248
248
  end
249
249
  end
250
250
 
251
251
  def eval_as_decimal_integer_constant_with_ul(value)
252
252
  case
253
253
  when unsigned_long_int_value_range.include?(value)
254
- temporary_variable(unsigned_long_int_type, ScalarValue.of(value))
254
+ create_tempvar(unsigned_long_int_type, ScalarValue.of(value))
255
255
  when unsigned_long_long_int_value_range.include?(value)
256
- temporary_variable(unsigned_long_long_int_type, ScalarValue.of(value))
256
+ create_tempvar(unsigned_long_long_int_type, ScalarValue.of(value))
257
257
  else
258
- # NOTE: The ISO C99 standard saids;
258
+ # NOTE: The ISO C99 standard says;
259
259
  #
260
260
  # 6.4.4.1 Integer constants
261
261
  #
@@ -264,16 +264,16 @@ module C #:nodoc:
264
264
  # has no type.
265
265
  #
266
266
  # NOTE: Use ExtendedBigIntType for unrepresentable integer constants.
267
- temporary_variable(extended_big_int_type, ScalarValue.of(value))
267
+ create_tempvar(extended_big_int_type, ScalarValue.of(value))
268
268
  end
269
269
  end
270
270
 
271
271
  def eval_as_decimal_integer_constant_with_ll(value)
272
272
  case
273
273
  when long_long_int_value_range.include?(value)
274
- temporary_variable(long_long_int_type, ScalarValue.of(value))
274
+ create_tempvar(long_long_int_type, ScalarValue.of(value))
275
275
  else
276
- # NOTE: The ISO C99 standard saids;
276
+ # NOTE: The ISO C99 standard says;
277
277
  #
278
278
  # 6.4.4.1 Integer constants
279
279
  #
@@ -282,16 +282,16 @@ module C #:nodoc:
282
282
  # has no type.
283
283
  #
284
284
  # NOTE: Use ExtendedBigIntType for unrepresentable integer constants.
285
- temporary_variable(extended_big_int_type, ScalarValue.of(value))
285
+ create_tempvar(extended_big_int_type, ScalarValue.of(value))
286
286
  end
287
287
  end
288
288
 
289
289
  def eval_as_decimal_integer_constant_with_ull(value)
290
290
  case
291
291
  when unsigned_long_long_int_value_range.include?(value)
292
- temporary_variable(unsigned_long_long_int_type, ScalarValue.of(value))
292
+ create_tempvar(unsigned_long_long_int_type, ScalarValue.of(value))
293
293
  else
294
- # NOTE: The ISO C99 standard saids;
294
+ # NOTE: The ISO C99 standard says;
295
295
  #
296
296
  # 6.4.4.1 Integer constants
297
297
  #
@@ -300,26 +300,26 @@ module C #:nodoc:
300
300
  # has no type.
301
301
  #
302
302
  # NOTE: Use ExtendedBigIntType for unrepresentable integer constants.
303
- temporary_variable(extended_big_int_type, ScalarValue.of(value))
303
+ create_tempvar(extended_big_int_type, ScalarValue.of(value))
304
304
  end
305
305
  end
306
306
 
307
307
  def eval_as_non_decimal_integer_constant_unsuffixed(value)
308
308
  case
309
309
  when int_value_range.include?(value)
310
- temporary_variable(int_type, ScalarValue.of(value))
310
+ create_tempvar(int_type, ScalarValue.of(value))
311
311
  when unsigned_int_value_range.include?(value)
312
- temporary_variable(unsigned_int_type, ScalarValue.of(value))
312
+ create_tempvar(unsigned_int_type, ScalarValue.of(value))
313
313
  when long_int_value_range.include?(value)
314
- temporary_variable(long_int_type, ScalarValue.of(value))
314
+ create_tempvar(long_int_type, ScalarValue.of(value))
315
315
  when unsigned_long_int_value_range.include?(value)
316
- temporary_variable(unsigned_long_int_type, ScalarValue.of(value))
316
+ create_tempvar(unsigned_long_int_type, ScalarValue.of(value))
317
317
  when long_long_int_value_range.include?(value)
318
- temporary_variable(long_long_int_type, ScalarValue.of(value))
318
+ create_tempvar(long_long_int_type, ScalarValue.of(value))
319
319
  when unsigned_long_long_int_value_range.include?(value)
320
- temporary_variable(unsigned_long_long_int_type, ScalarValue.of(value))
320
+ create_tempvar(unsigned_long_long_int_type, ScalarValue.of(value))
321
321
  else
322
- # NOTE: The ISO C99 standard saids;
322
+ # NOTE: The ISO C99 standard says;
323
323
  #
324
324
  # 6.4.4.1 Integer constants
325
325
  #
@@ -328,20 +328,20 @@ module C #:nodoc:
328
328
  # has no type.
329
329
  #
330
330
  # NOTE: Use ExtendedBigIntType for unrepresentable integer constants.
331
- temporary_variable(extended_big_int_type, ScalarValue.of(value))
331
+ create_tempvar(extended_big_int_type, ScalarValue.of(value))
332
332
  end
333
333
  end
334
334
 
335
335
  def eval_as_non_decimal_integer_constant_with_u(value)
336
336
  case
337
337
  when unsigned_int_value_range.include?(value)
338
- temporary_variable(unsigned_int_type, ScalarValue.of(value))
338
+ create_tempvar(unsigned_int_type, ScalarValue.of(value))
339
339
  when unsigned_long_int_value_range.include?(value)
340
- temporary_variable(unsigned_long_int_type, ScalarValue.of(value))
340
+ create_tempvar(unsigned_long_int_type, ScalarValue.of(value))
341
341
  when unsigned_long_long_int_value_range.include?(value)
342
- temporary_variable(unsigned_long_long_int_type, ScalarValue.of(value))
342
+ create_tempvar(unsigned_long_long_int_type, ScalarValue.of(value))
343
343
  else
344
- # NOTE: The ISO C99 standard saids;
344
+ # NOTE: The ISO C99 standard says;
345
345
  #
346
346
  # 6.4.4.1 Integer constants
347
347
  #
@@ -350,22 +350,22 @@ module C #:nodoc:
350
350
  # has no type.
351
351
  #
352
352
  # NOTE: Use ExtendedBigIntType for unrepresentable integer constants.
353
- temporary_variable(extended_big_int_type, ScalarValue.of(value))
353
+ create_tempvar(extended_big_int_type, ScalarValue.of(value))
354
354
  end
355
355
  end
356
356
 
357
357
  def eval_as_non_decimal_integer_constant_with_l(value)
358
358
  case
359
359
  when long_int_value_range.include?(value)
360
- temporary_variable(long_int_type, ScalarValue.of(value))
360
+ create_tempvar(long_int_type, ScalarValue.of(value))
361
361
  when unsigned_long_int_value_range.include?(value)
362
- temporary_variable(unsigned_long_int_type, ScalarValue.of(value))
362
+ create_tempvar(unsigned_long_int_type, ScalarValue.of(value))
363
363
  when long_long_int_value_range.include?(value)
364
- temporary_variable(long_long_int_type, ScalarValue.of(value))
364
+ create_tempvar(long_long_int_type, ScalarValue.of(value))
365
365
  when unsigned_long_long_int_value_range.include?(value)
366
- temporary_variable(unsigned_long_long_int_type, ScalarValue.of(value))
366
+ create_tempvar(unsigned_long_long_int_type, ScalarValue.of(value))
367
367
  else
368
- # NOTE: The ISO C99 standard saids;
368
+ # NOTE: The ISO C99 standard says;
369
369
  #
370
370
  # 6.4.4.1 Integer constants
371
371
  #
@@ -374,18 +374,18 @@ module C #:nodoc:
374
374
  # has no type.
375
375
  #
376
376
  # NOTE: Use ExtendedBigIntType for unrepresentable integer constants.
377
- temporary_variable(extended_big_int_type, ScalarValue.of(value))
377
+ create_tempvar(extended_big_int_type, ScalarValue.of(value))
378
378
  end
379
379
  end
380
380
 
381
381
  def eval_as_non_decimal_integer_constant_with_ul(value)
382
382
  case
383
383
  when unsigned_long_int_value_range.include?(value)
384
- temporary_variable(unsigned_long_int_type, ScalarValue.of(value))
384
+ create_tempvar(unsigned_long_int_type, ScalarValue.of(value))
385
385
  when unsigned_long_long_int_value_range.include?(value)
386
- temporary_variable(unsigned_long_long_int_type, ScalarValue.of(value))
386
+ create_tempvar(unsigned_long_long_int_type, ScalarValue.of(value))
387
387
  else
388
- # NOTE: The ISO C99 standard saids;
388
+ # NOTE: The ISO C99 standard says;
389
389
  #
390
390
  # 6.4.4.1 Integer constants
391
391
  #
@@ -394,18 +394,18 @@ module C #:nodoc:
394
394
  # has no type.
395
395
  #
396
396
  # NOTE: Use ExtendedBigIntType for unrepresentable integer constants.
397
- temporary_variable(extended_big_int_type, ScalarValue.of(value))
397
+ create_tempvar(extended_big_int_type, ScalarValue.of(value))
398
398
  end
399
399
  end
400
400
 
401
401
  def eval_as_non_decimal_integer_constant_with_ll(value)
402
402
  case
403
403
  when long_long_int_value_range.include?(value)
404
- temporary_variable(long_long_int_type, ScalarValue.of(value))
404
+ create_tempvar(long_long_int_type, ScalarValue.of(value))
405
405
  when unsigned_long_long_int_value_range.include?(value)
406
- temporary_variable(unsigned_long_long_int_type, ScalarValue.of(value))
406
+ create_tempvar(unsigned_long_long_int_type, ScalarValue.of(value))
407
407
  else
408
- # NOTE: The ISO C99 standard saids;
408
+ # NOTE: The ISO C99 standard says;
409
409
  #
410
410
  # 6.4.4.1 Integer constants
411
411
  #
@@ -414,16 +414,16 @@ module C #:nodoc:
414
414
  # has no type.
415
415
  #
416
416
  # NOTE: Use ExtendedBigIntType for unrepresentable integer constants.
417
- temporary_variable(extended_big_int_type, ScalarValue.of(value))
417
+ create_tempvar(extended_big_int_type, ScalarValue.of(value))
418
418
  end
419
419
  end
420
420
 
421
421
  def eval_as_non_decimal_integer_constant_with_ull(value)
422
422
  case
423
423
  when unsigned_long_long_int_value_range.include?(value)
424
- temporary_variable(unsigned_long_long_int_type, ScalarValue.of(value))
424
+ create_tempvar(unsigned_long_long_int_type, ScalarValue.of(value))
425
425
  else
426
- # NOTE: The ISO C99 standard saids;
426
+ # NOTE: The ISO C99 standard says;
427
427
  #
428
428
  # 6.4.4.1 Integer constants
429
429
  #
@@ -432,7 +432,7 @@ module C #:nodoc:
432
432
  # has no type.
433
433
  #
434
434
  # NOTE: Use ExtendedBigIntType for unrepresentable integer constants.
435
- temporary_variable(extended_big_int_type, ScalarValue.of(value))
435
+ create_tempvar(extended_big_int_type, ScalarValue.of(value))
436
436
  end
437
437
  end
438
438
 
data/lib/adlint/c/conv.rb CHANGED
@@ -37,8 +37,8 @@ module C #:nodoc:
37
37
  def do_conversion(original, to_type)
38
38
  if original.type.coercible?(to_type)
39
39
  # NOTE: Value will be coerced into the destination type in
40
- # VariableTableMediator#temporary_variable.
41
- temporary_variable(to_type, wrap_around_value(original, to_type))
40
+ # VariableTableMediator#create_tempvar.
41
+ create_tempvar(to_type, wrap_around_value(original, to_type))
42
42
  else
43
43
  nil
44
44
  end
@@ -142,7 +142,7 @@ module C #:nodoc:
142
142
  # Host class of this module must include StandardTypeCatalogAccessor.
143
143
  module UsualArithmeticTypeConversion
144
144
  def do_usual_arithmetic_type_conversion(lhs_type, rhs_type)
145
- # NOTE: The ISO C99 standard saids;
145
+ # NOTE: The ISO C99 standard says;
146
146
  #
147
147
  # 6.3.1.8 Usual arithmetic conversions
148
148
  #