Commit eb8221ea by Gabriel Dos Reis Committed by Gabriel Dos Reis

c-common.c: Don't undefine GCC_DIAG_STYLE.

	* c-common.c: Don't undefine GCC_DIAG_STYLE.
	(fname_decl): Don't use xxx_with_decl.
	(c_add_case_label): Likewise.
	(handle_section_attribute): Likewise.
	(handle_alias_attribute): Likewise.
	(handle_no_instrument_function_attribute): Likewise.
	(handle_no_limit_stack_attribute): Likewise.
	* c-objc-common.c (c_tree_printer): Print IDENTIFIER_NODEs.
	* c-format.c (gcc_cdiag_char_table): Add '%E' format-specifier.

From-SVN: r69573
parent 65f43cdf
2003-07-19 Gabriel Dos Reis <gdr@integrable-solutions.net>
* c-common.c: Don't undefine GCC_DIAG_STYLE.
(fname_decl): Don't use xxx_with_decl.
(c_add_case_label): Likewise.
(handle_section_attribute): Likewise.
(handle_alias_attribute): Likewise.
(handle_no_instrument_function_attribute): Likewise.
(handle_no_limit_stack_attribute): Likewise.
* c-objc-common.c (c_tree_printer): Print IDENTIFIER_NODEs.
* c-format.c (gcc_cdiag_char_table): Add '%E' format-specifier.
2003-07-19 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz> 2003-07-19 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
* Makefile.in (ifcvt.o): Add cfgloop.h. * Makefile.in (ifcvt.o): Add cfgloop.h.
......
...@@ -41,10 +41,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -41,10 +41,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "langhooks.h" #include "langhooks.h"
#include "tree-inline.h" #include "tree-inline.h"
#include "c-tree.h" #include "c-tree.h"
/* In order to ensure we use a common subset of valid specifiers
(between the various C family frontends) in this file, we restrict
ourselves to the generic specifier set. */
#undef GCC_DIAG_STYLE
#include "toplev.h" #include "toplev.h"
cpp_reader *parse_in; /* Declared in c-pragma.h. */ cpp_reader *parse_in; /* Declared in c-pragma.h. */
...@@ -1131,7 +1127,8 @@ fname_decl (unsigned int rid, tree id) ...@@ -1131,7 +1127,8 @@ fname_decl (unsigned int rid, tree id)
input_line = saved_lineno; input_line = saved_lineno;
} }
if (!ix && !current_function_decl) if (!ix && !current_function_decl)
pedwarn_with_decl (decl, "`%s' is not defined outside of function scope"); pedwarn ("%H'%D' is not defined outside of function scope",
&DECL_SOURCE_LOCATION (decl), decl);
return decl; return decl;
} }
...@@ -3916,18 +3913,19 @@ c_add_case_label (splay_tree cases, tree cond, tree low_value, ...@@ -3916,18 +3913,19 @@ c_add_case_label (splay_tree cases, tree cond, tree low_value,
if (high_value) if (high_value)
{ {
error ("duplicate (or overlapping) case value"); error ("duplicate (or overlapping) case value");
error_with_decl (duplicate, error ("%Hthis is the first entry overlapping that value",
"this is the first entry overlapping that value"); &DECL_SOURCE_LOCATION (duplicate));
} }
else if (low_value) else if (low_value)
{ {
error ("duplicate case value") ; error ("duplicate case value") ;
error_with_decl (duplicate, "previously used here"); error ("%Hpreviously used here", &DECL_SOURCE_LOCATION (duplicate));
} }
else else
{ {
error ("multiple default labels in one switch"); error ("multiple default labels in one switch");
error_with_decl (duplicate, "this is the first default label"); error ("%Hthis is the first default label",
&DECL_SOURCE_LOCATION (duplicate));
} }
if (!cases->root) if (!cases->root)
add_stmt (build_case_label (NULL_TREE, NULL_TREE, label)); add_stmt (build_case_label (NULL_TREE, NULL_TREE, label));
...@@ -4958,8 +4956,8 @@ handle_section_attribute (tree *node, tree name ATTRIBUTE_UNUSED, tree args, ...@@ -4958,8 +4956,8 @@ handle_section_attribute (tree *node, tree name ATTRIBUTE_UNUSED, tree args,
&& current_function_decl != NULL_TREE && current_function_decl != NULL_TREE
&& ! TREE_STATIC (decl)) && ! TREE_STATIC (decl))
{ {
error_with_decl (decl, error ("%Hsection attribute cannot be specified for "
"section attribute cannot be specified for local variables"); "local variables", &DECL_SOURCE_LOCATION (decl));
*no_add_attrs = true; *no_add_attrs = true;
} }
...@@ -4969,8 +4967,8 @@ handle_section_attribute (tree *node, tree name ATTRIBUTE_UNUSED, tree args, ...@@ -4969,8 +4967,8 @@ handle_section_attribute (tree *node, tree name ATTRIBUTE_UNUSED, tree args,
&& strcmp (TREE_STRING_POINTER (DECL_SECTION_NAME (decl)), && strcmp (TREE_STRING_POINTER (DECL_SECTION_NAME (decl)),
TREE_STRING_POINTER (TREE_VALUE (args))) != 0) TREE_STRING_POINTER (TREE_VALUE (args))) != 0)
{ {
error_with_decl (*node, error ("%Hsection of '%D' conflicts with previous declaration",
"section of `%s' conflicts with previous declaration"); &DECL_SOURCE_LOCATION (*node), *node);
*no_add_attrs = true; *no_add_attrs = true;
} }
else else
...@@ -4978,15 +4976,15 @@ handle_section_attribute (tree *node, tree name ATTRIBUTE_UNUSED, tree args, ...@@ -4978,15 +4976,15 @@ handle_section_attribute (tree *node, tree name ATTRIBUTE_UNUSED, tree args,
} }
else else
{ {
error_with_decl (*node, error ("%Hsection attribute not allowed for '%D'",
"section attribute not allowed for `%s'"); &DECL_SOURCE_LOCATION (*node), *node);
*no_add_attrs = true; *no_add_attrs = true;
} }
} }
else else
{ {
error_with_decl (*node, error ("%Hsection attributes are not supported for this target",
"section attributes are not supported for this target"); &DECL_SOURCE_LOCATION (*node));
*no_add_attrs = true; *no_add_attrs = true;
} }
...@@ -5060,8 +5058,8 @@ handle_aligned_attribute (tree *node, tree name ATTRIBUTE_UNUSED, tree args, ...@@ -5060,8 +5058,8 @@ handle_aligned_attribute (tree *node, tree name ATTRIBUTE_UNUSED, tree args,
else if (TREE_CODE (decl) != VAR_DECL else if (TREE_CODE (decl) != VAR_DECL
&& TREE_CODE (decl) != FIELD_DECL) && TREE_CODE (decl) != FIELD_DECL)
{ {
error_with_decl (decl, error ("%Halignment may not be specified for '%D'",
"alignment may not be specified for `%s'"); &DECL_SOURCE_LOCATION (decl), decl);
*no_add_attrs = true; *no_add_attrs = true;
} }
else else
...@@ -5099,8 +5097,8 @@ handle_alias_attribute (tree *node, tree name, tree args, ...@@ -5099,8 +5097,8 @@ handle_alias_attribute (tree *node, tree name, tree args,
if ((TREE_CODE (decl) == FUNCTION_DECL && DECL_INITIAL (decl)) if ((TREE_CODE (decl) == FUNCTION_DECL && DECL_INITIAL (decl))
|| (TREE_CODE (decl) != FUNCTION_DECL && ! DECL_EXTERNAL (decl))) || (TREE_CODE (decl) != FUNCTION_DECL && ! DECL_EXTERNAL (decl)))
{ {
error_with_decl (decl, error ("%H'%D' defined both normally and as an alias",
"`%s' defined both normally and as an alias"); &DECL_SOURCE_LOCATION (decl), decl);
*no_add_attrs = true; *no_add_attrs = true;
} }
else if (decl_function_context (decl) == 0) else if (decl_function_context (decl) == 0)
...@@ -5224,16 +5222,14 @@ handle_no_instrument_function_attribute (tree *node, tree name, ...@@ -5224,16 +5222,14 @@ handle_no_instrument_function_attribute (tree *node, tree name,
if (TREE_CODE (decl) != FUNCTION_DECL) if (TREE_CODE (decl) != FUNCTION_DECL)
{ {
error_with_decl (decl, error ("%H'%E' attribute applies only to functions",
"`%s' attribute applies only to functions", &DECL_SOURCE_LOCATION (decl), name);
IDENTIFIER_POINTER (name));
*no_add_attrs = true; *no_add_attrs = true;
} }
else if (DECL_INITIAL (decl)) else if (DECL_INITIAL (decl))
{ {
error_with_decl (decl, error ("%Hcan't set '%E' attribute after definition",
"can't set `%s' attribute after definition", &DECL_SOURCE_LOCATION (decl), name);
IDENTIFIER_POINTER (name));
*no_add_attrs = true; *no_add_attrs = true;
} }
else else
...@@ -5274,16 +5270,14 @@ handle_no_limit_stack_attribute (tree *node, tree name, ...@@ -5274,16 +5270,14 @@ handle_no_limit_stack_attribute (tree *node, tree name,
if (TREE_CODE (decl) != FUNCTION_DECL) if (TREE_CODE (decl) != FUNCTION_DECL)
{ {
error_with_decl (decl, error ("%H'%E' attribute applies only to functions",
"`%s' attribute applies only to functions", &DECL_SOURCE_LOCATION (decl), name);
IDENTIFIER_POINTER (name));
*no_add_attrs = true; *no_add_attrs = true;
} }
else if (DECL_INITIAL (decl)) else if (DECL_INITIAL (decl))
{ {
error_with_decl (decl, error ("%Hcan't set '%E' attribute after definition",
"can't set `%s' attribute after definition", &DECL_SOURCE_LOCATION (decl), name);
IDENTIFIER_POINTER (name));
*no_add_attrs = true; *no_add_attrs = true;
} }
else else
......
...@@ -830,7 +830,7 @@ static const format_char_info gcc_cdiag_char_table[] = ...@@ -830,7 +830,7 @@ static const format_char_info gcc_cdiag_char_table[] =
{ "H", 0, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "", "" }, { "H", 0, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "", "" },
/* These will require a "tree" at runtime. */ /* These will require a "tree" at runtime. */
{ "DFT", 0, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "", "" }, { "DEFT", 0, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "", "" },
{ "m", 0, STD_C89, NOARGUMENTS, "", "" }, { "m", 0, STD_C89, NOARGUMENTS, "", "" },
{ NULL, 0, 0, NOLENGTHS, NULL, NULL } { NULL, 0, 0, NOLENGTHS, NULL, NULL }
......
...@@ -407,6 +407,7 @@ c_objc_common_finish_file (void) ...@@ -407,6 +407,7 @@ c_objc_common_finish_file (void)
source-level entity onto BUFFER. The meaning of the format specifiers source-level entity onto BUFFER. The meaning of the format specifiers
is as follows: is as follows:
%D: a general decl, %D: a general decl,
%E: An expression,
%F: a function declaration, %F: a function declaration,
%T: a type. %T: a type.
...@@ -432,6 +433,14 @@ c_tree_printer (output_buffer *buffer, text_info *text) ...@@ -432,6 +433,14 @@ c_tree_printer (output_buffer *buffer, text_info *text)
} }
return true; return true;
case 'E':
if (TREE_CODE (t) == IDENTIFIER_NODE)
{
output_add_string (buffer, IDENTIFIER_POINTER (t));
return true;
}
return false;
default: default:
return false; return false;
} }
......
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