summaryrefslogtreecommitdiff
path: root/gcc/gencheck.c
diff options
context:
space:
mode:
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>2003-06-15 13:36:07 +0000
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>2003-06-15 13:36:07 +0000
commite2ee731bf11cf905827479625d69351f71201055 (patch)
tree8dc04abc6c35d920aca6b99fee3c42ba914df9c8 /gcc/gencheck.c
parent839151adeebaaf0dd12395ad390eb2dbcd955879 (diff)
downloadgcc-e2ee731bf11cf905827479625d69351f71201055.tar.gz
* gencheck.c (main): Avoid generating duplicate macros.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@67974 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gencheck.c')
-rw-r--r--gcc/gencheck.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/gcc/gencheck.c b/gcc/gencheck.c
index fd037bdd7f5..aedd4965530 100644
--- a/gcc/gencheck.c
+++ b/gcc/gencheck.c
@@ -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 */");