2004-04-20 Danny Smith * c-format.c (format_length_info printf_length_specs): Add "I64" length specifier if __MINGW32__. (format_length_info scanf_length_specs): Likwise. (printf_flag_specs): Don't accept 'I' (by itself) format flags if __MINGW32__. (scanf_flag_specs): Ditto. (format_types_orig): Ditto. (check_format_info_main): Handle "I64" length specifier if __MINGW32__. Index: gcc/gcc/c-format.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/c-format.c,v retrieving revision 1.51 diff -c -3 -p -r1.51 c-format.c *** gcc/gcc/c-format.c 20 Dec 2003 00:00:27 -0000 1.51 --- gcc/gcc/c-format.c 11 Nov 2004 01:26:33 -0000 *************** Software Foundation, 59 Temple Place - S *** 30,35 **** --- 30,36 ---- #include "intl.h" #include "diagnostic.h" #include "langhooks.h" + /* Set format warning options according to a -Wformat=n option. */ *************** static const format_length_info printf_l *** 509,514 **** --- 510,518 ---- { "h", FMT_LEN_h, STD_C89, "hh", FMT_LEN_hh, STD_C99 }, { "l", FMT_LEN_l, STD_C89, "ll", FMT_LEN_ll, STD_C9L }, { "q", FMT_LEN_ll, STD_EXT, NULL, 0, 0 }, + #ifdef __MINGW32__ + { "I64", FMT_LEN_ll, STD_EXT, NULL, 0, 0 }, + #endif { "L", FMT_LEN_L, STD_C89, NULL, 0, 0 }, { "z", FMT_LEN_z, STD_C99, NULL, 0, 0 }, { "Z", FMT_LEN_z, STD_EXT, NULL, 0, 0 }, *************** static const format_length_info scanf_le *** 543,548 **** --- 547,555 ---- { "h", FMT_LEN_h, STD_C89, "hh", FMT_LEN_hh, STD_C99 }, { "l", FMT_LEN_l, STD_C89, "ll", FMT_LEN_ll, STD_C9L }, { "q", FMT_LEN_ll, STD_EXT, NULL, 0, 0 }, + #ifdef __MINGW32__ + { "I64", FMT_LEN_ll, STD_EXT, NULL, 0, 0 }, + #endif { "L", FMT_LEN_L, STD_C89, NULL, 0, 0 }, { "z", FMT_LEN_z, STD_C99, NULL, 0, 0 }, { "t", FMT_LEN_t, STD_C99, NULL, 0, 0 }, *************** static const format_flag_spec printf_fla *** 568,574 **** --- 575,583 ---- { '0', 0, 0, N_("`0' flag"), N_("the `0' printf flag"), STD_C89 }, { '-', 0, 0, N_("`-' flag"), N_("the `-' printf flag"), STD_C89 }, { '\'', 0, 0, N_("`'' flag"), N_("the `'' printf flag"), STD_EXT }, + #ifndef __MINGW32__ { 'I', 0, 0, N_("`I' flag"), N_("the `I' printf flag"), STD_EXT }, + #endif { 'w', 0, 0, N_("field width"), N_("field width in printf format"), STD_C89 }, { 'p', 0, 0, N_("precision"), N_("precision in printf format"), STD_C89 }, { 'L', 0, 0, N_("length modifier"), N_("length modifier in printf format"), STD_C89 }, *************** static const format_flag_spec scanf_flag *** 638,644 **** --- 647,655 ---- { 'w', 0, 0, N_("field width"), N_("field width in scanf format"), STD_C89 }, { 'L', 0, 0, N_("length modifier"), N_("length modifier in scanf format"), STD_C89 }, { '\'', 0, 0, N_("`'' flag"), N_("the `'' scanf flag"), STD_EXT }, + #ifndef __MINGW32__ { 'I', 0, 0, N_("`I' flag"), N_("the `I' scanf flag"), STD_EXT }, + #endif { 0, 0, 0, NULL, NULL, 0 } }; *************** static const format_char_info monetary_c *** 917,927 **** { NULL, 0, 0, NOLENGTHS, NULL, NULL } }; /* This must be in the same order as enum format_type. */ static const format_kind_info format_types_orig[] = { ! { "printf", printf_length_specs, print_char_table, " +#0-'I", NULL, printf_flag_specs, printf_flag_pairs, FMT_FLAG_ARG_CONVERT|FMT_FLAG_DOLLAR_MULTIPLE|FMT_FLAG_USE_DOLLAR|FMT_FLAG_EMPTY_PREC_OK, 'w', 0, 'p', 0, 'L', --- 928,945 ---- { NULL, 0, 0, NOLENGTHS, NULL, NULL } }; + #ifdef __MINGW32__ + #define PRINTF_FLAG_CHARS " +#0-'" + #define SCANF_FLAG_CHARS "*'" + #else + #define PRINTF_FLAG_CHARS " +#0-'I" + #define SCANF_FLAG_CHARS "*'I" + #endif /* This must be in the same order as enum format_type. */ static const format_kind_info format_types_orig[] = { ! { "printf", printf_length_specs, print_char_table, PRINTF_FLAG_CHARS, NULL, printf_flag_specs, printf_flag_pairs, FMT_FLAG_ARG_CONVERT|FMT_FLAG_DOLLAR_MULTIPLE|FMT_FLAG_USE_DOLLAR|FMT_FLAG_EMPTY_PREC_OK, 'w', 0, 'p', 0, 'L', *************** static const format_kind_info format_typ *** 951,957 **** 0, 0, 'p', 0, 'L', NULL, &integer_type_node }, ! { "scanf", scanf_length_specs, scan_char_table, "*'I", NULL, scanf_flag_specs, scanf_flag_pairs, FMT_FLAG_ARG_CONVERT|FMT_FLAG_SCANF_A_KLUDGE|FMT_FLAG_USE_DOLLAR|FMT_FLAG_ZERO_WIDTH_BAD|FMT_FLAG_DOLLAR_GAP_POINTER_OK, 'w', 0, 0, '*', 'L', --- 969,975 ---- 0, 0, 'p', 0, 'L', NULL, &integer_type_node }, ! { "scanf", scanf_length_specs, scan_char_table, SCANF_FLAG_CHARS, NULL, scanf_flag_specs, scanf_flag_pairs, FMT_FLAG_ARG_CONVERT|FMT_FLAG_SCANF_A_KLUDGE|FMT_FLAG_USE_DOLLAR|FMT_FLAG_ZERO_WIDTH_BAD|FMT_FLAG_DOLLAR_GAP_POINTER_OK, 'w', 0, 0, '*', 'L', *************** check_format_info_main (int *status, for *** 1929,1935 **** { while (fli->name != 0 && fli->name[0] != *format_chars) fli++; ! if (fli->name != 0) { format_chars++; if (fli->double_name != 0 && fli->name[0] == *format_chars) --- 1947,1959 ---- { while (fli->name != 0 && fli->name[0] != *format_chars) fli++; ! if (fli->name != 0 ! #ifdef __MINGW32__ ! /* Only accept "I64", not 'I' by itself. */ ! && (format_chars[0] != 'I' ! || (format_chars[1] == '6' && format_chars[2] == '4')) ! #endif ! ) { format_chars++; if (fli->double_name != 0 && fli->name[0] == *format_chars) *************** check_format_info_main (int *status, for *** 1941,1946 **** --- 1965,1974 ---- } else { + #ifdef __MINGW32__ + if (fli->name[0] == 'I') + format_chars += 2; + #endif length_chars = fli->name; length_chars_val = fli->index; length_chars_std = fli->std;