aboutsummaryrefslogtreecommitdiff
path: root/libcpp/line-map.c
diff options
context:
space:
mode:
authorDodji Seketeli <dodji@redhat.com>2011-08-28 20:14:46 +0000
committerDodji Seketeli <dodji@gcc.gnu.org>2011-08-28 22:14:46 +0200
commit892a371f3b8c8ce79f59540908a8660cfc07f880 (patch)
treeeceb7d4375de4bb00babcce955c7e39bab611ff1 /libcpp/line-map.c
parente90abaa0a28ccc5581f5b7c7abc789c8fb84764c (diff)
downloadgcc-892a371f3b8c8ce79f59540908a8660cfc07f880.zip
gcc-892a371f3b8c8ce79f59540908a8660cfc07f880.tar.gz
gcc-892a371f3b8c8ce79f59540908a8660cfc07f880.tar.bz2
Fix the use of linemap_add and remove unnecessary kludge
libcpp/ * line-map.c (linemap_add): Assert that reason must not be LC_RENAME when called for the first time on a "main input file". c-family/ * c-pch.c (c_common_read_pch): Call linemap_add with LC_ENTER as it's the first time it's being called on this main TU. gcc/lto/ * lto-lang.c (lto_init): Likewise. Also, avoid calling linemap_add twice. gcc/fortran/ * scanner.c (load_file): Don't abuse LC_RENAME reason while (indirectly) calling linemap_add. From-SVN: r178146
Diffstat (limited to 'libcpp/line-map.c')
-rw-r--r--libcpp/line-map.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/libcpp/line-map.c b/libcpp/line-map.c
index dd3f11c..2a0749a 100644
--- a/libcpp/line-map.c
+++ b/libcpp/line-map.c
@@ -114,11 +114,10 @@ linemap_add (struct line_maps *set, enum lc_reason reason,
if (reason == LC_RENAME_VERBATIM)
reason = LC_RENAME;
- /* If we don't keep our line maps consistent, we can easily
- segfault. Don't rely on the client to do it for us. */
- if (set->depth == 0)
- reason = LC_ENTER;
- else if (reason == LC_LEAVE)
+ if (set->depth == 0 && reason == LC_RENAME)
+ abort ();
+
+ if (reason == LC_LEAVE)
{
struct line_map *from;
bool error;