From 498c0f2757190a22826576174616ab2403e2f4f6 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 10 Jun 2004 10:08:02 +0200 Subject: re PR c++/14791 (13070 does not fix -Wformat with fprintf) PR c++/14791 * tree.h (enum tree_index): Add TI_FILEPTR_TYPE. (fileptr_type_node): Define. * tree.c (build_common_tree_nodes_2): Initialize fileptr_type_node to ptr_type_node. * c-common.c (c_common_nodes_and_builtins): For C++, make fileptr_type_node a distinct type copy. * builtin-types.def (BT_FILEPTR, BT_FN_INT_CONST_STRING_FILEPTR, BT_FN_INT_INT_FILEPTR, BT_FN_INT_FILEPTR_CONST_STRING_VALIST_ARG, BT_FN_SIZE_CONST_PTR_SIZE_SIZE_FILEPTR, BT_FN_INT_FILEPTR_CONST_STRING_VAR): Add. (BT_FN_INT_CONST_STRING_PTR, BT_FN_INT_INT_PTR, BT_FN_SIZE_CONST_PTR_SIZE_SIZE_PTR, BT_FN_INT_PTR_CONST_STRING_VAR, BT_FN_INT_PTR_CONST_STRING_VALIST_ARG): Remove. * builtins.def (BUILT_IN_FPRINTF, BUILT_IN_FPRINTF_UNLOCKED, BUILT_IN_FPUTC, BUILT_IN_FPUTC_UNLOCKED, BUILT_IN_FPUTS, BUILT_IN_FPUTS_UNLOCKED, BUILT_IN_FSCANF, BUILT_IN_FWRITE, BUILT_IN_FWRITE_UNLOCKED, BUILT_IN_VFPRINTF, BUILT_IN_VFSCANF): Use the above *FILEPTR* types instead of *PTR*. * decl.c (duplicate_decls): Handle fileptr_type_node arguments specially. * g++.dg/opt/builtins1.C: New test. From-SVN: r82902 --- gcc/c-common.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'gcc/c-common.c') diff --git a/gcc/c-common.c b/gcc/c-common.c index 89bc80e..01a8783 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -3297,6 +3297,11 @@ c_common_nodes_and_builtins (void) (build_decl (TYPE_DECL, get_identifier ("complex long double"), complex_long_double_type_node)); + if (c_dialect_cxx ()) + /* For C++, make fileptr_type_node a distinct void * type until + FILE type is defined. */ + fileptr_type_node = build_type_copy (ptr_type_node); + record_builtin_type (RID_VOID, NULL, void_type_node); void_zero_node = build_int_2 (0, 0); -- cgit v1.1