comparison gcc/c-format.c @ 55:77e2b8dfacca gcc-4.4.5

update it from 4.4.3 to 4.5.0
author ryoma <e075725@ie.u-ryukyu.ac.jp>
date Fri, 12 Feb 2010 23:39:51 +0900
parents a06113de4d67
children
comparison
equal deleted inserted replaced
52:c156f1bd5cd9 55:77e2b8dfacca
257 { 257 {
258 /* The type wanted. */ 258 /* The type wanted. */
259 tree wanted_type; 259 tree wanted_type;
260 /* The name of this type to use in diagnostics. */ 260 /* The name of this type to use in diagnostics. */
261 const char *wanted_type_name; 261 const char *wanted_type_name;
262 /* Should be type checked just for scalar width identity. */
263 int scalar_identity_flag;
262 /* The level of indirection through pointers at which this type occurs. */ 264 /* The level of indirection through pointers at which this type occurs. */
263 int pointer_count; 265 int pointer_count;
264 /* Whether, when pointer_count is 1, to allow any character type when 266 /* Whether, when pointer_count is 1, to allow any character type when
265 pedantic, rather than just the character or void type specified. */ 267 pedantic, rather than just the character or void type specified. */
266 int char_lenient_flag; 268 int char_lenient_flag;
286 /* Convenience macro for format_length_info meaning unused. */ 288 /* Convenience macro for format_length_info meaning unused. */
287 #define NO_FMT NULL, FMT_LEN_none, STD_C89 289 #define NO_FMT NULL, FMT_LEN_none, STD_C89
288 290
289 static const format_length_info printf_length_specs[] = 291 static const format_length_info printf_length_specs[] =
290 { 292 {
291 { "h", FMT_LEN_h, STD_C89, "hh", FMT_LEN_hh, STD_C99 }, 293 { "h", FMT_LEN_h, STD_C89, "hh", FMT_LEN_hh, STD_C99, 0 },
292 { "l", FMT_LEN_l, STD_C89, "ll", FMT_LEN_ll, STD_C9L }, 294 { "l", FMT_LEN_l, STD_C89, "ll", FMT_LEN_ll, STD_C9L, 0 },
293 { "q", FMT_LEN_ll, STD_EXT, NO_FMT }, 295 { "q", FMT_LEN_ll, STD_EXT, NO_FMT, 0 },
294 { "L", FMT_LEN_L, STD_C89, NO_FMT }, 296 { "L", FMT_LEN_L, STD_C89, NO_FMT, 0 },
295 { "z", FMT_LEN_z, STD_C99, NO_FMT }, 297 { "z", FMT_LEN_z, STD_C99, NO_FMT, 0 },
296 { "Z", FMT_LEN_z, STD_EXT, NO_FMT }, 298 { "Z", FMT_LEN_z, STD_EXT, NO_FMT, 0 },
297 { "t", FMT_LEN_t, STD_C99, NO_FMT }, 299 { "t", FMT_LEN_t, STD_C99, NO_FMT, 0 },
298 { "j", FMT_LEN_j, STD_C99, NO_FMT }, 300 { "j", FMT_LEN_j, STD_C99, NO_FMT, 0 },
299 { "H", FMT_LEN_H, STD_EXT, NO_FMT }, 301 { "H", FMT_LEN_H, STD_EXT, NO_FMT, 0 },
300 { "D", FMT_LEN_D, STD_EXT, "DD", FMT_LEN_DD, STD_EXT }, 302 { "D", FMT_LEN_D, STD_EXT, "DD", FMT_LEN_DD, STD_EXT, 0 },
301 { NO_FMT, NO_FMT } 303 { NO_FMT, NO_FMT, 0 }
302 }; 304 };
303 305
304 /* Length specifiers valid for asm_fprintf. */ 306 /* Length specifiers valid for asm_fprintf. */
305 static const format_length_info asm_fprintf_length_specs[] = 307 static const format_length_info asm_fprintf_length_specs[] =
306 { 308 {
307 { "l", FMT_LEN_l, STD_C89, "ll", FMT_LEN_ll, STD_C89 }, 309 { "l", FMT_LEN_l, STD_C89, "ll", FMT_LEN_ll, STD_C89, 0 },
308 { "w", FMT_LEN_none, STD_C89, NO_FMT }, 310 { "w", FMT_LEN_none, STD_C89, NO_FMT, 0 },
309 { NO_FMT, NO_FMT } 311 { NO_FMT, NO_FMT, 0 }
310 }; 312 };
311 313
312 /* Length specifiers valid for GCC diagnostics. */ 314 /* Length specifiers valid for GCC diagnostics. */
313 static const format_length_info gcc_diag_length_specs[] = 315 static const format_length_info gcc_diag_length_specs[] =
314 { 316 {
315 { "l", FMT_LEN_l, STD_C89, "ll", FMT_LEN_ll, STD_C89 }, 317 { "l", FMT_LEN_l, STD_C89, "ll", FMT_LEN_ll, STD_C89, 0 },
316 { "w", FMT_LEN_none, STD_C89, NO_FMT }, 318 { "w", FMT_LEN_none, STD_C89, NO_FMT, 0 },
317 { NO_FMT, NO_FMT } 319 { NO_FMT, NO_FMT, 0 }
318 }; 320 };
319 321
320 /* The custom diagnostics all accept the same length specifiers. */ 322 /* The custom diagnostics all accept the same length specifiers. */
321 #define gcc_tdiag_length_specs gcc_diag_length_specs 323 #define gcc_tdiag_length_specs gcc_diag_length_specs
322 #define gcc_cdiag_length_specs gcc_diag_length_specs 324 #define gcc_cdiag_length_specs gcc_diag_length_specs
323 #define gcc_cxxdiag_length_specs gcc_diag_length_specs 325 #define gcc_cxxdiag_length_specs gcc_diag_length_specs
324 326
325 /* This differs from printf_length_specs only in that "Z" is not accepted. */ 327 /* This differs from printf_length_specs only in that "Z" is not accepted. */
326 static const format_length_info scanf_length_specs[] = 328 static const format_length_info scanf_length_specs[] =
327 { 329 {
328 { "h", FMT_LEN_h, STD_C89, "hh", FMT_LEN_hh, STD_C99 }, 330 { "h", FMT_LEN_h, STD_C89, "hh", FMT_LEN_hh, STD_C99, 0 },
329 { "l", FMT_LEN_l, STD_C89, "ll", FMT_LEN_ll, STD_C9L }, 331 { "l", FMT_LEN_l, STD_C89, "ll", FMT_LEN_ll, STD_C9L, 0 },
330 { "q", FMT_LEN_ll, STD_EXT, NO_FMT }, 332 { "q", FMT_LEN_ll, STD_EXT, NO_FMT, 0 },
331 { "L", FMT_LEN_L, STD_C89, NO_FMT }, 333 { "L", FMT_LEN_L, STD_C89, NO_FMT, 0 },
332 { "z", FMT_LEN_z, STD_C99, NO_FMT }, 334 { "z", FMT_LEN_z, STD_C99, NO_FMT, 0 },
333 { "t", FMT_LEN_t, STD_C99, NO_FMT }, 335 { "t", FMT_LEN_t, STD_C99, NO_FMT, 0 },
334 { "j", FMT_LEN_j, STD_C99, NO_FMT }, 336 { "j", FMT_LEN_j, STD_C99, NO_FMT, 0 },
335 { "H", FMT_LEN_H, STD_EXT, NO_FMT }, 337 { "H", FMT_LEN_H, STD_EXT, NO_FMT, 0 },
336 { "D", FMT_LEN_D, STD_EXT, "DD", FMT_LEN_DD, STD_EXT }, 338 { "D", FMT_LEN_D, STD_EXT, "DD", FMT_LEN_DD, STD_EXT, 0 },
337 { NO_FMT, NO_FMT } 339 { NO_FMT, NO_FMT, 0 }
338 }; 340 };
339 341
340 342
341 /* All tables for strfmon use STD_C89 everywhere, since -pedantic warnings 343 /* All tables for strfmon use STD_C89 everywhere, since -pedantic warnings
342 make no sense for a format type not part of any C standard version. */ 344 make no sense for a format type not part of any C standard version. */
343 static const format_length_info strfmon_length_specs[] = 345 static const format_length_info strfmon_length_specs[] =
344 { 346 {
345 /* A GNU extension. */ 347 /* A GNU extension. */
346 { "L", FMT_LEN_L, STD_C89, NO_FMT }, 348 { "L", FMT_LEN_L, STD_C89, NO_FMT, 0 },
347 { NO_FMT, NO_FMT } 349 { NO_FMT, NO_FMT, 0 }
348 }; 350 };
349 351
350 352
351 /* For now, the Fortran front-end routines only use l as length modifier. */ 353 /* For now, the Fortran front-end routines only use l as length modifier. */
352 static const format_length_info gcc_gfc_length_specs[] = 354 static const format_length_info gcc_gfc_length_specs[] =
353 { 355 {
354 { "l", FMT_LEN_l, STD_C89, NO_FMT }, 356 { "l", FMT_LEN_l, STD_C89, NO_FMT, 0 },
355 { NO_FMT, NO_FMT } 357 { NO_FMT, NO_FMT, 0 }
356 }; 358 };
357 359
358 360
359 static const format_flag_spec printf_flag_specs[] = 361 static const format_flag_spec printf_flag_specs[] =
360 { 362 {
559 { "s", 1, STD_C89, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "pq", "cR", NULL }, 561 { "s", 1, STD_C89, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "pq", "cR", NULL },
560 { "p", 1, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "c", NULL }, 562 { "p", 1, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "c", NULL },
561 563
562 /* Custom conversion specifiers. */ 564 /* Custom conversion specifiers. */
563 565
564 /* %H will require "location_t" at runtime. */
565 { "H", 0, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "", NULL },
566
567 /* These will require a "tree" at runtime. */ 566 /* These will require a "tree" at runtime. */
568 { "JK", 0, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "", NULL }, 567 { "K", 0, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "", NULL },
569 568
570 { "<>'", 0, STD_C89, NOARGUMENTS, "", "", NULL }, 569 { "<>'", 0, STD_C89, NOARGUMENTS, "", "", NULL },
571 { "m", 0, STD_C89, NOARGUMENTS, "q", "", NULL }, 570 { "m", 0, STD_C89, NOARGUMENTS, "q", "", NULL },
572 { NULL, 0, STD_C89, NOLENGTHS, NULL, NULL, NULL } 571 { NULL, 0, STD_C89, NOLENGTHS, NULL, NULL, NULL }
573 }; 572 };
582 { "s", 1, STD_C89, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "pq", "cR", NULL }, 581 { "s", 1, STD_C89, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "pq", "cR", NULL },
583 { "p", 1, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "c", NULL }, 582 { "p", 1, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "c", NULL },
584 583
585 /* Custom conversion specifiers. */ 584 /* Custom conversion specifiers. */
586 585
587 /* %H will require "location_t" at runtime. */
588 { "H", 0, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "", NULL },
589
590 /* These will require a "tree" at runtime. */ 586 /* These will require a "tree" at runtime. */
591 { "DFJKT", 0, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q+", "", NULL }, 587 { "DFKTE", 0, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q+", "", NULL },
592 588
593 { "<>'", 0, STD_C89, NOARGUMENTS, "", "", NULL }, 589 { "<>'", 0, STD_C89, NOARGUMENTS, "", "", NULL },
594 { "m", 0, STD_C89, NOARGUMENTS, "q", "", NULL }, 590 { "m", 0, STD_C89, NOARGUMENTS, "q", "", NULL },
595 { NULL, 0, STD_C89, NOLENGTHS, NULL, NULL, NULL } 591 { NULL, 0, STD_C89, NOLENGTHS, NULL, NULL, NULL }
596 }; 592 };
605 { "s", 1, STD_C89, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "pq", "cR", NULL }, 601 { "s", 1, STD_C89, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "pq", "cR", NULL },
606 { "p", 1, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "c", NULL }, 602 { "p", 1, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "c", NULL },
607 603
608 /* Custom conversion specifiers. */ 604 /* Custom conversion specifiers. */
609 605
610 /* %H will require "location_t" at runtime. */
611 { "H", 0, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "", NULL },
612
613 /* These will require a "tree" at runtime. */ 606 /* These will require a "tree" at runtime. */
614 { "DEFJKT", 0, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q+", "", NULL }, 607 { "DEFKT", 0, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q+", "", NULL },
615 608
616 { "<>'", 0, STD_C89, NOARGUMENTS, "", "", NULL }, 609 { "<>'", 0, STD_C89, NOARGUMENTS, "", "", NULL },
617 { "m", 0, STD_C89, NOARGUMENTS, "q", "", NULL }, 610 { "m", 0, STD_C89, NOARGUMENTS, "q", "", NULL },
618 { NULL, 0, STD_C89, NOLENGTHS, NULL, NULL, NULL } 611 { NULL, 0, STD_C89, NOLENGTHS, NULL, NULL, NULL }
619 }; 612 };
628 { "s", 1, STD_C89, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "pq", "cR", NULL }, 621 { "s", 1, STD_C89, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "pq", "cR", NULL },
629 { "p", 1, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "c", NULL }, 622 { "p", 1, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "c", NULL },
630 623
631 /* Custom conversion specifiers. */ 624 /* Custom conversion specifiers. */
632 625
633 /* %H will require "location_t" at runtime. */
634 { "H", 0, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "", NULL },
635
636 /* These will require a "tree" at runtime. */ 626 /* These will require a "tree" at runtime. */
637 { "ADEFJKTV",0,STD_C89,{ T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q+#", "", NULL }, 627 { "ADEFKTV",0,STD_C89,{ T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q+#", "", NULL },
638 628
639 /* These accept either an 'int' or an 'enum tree_code' (which is handled as an 'int'.) */ 629 /* These accept either an 'int' or an 'enum tree_code' (which is handled as an 'int'.) */
640 { "CLOPQ",0,STD_C89, { T89_I, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "", NULL }, 630 { "CLOPQ",0,STD_C89, { T89_I, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "", NULL },
641 631
642 { "<>'", 0, STD_C89, NOARGUMENTS, "", "", NULL }, 632 { "<>'", 0, STD_C89, NOARGUMENTS, "", "", NULL },
1489 format_wanted_type *last_wanted_type = NULL; 1479 format_wanted_type *last_wanted_type = NULL;
1490 const format_length_info *fli = NULL; 1480 const format_length_info *fli = NULL;
1491 const format_char_info *fci = NULL; 1481 const format_char_info *fci = NULL;
1492 char flag_chars[256]; 1482 char flag_chars[256];
1493 int alloc_flag = 0; 1483 int alloc_flag = 0;
1484 int scalar_identity_flag = 0;
1494 const char *format_start = format_chars; 1485 const char *format_start = format_chars;
1495 if (*format_chars == 0) 1486 if (*format_chars == 0)
1496 { 1487 {
1497 if (format_chars - orig_format_chars != format_length) 1488 if (format_chars - orig_format_chars != format_length)
1498 warning (OPT_Wformat_contains_nul, "embedded %<\\0%> in format"); 1489 warning (OPT_Wformat_contains_nul, "embedded %<\\0%> in format");
1622 } 1613 }
1623 width_wanted_type.wanted_type = *fki->width_type; 1614 width_wanted_type.wanted_type = *fki->width_type;
1624 width_wanted_type.wanted_type_name = NULL; 1615 width_wanted_type.wanted_type_name = NULL;
1625 width_wanted_type.pointer_count = 0; 1616 width_wanted_type.pointer_count = 0;
1626 width_wanted_type.char_lenient_flag = 0; 1617 width_wanted_type.char_lenient_flag = 0;
1618 width_wanted_type.scalar_identity_flag = 0;
1627 width_wanted_type.writing_in_flag = 0; 1619 width_wanted_type.writing_in_flag = 0;
1628 width_wanted_type.reading_from_flag = 0; 1620 width_wanted_type.reading_from_flag = 0;
1629 width_wanted_type.name = _("field width"); 1621 width_wanted_type.name = _("field width");
1630 width_wanted_type.param = cur_param; 1622 width_wanted_type.param = cur_param;
1631 width_wanted_type.arg_num = arg_num; 1623 width_wanted_type.arg_num = arg_num;
1724 } 1716 }
1725 precision_wanted_type.wanted_type = *fki->precision_type; 1717 precision_wanted_type.wanted_type = *fki->precision_type;
1726 precision_wanted_type.wanted_type_name = NULL; 1718 precision_wanted_type.wanted_type_name = NULL;
1727 precision_wanted_type.pointer_count = 0; 1719 precision_wanted_type.pointer_count = 0;
1728 precision_wanted_type.char_lenient_flag = 0; 1720 precision_wanted_type.char_lenient_flag = 0;
1721 precision_wanted_type.scalar_identity_flag = 0;
1729 precision_wanted_type.writing_in_flag = 0; 1722 precision_wanted_type.writing_in_flag = 0;
1730 precision_wanted_type.reading_from_flag = 0; 1723 precision_wanted_type.reading_from_flag = 0;
1731 precision_wanted_type.name = _("field precision"); 1724 precision_wanted_type.name = _("field precision");
1732 precision_wanted_type.param = cur_param; 1725 precision_wanted_type.param = cur_param;
1733 precision_wanted_type.arg_num = arg_num; 1726 precision_wanted_type.arg_num = arg_num;
1777 /* Read any length modifier, if this kind of format has them. */ 1770 /* Read any length modifier, if this kind of format has them. */
1778 fli = fki->length_char_specs; 1771 fli = fki->length_char_specs;
1779 length_chars = NULL; 1772 length_chars = NULL;
1780 length_chars_val = FMT_LEN_none; 1773 length_chars_val = FMT_LEN_none;
1781 length_chars_std = STD_C89; 1774 length_chars_std = STD_C89;
1775 scalar_identity_flag = 0;
1782 if (fli) 1776 if (fli)
1783 { 1777 {
1784 while (fli->name != 0 1778 while (fli->name != 0
1785 && strncmp (fli->name, format_chars, strlen (fli->name))) 1779 && strncmp (fli->name, format_chars, strlen (fli->name)))
1786 fli++; 1780 fli++;
1787 if (fli->name != 0) 1781 if (fli->name != 0)
1788 { 1782 {
1789 format_chars += strlen (fli->name); 1783 format_chars += strlen (fli->name);
1797 else 1791 else
1798 { 1792 {
1799 length_chars = fli->name; 1793 length_chars = fli->name;
1800 length_chars_val = fli->index; 1794 length_chars_val = fli->index;
1801 length_chars_std = fli->std; 1795 length_chars_std = fli->std;
1796 scalar_identity_flag = fli->scalar_identity_flag;
1802 } 1797 }
1803 i = strlen (flag_chars); 1798 i = strlen (flag_chars);
1804 flag_chars[i++] = fki->length_code_char; 1799 flag_chars[i++] = fki->length_code_char;
1805 flag_chars[i] = 0; 1800 flag_chars[i] = 0;
1806 } 1801 }
2085 wanted_type_ptr->wanted_type_name = wanted_type_name; 2080 wanted_type_ptr->wanted_type_name = wanted_type_name;
2086 wanted_type_ptr->pointer_count = fci->pointer_count + alloc_flag; 2081 wanted_type_ptr->pointer_count = fci->pointer_count + alloc_flag;
2087 wanted_type_ptr->char_lenient_flag = 0; 2082 wanted_type_ptr->char_lenient_flag = 0;
2088 if (strchr (fci->flags2, 'c') != 0) 2083 if (strchr (fci->flags2, 'c') != 0)
2089 wanted_type_ptr->char_lenient_flag = 1; 2084 wanted_type_ptr->char_lenient_flag = 1;
2085 wanted_type_ptr->scalar_identity_flag = 0;
2086 if (scalar_identity_flag)
2087 wanted_type_ptr->scalar_identity_flag = 1;
2090 wanted_type_ptr->writing_in_flag = 0; 2088 wanted_type_ptr->writing_in_flag = 0;
2091 wanted_type_ptr->reading_from_flag = 0; 2089 wanted_type_ptr->reading_from_flag = 0;
2092 if (alloc_flag) 2090 if (alloc_flag)
2093 wanted_type_ptr->writing_in_flag = 1; 2091 wanted_type_ptr->writing_in_flag = 1;
2094 else 2092 else
2269 equivalent but the above test won't consider them equivalent. */ 2267 equivalent but the above test won't consider them equivalent. */
2270 if (wanted_type == char_type_node 2268 if (wanted_type == char_type_node
2271 && (!pedantic || i < 2) 2269 && (!pedantic || i < 2)
2272 && char_type_flag) 2270 && char_type_flag)
2273 continue; 2271 continue;
2272 if (types->scalar_identity_flag
2273 && (TREE_CODE (cur_type) == TREE_CODE (wanted_type)
2274 || (INTEGRAL_TYPE_P (cur_type)
2275 && INTEGRAL_TYPE_P (wanted_type)))
2276 && TYPE_PRECISION (cur_type) == TYPE_PRECISION (wanted_type))
2277 continue;
2274 /* Now we have a type mismatch. */ 2278 /* Now we have a type mismatch. */
2275 format_type_warning (types->name, format_start, format_length, 2279 format_type_warning (types->name, format_start, format_length,
2276 wanted_type, types->pointer_count, 2280 wanted_type, types->pointer_count,
2277 types->wanted_type_name, orig_cur_type, arg_num); 2281 types->wanted_type_name, orig_cur_type, arg_num);
2278 } 2282 }
2606 dynamic_format_types[gcc_diag_format_type].conversion_specs = 2610 dynamic_format_types[gcc_diag_format_type].conversion_specs =
2607 diag_fci = (format_char_info *) 2611 diag_fci = (format_char_info *)
2608 xmemdup (gcc_diag_char_table, 2612 xmemdup (gcc_diag_char_table,
2609 sizeof (gcc_diag_char_table), 2613 sizeof (gcc_diag_char_table),
2610 sizeof (gcc_diag_char_table)); 2614 sizeof (gcc_diag_char_table));
2611 if (loc)
2612 {
2613 i = find_char_info_specifier_index (diag_fci, 'H');
2614 diag_fci[i].types[0].type = &loc;
2615 diag_fci[i].pointer_count = 1;
2616 }
2617 if (t) 2615 if (t)
2618 { 2616 {
2619 i = find_char_info_specifier_index (diag_fci, 'J');
2620 diag_fci[i].types[0].type = &t;
2621 diag_fci[i].pointer_count = 1;
2622 i = find_char_info_specifier_index (diag_fci, 'K'); 2617 i = find_char_info_specifier_index (diag_fci, 'K');
2623 diag_fci[i].types[0].type = &t; 2618 diag_fci[i].types[0].type = &t;
2624 diag_fci[i].pointer_count = 1; 2619 diag_fci[i].pointer_count = 1;
2625 } 2620 }
2626 2621
2629 dynamic_format_types[gcc_tdiag_format_type].conversion_specs = 2624 dynamic_format_types[gcc_tdiag_format_type].conversion_specs =
2630 tdiag_fci = (format_char_info *) 2625 tdiag_fci = (format_char_info *)
2631 xmemdup (gcc_tdiag_char_table, 2626 xmemdup (gcc_tdiag_char_table,
2632 sizeof (gcc_tdiag_char_table), 2627 sizeof (gcc_tdiag_char_table),
2633 sizeof (gcc_tdiag_char_table)); 2628 sizeof (gcc_tdiag_char_table));
2634 if (loc)
2635 {
2636 i = find_char_info_specifier_index (tdiag_fci, 'H');
2637 tdiag_fci[i].types[0].type = &loc;
2638 tdiag_fci[i].pointer_count = 1;
2639 }
2640 if (t) 2629 if (t)
2641 { 2630 {
2642 /* All specifiers taking a tree share the same struct. */ 2631 /* All specifiers taking a tree share the same struct. */
2643 i = find_char_info_specifier_index (tdiag_fci, 'D'); 2632 i = find_char_info_specifier_index (tdiag_fci, 'D');
2644 tdiag_fci[i].types[0].type = &t;
2645 tdiag_fci[i].pointer_count = 1;
2646 i = find_char_info_specifier_index (tdiag_fci, 'J');
2647 tdiag_fci[i].types[0].type = &t; 2633 tdiag_fci[i].types[0].type = &t;
2648 tdiag_fci[i].pointer_count = 1; 2634 tdiag_fci[i].pointer_count = 1;
2649 i = find_char_info_specifier_index (tdiag_fci, 'K'); 2635 i = find_char_info_specifier_index (tdiag_fci, 'K');
2650 tdiag_fci[i].types[0].type = &t; 2636 tdiag_fci[i].types[0].type = &t;
2651 tdiag_fci[i].pointer_count = 1; 2637 tdiag_fci[i].pointer_count = 1;
2656 dynamic_format_types[gcc_cdiag_format_type].conversion_specs = 2642 dynamic_format_types[gcc_cdiag_format_type].conversion_specs =
2657 cdiag_fci = (format_char_info *) 2643 cdiag_fci = (format_char_info *)
2658 xmemdup (gcc_cdiag_char_table, 2644 xmemdup (gcc_cdiag_char_table,
2659 sizeof (gcc_cdiag_char_table), 2645 sizeof (gcc_cdiag_char_table),
2660 sizeof (gcc_cdiag_char_table)); 2646 sizeof (gcc_cdiag_char_table));
2661 if (loc)
2662 {
2663 i = find_char_info_specifier_index (cdiag_fci, 'H');
2664 cdiag_fci[i].types[0].type = &loc;
2665 cdiag_fci[i].pointer_count = 1;
2666 }
2667 if (t) 2647 if (t)
2668 { 2648 {
2669 /* All specifiers taking a tree share the same struct. */ 2649 /* All specifiers taking a tree share the same struct. */
2670 i = find_char_info_specifier_index (cdiag_fci, 'D'); 2650 i = find_char_info_specifier_index (cdiag_fci, 'D');
2671 cdiag_fci[i].types[0].type = &t;
2672 cdiag_fci[i].pointer_count = 1;
2673 i = find_char_info_specifier_index (cdiag_fci, 'J');
2674 cdiag_fci[i].types[0].type = &t; 2651 cdiag_fci[i].types[0].type = &t;
2675 cdiag_fci[i].pointer_count = 1; 2652 cdiag_fci[i].pointer_count = 1;
2676 i = find_char_info_specifier_index (cdiag_fci, 'K'); 2653 i = find_char_info_specifier_index (cdiag_fci, 'K');
2677 cdiag_fci[i].types[0].type = &t; 2654 cdiag_fci[i].types[0].type = &t;
2678 cdiag_fci[i].pointer_count = 1; 2655 cdiag_fci[i].pointer_count = 1;
2683 dynamic_format_types[gcc_cxxdiag_format_type].conversion_specs = 2660 dynamic_format_types[gcc_cxxdiag_format_type].conversion_specs =
2684 cxxdiag_fci = (format_char_info *) 2661 cxxdiag_fci = (format_char_info *)
2685 xmemdup (gcc_cxxdiag_char_table, 2662 xmemdup (gcc_cxxdiag_char_table,
2686 sizeof (gcc_cxxdiag_char_table), 2663 sizeof (gcc_cxxdiag_char_table),
2687 sizeof (gcc_cxxdiag_char_table)); 2664 sizeof (gcc_cxxdiag_char_table));
2688 if (loc)
2689 {
2690 i = find_char_info_specifier_index (cxxdiag_fci, 'H');
2691 cxxdiag_fci[i].types[0].type = &loc;
2692 cxxdiag_fci[i].pointer_count = 1;
2693 }
2694 if (t) 2665 if (t)
2695 { 2666 {
2696 /* All specifiers taking a tree share the same struct. */ 2667 /* All specifiers taking a tree share the same struct. */
2697 i = find_char_info_specifier_index (cxxdiag_fci, 'D'); 2668 i = find_char_info_specifier_index (cxxdiag_fci, 'D');
2698 cxxdiag_fci[i].types[0].type = &t;
2699 cxxdiag_fci[i].pointer_count = 1;
2700 i = find_char_info_specifier_index (cxxdiag_fci, 'J');
2701 cxxdiag_fci[i].types[0].type = &t; 2669 cxxdiag_fci[i].types[0].type = &t;
2702 cxxdiag_fci[i].pointer_count = 1; 2670 cxxdiag_fci[i].pointer_count = 1;
2703 i = find_char_info_specifier_index (cxxdiag_fci, 'K'); 2671 i = find_char_info_specifier_index (cxxdiag_fci, 'K');
2704 cxxdiag_fci[i].types[0].type = &t; 2672 cxxdiag_fci[i].types[0].type = &t;
2705 cxxdiag_fci[i].pointer_count = 1; 2673 cxxdiag_fci[i].pointer_count = 1;
2863 *no_add_attrs = true; 2831 *no_add_attrs = true;
2864 return NULL_TREE; 2832 return NULL_TREE;
2865 } 2833 }
2866 2834
2867 /* If this is a custom GCC-internal format type, we have to 2835 /* If this is a custom GCC-internal format type, we have to
2868 initialize certain bits a runtime. */ 2836 initialize certain bits at runtime. */
2869 if (info.format_type == asm_fprintf_format_type 2837 if (info.format_type == asm_fprintf_format_type
2870 || info.format_type == gcc_gfc_format_type 2838 || info.format_type == gcc_gfc_format_type
2871 || info.format_type == gcc_diag_format_type 2839 || info.format_type == gcc_diag_format_type
2872 || info.format_type == gcc_tdiag_format_type 2840 || info.format_type == gcc_tdiag_format_type
2873 || info.format_type == gcc_cdiag_format_type 2841 || info.format_type == gcc_cdiag_format_type