This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH to c-pretty-print.c: Add some comments
- From: gcc at integrable-solutions dot net
- To: gcc-patches at gcc dot gnu dot org
- Date: 14 Jul 2003 22:52:42 +0200
- Subject: PATCH to c-pretty-print.c: Add some comments
- Organization: Integrable Solutions
This adds some comments to c-pretty-print.c.
More should follow.
-- Gaby
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ChangeLog,v
retrieving revision 2.496
diff -p -r2.496 ChangeLog
*** ChangeLog 14 Jul 2003 20:36:19 -0000 2.496
--- ChangeLog 14 Jul 2003 20:43:17 -0000
***************
*** 1,3 ****
--- 1,8 ----
+ 2003-07-14 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * c-pretty-print.c (pp_c_unary_expression): A CONVERT_EXPR is
+ handled by pp_c_cast_expression.
+
2003-07-14 Richard Sandiford <rsandifo@redhat.com>
* config/mips/mips.c (mips_in_small_data_p): Don't handle
Index: c-pretty-print.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-pretty-print.c,v
retrieving revision 1.17
diff -p -r1.17 c-pretty-print.c
*** c-pretty-print.c 30 Jun 2003 19:36:20 -0000 1.17
--- c-pretty-print.c 14 Jul 2003 20:43:17 -0000
*************** Software Foundation, 59 Temple Place - S
*** 27,32 ****
--- 27,39 ----
#include "c-pretty-print.h"
#include "c-tree.h"
+ /* The pretty-printer code is primarily designed to closely follow
+ (GNU) C and C++ grammars. That is to be contrasted with spaghetti
+ codes we used to have in the past. Following a structured
+ approach (preferaably the official grammars) is believed to make it
+ much easier o add extensions and nifty pretty-printing effects that
+ takes expresssion or declaration contexts into account. */
+
/* literal */
static void pp_c_char (c_pretty_printer, int);
static void pp_c_character_literal (c_pretty_printer, tree);
*************** static void pp_c_function_specifier (c_p
*** 70,76 ****
/* Declarations. */
! /* Print out CV-qualifiers. Take care of possible extensions. */
void
pp_c_cv_qualifier (c_pretty_printer ppi, int cv)
{
--- 77,88 ----
/* Declarations. */
! /* Print out CV-qualifiers. Take care of possible extensions.
! cv-qualifier:
! const
! volatile
! restrict
! __restrict__ */
void
pp_c_cv_qualifier (c_pretty_printer ppi, int cv)
{
*************** pp_c_cv_qualifier (c_pretty_printer ppi,
*** 82,87 ****
--- 94,119 ----
pp_c_identifier (ppi, flag_isoc99 ? "restrict" : "__restrict__");
}
+ /*
+ simple-type-specifier:
+ void
+ char
+ short
+ int
+ long
+ float
+ double
+ signed
+ unsigned
+ _Bool -- C99
+ _Complex -- C99
+ _Imaginary -- C99
+ typedef-name.
+
+ GNU extensions.
+ simple-type-specifier:
+ __complex__
+ __vector__ */
static void
pp_c_simple_type_specifier (c_pretty_printer ppi, tree t)
{
*************** pp_c_simple_type_specifier (c_pretty_pri
*** 149,154 ****
--- 181,189 ----
}
}
+ /* specifier-qualifier-list:
+ type-specifier specifier-qualifier-list-opt
+ cv-qualifier specifier-qualifier-list-opt */
static inline void
pp_c_specifier_qualifier_list (c_pretty_printer ppi, tree t)
{
*************** pp_c_expression_list (c_pretty_printer p
*** 688,693 ****
--- 723,745 ----
}
}
+ /* unary-expression:
+ postfix-expression
+ ++ cast-expression
+ -- cast-expression
+ unary-operator cast-expression
+ sizeof unary-expression
+ sizeof ( type-id )
+
+ unary-operator: one of
+ * & + - ! ~
+
+ GNU extensions.
+ unary-expression:
+ __alignof__ unary-expression
+ __alignof__ ( type-id )
+ __real__ unary-expression
+ __imag__ unary-expression */
static void
pp_c_unary_expression (c_pretty_printer ppi, tree e)
{
*************** pp_c_unary_expression (c_pretty_printer
*** 702,708 ****
case ADDR_EXPR:
case INDIRECT_REF:
- case CONVERT_EXPR:
case NEGATE_EXPR:
case BIT_NOT_EXPR:
case TRUTH_NOT_EXPR:
--- 754,759 ----