From: "Joseph S. Myers" <joseph@codesourcery.com>
To: Kai Tietz <Kai.Tietz@onevision.com>
Cc: Danny Smith <dansmister@gmail.com>,
GCC Patches <gcc-patches@gcc.gnu.org>,
NightStrike <nightstrike@gmail.com>
Subject: Re: Ping - old patch from April - mingw support for I32/I64 MS printf formatters to c-format.c
Date: Wed, 13 Feb 2008 18:32:00 -0000 [thread overview]
Message-ID: <Pine.LNX.4.64.0802131747290.22272@digraph.polyomino.org.uk> (raw)
In-Reply-To: <OFB48CCF55.D0869FC4-ONC12573E5.004CDDD5-C12573E5.004EE0DB@onevision.de>
On Mon, 4 Feb 2008, Kai Tietz wrote:
> Thank you for your advice. May just by consistancy we should'nt declare
> C99 functions for c90 in format.h. But the %Y is not present for mingw at
> all. Therefore I prefer to disable them for these targets completely.
In that case you'll need to disable c99-printf-3.c for those targets as
well; this patch version still has the bogus changes there.
"formatter" is nowhere used in the existing code to refer to kinds of
formats; I suggest just using "format" throughout the patch.
> * testsuite/gcc.dg/format/sys_formatter.c: New.
Does not belong in gcc/; you appear to have a properly located ChangeLog
entry for this file below.
> @@ -1776,7 +1782,22 @@ check_format_info_main (format_check_res
> if (fli)
> {
> while (fli->name != 0 && fli->name[0] != *format_chars)
> - fli++;
> + {
> + if (fli->name[0] == '\0')
[...]
If this patch chunk is changing the meaning of some structure in
c-format.h, the comments on that structure need updating to describe the
new semantics implemented by this new code.
> +/* Description of gnu specific format attributes reflected to
> + system format attribute types, as printf, scanf, strftime, and
> + strfmon. */
Not clear English, especially "reflected". I think something like
/* Attributes such as "printf" are equivalent to those such as
"gnu_printf" unless this is overridden by a target. */
would be a clearer description of the purpose of this array.
> +const target_ovr_attr gnu_target_overrides_format_attributes[] =
I think this can be static.
> +/* Translate to unified attribute name. This is used in decode_format_type and
> + decode_format_attr. In attr_name the user specified argument is passed. It
> + returns the unified formatter name from TARGET_OVERRIDES_FORMAT_ATTRIBUTES
> + or the attr_name passed to this function, if there is no matching entry. */
> +static const char *
> +replace_formatter_name_to_system_name (const char *attr_name)
"replace ... to" isn't idiomatic English; "convert" might be better than
"replace" here.
> +/* A helper function to compare the target override format attribute tattr_name
> + and the user format attribute attr_name. The underscore variant of attr_name
> + is ignore for compare. I returns for equal attribute the value one, otherwise
> + zero. */
/* Return true if TATTR_NAME and ATTR_NAME are the same format attribute,
counting "name" and "__name__" as the same, false otherwise. */
> +static int
Should return bool rather than int.
> +/* For none gnu style formatter types we need to compare the none gnu formatter
> + and a gnu style formatter style to compare in kind. This is done via the
> + array TARGET_OVERRIDES_FORMAT_ATTRIBUTES. The argument custom_type specifiers
> + the index of the formatter. The argument def_type specifies the gnu style
> + formatter index to be compare with. If the kind is equal it returns true,
> + otherwise false. */
> +static int
What should this return for comparing each pair of strftime, gnu_strftime,
ms_strftime? I can't tell from the comment.
Actually, I don't think we need this function. The comparisons against
specific types that you change to call this function are used for two
things: processing GCC-internal formats, and giving the error "strftime
formats cannot format arguments". For the former, there will be no
target-specific variants; these formats are the same everywhere. For the
latter, it would be better to replace the hardcoded check for
strftime_format_type with a check for the format not setting
FMT_FLAG_ARG_CONVERT in its flags; that's the right condition to check.
The diagnostic should name the particular attribute in use, whether
"strftime", "gnu_strftime" or "ms_strftime" (that is, the attribute in the
user's source code, not any translated version of it).
> +/* Structure describing the target specific to be override formatter
> + attributes, e.g. printf, scanf, etc. This allows to support different
> + runtime-library specific formatter attributes to co-exist and defining
> + a default system version.
> + This type is used for the pointer variable TARGET_OVERRIDES_FORMAT_ATTRIBUTES
> + refers to. */
/* Structure describing how format attributes such as "printf" are
interpreted as "gnu_printf" or "ms_printf" on a particular system.
TARGET_OVERRIDES_FORMAT_ATTRIBUTES is used to specify target-specific
defaults. */
> +/* Be aware to keep these values in synch with enum format_type from c-format.c. */
Perhaps that enum should simply move to this header and avoid the separate
list?
--
Joseph S. Myers
joseph@codesourcery.com
next prev parent reply other threads:[~2008-02-13 18:17 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <Pine.LNX.4.64.0801312346090.5937@digraph.polyomino.org.uk>
2008-02-01 11:04 ` Kai Tietz
2008-02-01 15:52 ` Joseph S. Myers
2008-02-04 14:23 ` Kai Tietz
2008-02-13 18:32 ` Joseph S. Myers [this message]
2008-02-19 9:22 ` Kai Tietz
2008-02-19 12:38 ` Joseph S. Myers
2008-02-19 13:30 ` Kai Tietz
2008-02-19 14:10 ` Joseph S. Myers
2008-02-19 15:16 ` Kai Tietz
2008-02-25 16:46 ` NightStrike
2008-02-25 16:58 ` Joseph S. Myers
2008-02-25 17:42 ` NightStrike
2008-02-25 18:53 ` Joseph S. Myers
2008-03-04 19:25 ` Joseph S. Myers
2008-03-10 11:06 ` Kai Tietz
2008-03-10 22:29 ` Joseph S. Myers
2008-03-13 0:03 ` Danny Smith
2008-03-13 8:43 ` Kai Tietz
2008-03-13 9:29 ` Kai Tietz
2008-03-13 19:24 ` Ralf Wildenhues
2008-03-14 9:32 ` Kai Tietz
2008-03-13 20:52 ` Danny Smith
2008-03-14 11:00 ` Kai Tietz
2008-03-16 5:54 ` Danny Smith
2008-03-16 12:16 ` Kai Tietz
2008-03-18 9:12 ` [patch]: pr33617 vector modes have to be passed via memory for x86_64-pc-mingw32 Kai Tietz
2008-03-18 9:54 ` Kai Tietz
2008-03-18 13:20 ` Ping - old patch from April - mingw support for I32/I64 MS printf formatters to c-format.c Kai Tietz
2008-03-18 13:44 ` NightStrike
2008-03-18 13:51 ` Kai Tietz
2008-03-18 15:07 ` Kai Tietz
2008-03-19 5:01 ` NightStrike
2008-03-19 6:22 ` Danny Smith
2008-03-19 9:42 ` Kai Tietz
2008-03-19 13:43 ` NightStrike
2008-03-19 13:51 ` NightStrike
2008-03-20 1:18 ` Danny Smith
2008-03-20 1:18 ` NightStrike
2008-03-20 9:54 ` Kai Tietz
2008-02-13 21:27 ` Danny Smith
2008-02-19 9:17 ` Kai Tietz
2008-03-13 22:38 FX Coudert
2008-03-14 1:33 ` Joseph S. Myers
2008-03-16 7:58 ` Danny Smith
-- strict thread matches above, loose matches on Subject: below --
2008-01-16 16:14 Kai Tietz
2007-12-04 17:55 NightStrike
2007-12-04 18:32 ` Joseph S. Myers
2007-12-05 21:35 ` NightStrike
2007-12-05 22:53 ` Joseph S. Myers
2007-12-18 14:06 ` Kai Tietz
2007-12-18 16:30 ` Joseph S. Myers
2007-12-18 21:14 ` Danny Smith
2007-12-20 13:00 ` Kai Tietz
2007-12-20 14:16 ` Joseph S. Myers
2007-12-20 14:30 ` Kai Tietz
2007-12-21 14:03 ` Kai Tietz
2007-12-21 14:38 ` Joseph S. Myers
2008-01-07 13:56 ` Kai Tietz
2008-01-07 14:44 ` Joseph S. Myers
2008-01-07 16:26 ` Kai Tietz
2008-01-08 14:37 ` Kai Tietz
2008-01-08 18:18 ` Joseph S. Myers
2008-01-15 16:45 ` Kai Tietz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.0802131747290.22272@digraph.polyomino.org.uk \
--to=joseph@codesourcery.com \
--cc=Kai.Tietz@onevision.com \
--cc=dansmister@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=nightstrike@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).