This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Minor cleanup in gencheck.c
- From: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 15 Jun 03 09:42:24 EDT
- Subject: Minor cleanup in gencheck.c
Because it includes tree nodes from all languages, it can write duplicate
macro definitions. Since they are identical, it isn't an error, but isn't
a particularly good idea either. This checks.
2003-06-15 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* gencheck.c (main): Avoid generating duplicate macros.
*** gencheck.c 1 Jun 2003 15:59:08 -0000 1.25
--- gencheck.c 15 Jun 2003 13:33:29 -0000
*************** int
*** 45,49 ****
main (int argc, char **argv ATTRIBUTE_UNUSED)
{
! int i;
switch (argc)
--- 45,49 ----
main (int argc, char **argv ATTRIBUTE_UNUSED)
{
! int i, j;
switch (argc)
*************** main (int argc, char **argv ATTRIBUTE_UN
*** 61,68 ****
puts ("#define GCC_TREE_CHECK_H\n");
for (i = 0; tree_codes[i]; i++)
{
! printf ("#define %s_CHECK(t)\tTREE_CHECK (t, %s)\n",
! tree_codes[i], tree_codes[i]);
}
--- 61,76 ----
puts ("#define GCC_TREE_CHECK_H\n");
+ /* Print macros for checks based on each of the tree code names. However,
+ since we include the tree nodes from all languages, we must check
+ for duplicate names to avoid defining the same macro twice. */
for (i = 0; tree_codes[i]; i++)
{
! for (j = 0; j < i; j++)
! if (strcmp (tree_codes[i], tree_codes[j]) == 0)
! break;
!
! if (i == j)
! printf ("#define %s_CHECK(t)\tTREE_CHECK (t, %s)\n",
! tree_codes[i], tree_codes[i]);
}