* gencheck.c (main): Avoid generating duplicate macros.

From-SVN: r67974
This commit is contained in:
Richard Kenner 2003-06-15 13:36:07 +00:00 committed by Richard Kenner
parent 9d5b9daeb9
commit cbdb4ba2dc
2 changed files with 13 additions and 3 deletions

View File

@ -15,6 +15,8 @@
2003-06-15 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* gencheck.c (main): Avoid generating duplicate macros.
* Makefile.in (stagefeedback-start): Use $(SUBDIRS) instead of
knowing names of language subdirectories.

View File

@ -44,7 +44,7 @@ usage (void)
int
main (int argc, char **argv ATTRIBUTE_UNUSED)
{
int i;
int i, j;
switch (argc)
{
@ -60,10 +60,18 @@ main (int argc, char **argv ATTRIBUTE_UNUSED)
puts ("#ifndef GCC_TREE_CHECK_H");
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++)
{
printf ("#define %s_CHECK(t)\tTREE_CHECK (t, %s)\n",
tree_codes[i], tree_codes[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]);
}
puts ("\n#endif /* GCC_TREE_CHECK_H */");