Commit 6659e606 authored by jsm28's avatar jsm28
Browse files

* c-common.h (enum c_tree_index): Add CTI_C_SIZE_TYPE.

	(c_size_type_node): Define.
	* c-decl.c (init_decl_processing): Initialize c_size_type_node.
	* c-common.c (enum format_lengths, enum format_std_version,
	format_length_info, format_type_detail, BADLEN, NOLENGTHS,
	format_kind_info, printf_length_specs, scanf_length_specs, T89_I,
	T99_I, T89_L, T99_LL, TEX_LL, T89_S, T89_UI, T99_UI, T89_UL,
	T99_ULL, TEX_ULL, T89_US, T89_F, T99_F, T89_D, T99_D, T89_LD,
	T99_LD, T89_C, T99_SC, T99_UC, T89_V, T94_W, TEX_W, T94_WI,
	TEX_WI, T99_ST, T99_SST, T99_PD, T99_UPD, T99_IM, T99_UIM,
	format_types): Define.
	(format_char_info, print_char_table, scan_char_table,
	time_char_table): Rearrange for new organization of information
	about format length modifiers and standard versions.
	(T_ST): Redefine to use c_size_type_node.
	(check_format_info): Obtain information about length modifiers and
	standard versions from tables.  Adjust warning message wordings.
	Use the name from the user's program for `ll' and `hh' length
	modifiers in warning messages.  Use more informative names for
	wanted types where available (for wchar_t, wint_t, size_t, signed
	size_t, ptrdiff_t, unsigned ptrdiff_t, intmax_t and uintmax_t).

testsuite:
	* gcc.dg/format-diag-1.c: New test.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@36106 138bc75d-0d04-0410-961f-82ee72b054a4
parent 9f37edbe
2000-09-01 Joseph S. Myers <jsm28@cam.ac.uk>
* c-common.h (enum c_tree_index): Add CTI_C_SIZE_TYPE.
(c_size_type_node): Define.
* c-decl.c (init_decl_processing): Initialize c_size_type_node.
* c-common.c (enum format_lengths, enum format_std_version,
format_length_info, format_type_detail, BADLEN, NOLENGTHS,
format_kind_info, printf_length_specs, scanf_length_specs, T89_I,
T99_I, T89_L, T99_LL, TEX_LL, T89_S, T89_UI, T99_UI, T89_UL,
T99_ULL, TEX_ULL, T89_US, T89_F, T99_F, T89_D, T99_D, T89_LD,
T99_LD, T89_C, T99_SC, T99_UC, T89_V, T94_W, TEX_W, T94_WI,
TEX_WI, T99_ST, T99_SST, T99_PD, T99_UPD, T99_IM, T99_UIM,
format_types): Define.
(format_char_info, print_char_table, scan_char_table,
time_char_table): Rearrange for new organization of information
about format length modifiers and standard versions.
(T_ST): Redefine to use c_size_type_node.
(check_format_info): Obtain information about length modifiers and
standard versions from tables. Adjust warning message wordings.
Use the name from the user's program for `ll' and `hh' length
modifiers in warning messages. Use more informative names for
wanted types where available (for wchar_t, wint_t, size_t, signed
size_t, ptrdiff_t, unsigned ptrdiff_t, intmax_t and uintmax_t).
2000-09-01 Jim Wilson <wilson@cygnus.com>
* loop.c (check_final_value): Check for biv use before checking for
......
This diff is collapsed.
......@@ -91,6 +91,7 @@ enum c_tree_index
CTI_SIGNED_WCHAR_TYPE,
CTI_UNSIGNED_WCHAR_TYPE,
CTI_WINT_TYPE,
CTI_C_SIZE_TYPE, /* For format checking only. */
CTI_SIGNED_SIZE_TYPE, /* For format checking only. */
CTI_UNSIGNED_PTRDIFF_TYPE, /* For format checking only. */
CTI_WIDEST_INT_LIT_TYPE,
......@@ -130,6 +131,7 @@ enum c_tree_index
#define signed_wchar_type_node c_global_trees[CTI_SIGNED_WCHAR_TYPE]
#define unsigned_wchar_type_node c_global_trees[CTI_UNSIGNED_WCHAR_TYPE]
#define wint_type_node c_global_trees[CTI_WINT_TYPE]
#define c_size_type_node c_global_trees[CTI_C_SIZE_TYPE]
#define signed_size_type_node c_global_trees[CTI_SIGNED_SIZE_TYPE]
#define unsigned_ptrdiff_type_node c_global_trees[CTI_UNSIGNED_PTRDIFF_TYPE]
#define widest_integer_literal_type_node c_global_trees[CTI_WIDEST_INT_LIT_TYPE]
......
......@@ -3016,6 +3016,7 @@ init_decl_processing ()
if (flag_traditional && TREE_UNSIGNED (t))
t = signed_type (t);
c_size_type_node = t;
set_sizetype (t);
/* Create the widest literal types. */
......
2000-09-01 Joseph S. Myers <jsm28@cam.ac.uk>
* gcc.dg/format-diag-1.c: New test.
2000-09-01 Joseph S. Myers <jsm28@cam.ac.uk>
* gcc.dg/c90-printf-1.c, gcc.dg/c90-printf-2.c,
......
/* Test for format diagnostics. */
/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
/* { dg-do compile } */
/* { dg-options "-std=gnu99 -Wformat" } */
extern int printf (const char *, ...);
void
foo (double d)
{
/* This should get a message referring to `hh', not to `H'. */
printf ("%hhf", d); /* { dg-warning "hh" "%hhf warning" } */
/* This should get a message referring to `ll', not to `q'. */
printf ("%llf", d); /* { dg-warning "ll" "%llf warning" } */
/* This should get a message referring to `size_t format', not to
`unsigned int format' or similar. */
printf ("%zu", d); /* { dg-warning "size_t format" "size_t format warning" } */
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment