diff options
author | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-05-24 19:28:20 +0000 |
---|---|---|
committer | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-05-24 19:28:20 +0000 |
commit | 89e7e0057fced928551d3169ccaec1a106be123b (patch) | |
tree | 8e604d480ecc6f087099ac7d2f0f4f6d9b68c228 /gcc/pretty-print.c | |
parent | b0a309b25cdcff60f332a21043d584943c2e384c (diff) | |
download | gcc-89e7e0057fced928551d3169ccaec1a106be123b.tar.gz |
* intl.h (open_quote, close_quote): New.
* intl.c (open_quote, close_quote): New.
(gcc_init_libintl): Set them.
* pretty-print.c: Include "intl.h".
(pp_base_format_text): Support 'q' format flag and %` and %'
formats. Use ' instead of ` in comments.
* c-format.c (gcc_diag_flag_specs, gcc_cxxdiag_flag_specs,
gcc_diag_char_table, gcc_cdiag_char_table, gcc_cxxdiag_char_table,
foramt_types_orig): Describe these new formats.
(decode_format_attr, check_function_format,
check_format_info_main): Use these new formats.
(status_warning): Use ATTRIBUTE_GCC_DIAG.
* toplev.c (ATTRIBUTE_GCC_DIAG): Increase required GCC version to
check these formats to 3.5.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@82215 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/pretty-print.c')
-rw-r--r-- | gcc/pretty-print.c | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/gcc/pretty-print.c b/gcc/pretty-print.c index 46cae27504c..3f70277e0d6 100644 --- a/gcc/pretty-print.c +++ b/gcc/pretty-print.c @@ -24,6 +24,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #undef FFS /* Some systems define this in param.h. */ #include "system.h" #include "coretypes.h" +#include "intl.h" #include "pretty-print.h" #define obstack_chunk_alloc xmalloc @@ -177,9 +178,12 @@ pp_base_indent (pretty_printer *pp) %s: string. %p: pointer. %m: strerror(text->err_no) - does not consume a value from args_ptr. - %%: `%'. + %%: '%'. + %`: opening quote. + %': closing quote. %.*s: a substring the length of which is specified by an integer. - %H: location_t. */ + %H: location_t. + Flag 'q': quote formatted text (must come immediately after '%'). */ void pp_base_format_text (pretty_printer *pp, text_info *text) { @@ -187,6 +191,7 @@ pp_base_format_text (pretty_printer *pp, text_info *text) { int precision = 0; bool wide = false; + bool quoted = false; /* Ignore text. */ { @@ -200,8 +205,14 @@ pp_base_format_text (pretty_printer *pp, text_info *text) if (*text->format_spec == '\0') break; - /* We got a '%'. Parse precision modifiers, if any. */ - switch (*++text->format_spec) + /* We got a '%'. Check for 'q', then parse precision modifiers, + if any. */ + if (*++text->format_spec == 'q') + { + quoted = true; + ++text->format_spec; + } + switch (*text->format_spec) { case 'w': wide = true; @@ -221,6 +232,8 @@ pp_base_format_text (pretty_printer *pp, text_info *text) if (precision > 2) abort(); + if (quoted) + pp_string (pp, open_quote); switch (*text->format_spec) { case 'c': @@ -279,6 +292,14 @@ pp_base_format_text (pretty_printer *pp, text_info *text) pp_character (pp, '%'); break; + case '`': + pp_string (pp, open_quote); + break; + + case '\'': + pp_string (pp, close_quote); + break; + case 'H': { const location_t *locus = va_arg (*text->args_ptr, location_t *); @@ -293,7 +314,7 @@ pp_base_format_text (pretty_printer *pp, text_info *text) { int n; const char *s; - /* We handle no precision specifier but `%.*s'. */ + /* We handle no precision specifier but '%.*s'. */ if (*++text->format_spec != '*') abort (); else if (*++text->format_spec != 's') @@ -314,6 +335,8 @@ pp_base_format_text (pretty_printer *pp, text_info *text) abort (); } } + if (quoted) + pp_string (pp, close_quote); } } |