Commit 5c3c69f4 by Gabriel Dos Reis Committed by Gabriel Dos Reis

c-pretty-print.c (pp_c_semicolon): Fix formatting.

	* c-pretty-print.c (pp_c_semicolon): Fix formatting.
	(pp_c_cv_qualifier): Document.
	(pp_c_space_for_pointer_operator): Likewise.
	(pp_c_integer_constant): Likewise.
	(pp_c_identifier): Likewise.
	(pp_c_init_declarator): Don't print function body.

From-SVN: r79492
parent 33674f00
2004-03-15 Gabriel Dos Reis <gdr@integrable-solutions.net>
* c-pretty-print.c (pp_c_semicolon): Fix formatting.
(pp_c_cv_qualifier): Document.
(pp_c_space_for_pointer_operator): Likewise.
(pp_c_integer_constant): Likewise.
(pp_c_identifier): Likewise.
(pp_c_init_declarator): Don't print function body.
2004-03-14 Joseph S. Myers <jsm@polyomino.org.uk> 2004-03-14 Joseph S. Myers <jsm@polyomino.org.uk>
* doc/contrib.texi, doc/extend.texi, doc/gcov.texi, * doc/contrib.texi, doc/extend.texi, doc/gcov.texi,
......
...@@ -140,17 +140,22 @@ pp_c_arrow (c_pretty_printer *pp) ...@@ -140,17 +140,22 @@ pp_c_arrow (c_pretty_printer *pp)
} }
void void
pp_c_semicolon(c_pretty_printer *pp) pp_c_semicolon (c_pretty_printer *pp)
{ {
pp_semicolon (pp); pp_semicolon (pp);
pp_base (pp)->padding = pp_none; pp_base (pp)->padding = pp_none;
} }
/* Print out the external representation of CV-QUALIFIER. */
static void static void
pp_c_cv_qualifier (c_pretty_printer *pp, const char *cv) pp_c_cv_qualifier (c_pretty_printer *pp, const char *cv)
{ {
const char *p = pp_last_position_in_text (pp); const char *p = pp_last_position_in_text (pp);
if (p != NULL && *p == '*') /* The C programming language does not have references, but it is much
simpler to handle those here rather than going through the same
logic in the C++ pretty-printer. */
if (p != NULL && (*p == '*' || *p == '&'))
pp_c_whitespace (pp); pp_c_whitespace (pp);
pp_c_identifier (pp, cv); pp_c_identifier (pp, cv);
} }
...@@ -165,6 +170,9 @@ pp_c_type_cast (c_pretty_printer *pp, tree t) ...@@ -165,6 +170,9 @@ pp_c_type_cast (c_pretty_printer *pp, tree t)
pp_c_right_paren (pp); pp_c_right_paren (pp);
} }
/* We're about to pretty-print a pointer type as indicated by T.
Output a whitespace, if needed, preparing for subsequent output. */
void void
pp_c_space_for_pointer_operator (c_pretty_printer *pp, tree t) pp_c_space_for_pointer_operator (c_pretty_printer *pp, tree t)
{ {
...@@ -737,6 +745,8 @@ pp_c_string_literal (c_pretty_printer *pp, tree s) ...@@ -737,6 +745,8 @@ pp_c_string_literal (c_pretty_printer *pp, tree s)
pp_doublequote (pp); pp_doublequote (pp);
} }
/* Pretty-print an INTEGER literal. */
static void static void
pp_c_integer_constant (c_pretty_printer *pp, tree i) pp_c_integer_constant (c_pretty_printer *pp, tree i)
{ {
...@@ -922,6 +932,8 @@ pp_c_constant (c_pretty_printer *pp, tree e) ...@@ -922,6 +932,8 @@ pp_c_constant (c_pretty_printer *pp, tree e)
} }
} }
/* Pretty-print an IDENTIFIER_NODE, precedeed by whitespace is necessary. */
void void
pp_c_identifier (c_pretty_printer *pp, const char *id) pp_c_identifier (c_pretty_printer *pp, const char *id)
{ {
...@@ -1012,7 +1024,9 @@ void ...@@ -1012,7 +1024,9 @@ void
pp_c_init_declarator (c_pretty_printer *pp, tree t) pp_c_init_declarator (c_pretty_printer *pp, tree t)
{ {
pp_declarator (pp, t); pp_declarator (pp, t);
if (DECL_INITIAL (t)) /* We don't want to output function definitions here. There are handled
elsewhere (and the syntactic form is bogus anyway). */
if (TREE_CODE (t) != FUNCTION_DECL && DECL_INITIAL (t))
{ {
tree init = DECL_INITIAL (t); tree init = DECL_INITIAL (t);
/* This C++ bit is handled here because it is easier to do so. /* This C++ bit is handled here because it is easier to do so.
......
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