From 1e9af8800dc972d7945c2f273be192532136fa30 Mon Sep 17 00:00:00 2001 From: drow Date: Mon, 19 Jul 2004 14:48:09 +0000 Subject: gcc/ * Makefile.in (c-format.o): Depend on c-format.h. * c-format.h: New file. (struct format_char_info): Add CHAIN member. * c-format.c: Move some types and constants to c-format.h. (format_type_error): Set to -1. (struct function_format_info): Use an int for format_type. (decode_format_type): Return an int. Return format_type_error on error. (print_char_table, asm_fprintf_char_table, gcc_diag_char_table) (gcc_diag_char_table, gcc_cdiag_char_table, gcc_cxxdiag_char_table) (scan_char_table, time_char_table, monetary_char_table): Initialize CHAIN to NULL. (n_format_types): New variable. (check_format_info_main): Handle CHAIN in format_char_info. (handle_format_attribute): Handle TARGET_FORMAT_TYPES and TARGET_N_FORMAT_TYPES. * config.gcc (i[34567]86-*-solaris2*, sparc64-*-solaris2*) (sparc-*-solaris2*): Include config/t-sol2 and config/sol2-c.c. * config/sol2-c.c: New file. * config/t-sol2: New file. * config/sol2.h (TARGET_N_FORMAT_TYPES, TARGET_FORMAT_TYPES): Define. * config/sparc/elf.h, config/sparc/sp64-elf.h: Undefine TARGET_N_FORMAT_TYPES and TARGET_FORMAT_TYPES. * doc/extend.texi (Target Format Checks): New section. (Function Attributes): Mention it. * doc/invoke.texi: Mention target format checks. * doc/sourcebuild.texi: Mention target format checks. * dc/tm.texi (Misc): Document TARGET_N_FORMAT_TYPES and TARGET_FORMAT_TYPES. testsuite/ * gcc.dg/format/cmn-err-1.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@84920 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/config/sol2-c.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 gcc/config/sol2-c.c (limited to 'gcc/config/sol2-c.c') diff --git a/gcc/config/sol2-c.c b/gcc/config/sol2-c.c new file mode 100644 index 00000000000..70fdb377a48 --- /dev/null +++ b/gcc/config/sol2-c.c @@ -0,0 +1,72 @@ +/* Solaris support needed only by C/C++ frontends. + Copyright (C) 2004 Free Software Foundation, Inc. + Contributed by CodeSourcery, LLC. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tree.h" + +#include "c-format.h" +#include "intl.h" + +/* cmn_err only accepts "l" and "ll". */ +static const format_length_info cmn_err_length_specs[] = +{ + { "l", FMT_LEN_l, STD_C89, "ll", FMT_LEN_ll, STD_C89 }, + { NULL, 0, 0, NULL, 0, 0 } +}; + +static const format_flag_spec cmn_err_flag_specs[] = +{ + { 'w', 0, 0, N_("field width"), N_("field width in printf format"), STD_C89 }, + { 'L', 0, 0, N_("length modifier"), N_("length modifier in printf format"), STD_C89 }, + { 0, 0, 0, NULL, NULL, 0 } +}; + + +static const format_flag_pair cmn_err_flag_pairs[] = +{ + { 0, 0, 0, 0 } +}; + +static const format_char_info bitfield_string_type = + { "b", 1, STD_C89, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "", "cR", NULL }; + +static const format_char_info cmn_err_char_table[] = +{ + /* C89 conversion specifiers. */ + { "dD", 0, STD_C89, { T89_I, BADLEN, BADLEN, T89_L, T9L_LL, BADLEN, BADLEN, BADLEN, BADLEN }, "w", "", NULL }, + { "oOxX",0, STD_C89, { T89_UI, BADLEN, BADLEN, T89_UL, T9L_ULL, BADLEN, BADLEN, BADLEN, BADLEN }, "w", "", NULL }, + { "u", 0, STD_C89, { T89_UI, BADLEN, BADLEN, T89_UL, T9L_ULL, BADLEN, BADLEN, BADLEN, BADLEN }, "w", "", NULL }, + { "c", 0, STD_C89, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "w", "", NULL }, + { "s", 1, STD_C89, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "w", "cR", NULL }, + { "b", 0, STD_C89, { T89_I, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "", "", &bitfield_string_type }, + { NULL, 0, 0, NOLENGTHS, NULL, NULL, NULL } +}; + +const format_kind_info solaris_format_types[] = { + { "cmn_err", cmn_err_length_specs, cmn_err_char_table, "", NULL, + cmn_err_flag_specs, cmn_err_flag_pairs, + FMT_FLAG_ARG_CONVERT|FMT_FLAG_EMPTY_PREC_OK, + 'w', 0, 0, 0, 'L', + &integer_type_node, &integer_type_node + } +}; -- cgit v1.2.1