diff options
author | Jim Kingdon <jkingdon@engr.sgi.com> | 1993-07-28 00:22:08 +0000 |
---|---|---|
committer | Jim Kingdon <jkingdon@engr.sgi.com> | 1993-07-28 00:22:08 +0000 |
commit | 56ad756a85fdd60a23a88e5232904942d2c6aa38 (patch) | |
tree | 2dfa170f76b7ce3616309192f515633c4be9dd18 /gdb/buildsym.c | |
parent | 7706616f202b6c0adde4cd05e79f52d1e5f69a1c (diff) | |
download | gdb-56ad756a85fdd60a23a88e5232904942d2c6aa38.zip gdb-56ad756a85fdd60a23a88e5232904942d2c6aa38.tar.gz gdb-56ad756a85fdd60a23a88e5232904942d2c6aa38.tar.bz2 |
* buildsym.c (start_subfile): If a .c file includes a .C file, set
the language of both of them to C++.
Diffstat (limited to 'gdb/buildsym.c')
-rw-r--r-- | gdb/buildsym.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/gdb/buildsym.c b/gdb/buildsym.c index 6c8c807..ba593ca 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -412,6 +412,37 @@ start_subfile (name, dirname) { subfile->language = subfile->next->language; } + + /* cfront output is a C program, so in most ways it looks like a C + program. But to demangle we need to set the language to C++. We + can distinguish cfront code by the fact that it has #line + directives which specify a file name ending in .C. + + So if the filename of this subfile ends in .C, then change the language + of any pending subfiles from C to C++. .cc is also accepted, even + though I don't think cfront allows it. */ + + if (subfile->name) + { + char *p; + struct subfile *s; + + p = strrchr (subfile->name, '.'); + if (p != NULL + && (p[1] == 'C' && p[2] == '\0' + || p[1] == 'c' && p[2] == 'c' && p[3] == '\0')) + for (s = subfiles; s != NULL; s = s->next) + if (s->language == language_c) + s->language = language_cplus; + } + + /* And patch up this file if necessary. */ + if (subfile->language == language_c + && subfile->next != NULL + && subfile->next->language == language_cplus) + { + subfile->language = language_cplus; + } } /* For stabs readers, the first N_SO symbol is assumed to be the source |